mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-29 19:49:58 +02:00
[apps/calculation] additional_outputs: make a parent class to
TrigonometryGraphCell and ComplexGraphCell inheriting from BorderedCell
This commit is contained in:
@@ -13,6 +13,7 @@ app_calculation_src = $(addprefix apps/calculation/,\
|
||||
additional_outputs/expression_with_equal_sign_view.cpp \
|
||||
additional_outputs/expressions_list_controller.cpp \
|
||||
additional_outputs/illustrated_list_controller.cpp \
|
||||
additional_outputs/illustration_cell.cpp \
|
||||
additional_outputs/integer_list_controller.cpp \
|
||||
additional_outputs/scrollable_input_exact_approximate_expressions_cell.cpp \
|
||||
additional_outputs/list_controller.cpp \
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "../../shared/curve_view.h"
|
||||
#include "complex_model.h"
|
||||
#include "illustration_cell.h"
|
||||
|
||||
namespace Calculation {
|
||||
|
||||
@@ -21,15 +22,12 @@ private:
|
||||
ComplexModel * m_complex;
|
||||
};
|
||||
|
||||
class ComplexGraphCell : public HighlightCell {
|
||||
class ComplexGraphCell : public IllustrationCell {
|
||||
public:
|
||||
ComplexGraphCell(ComplexModel * complexModel) : m_view(complexModel) {}
|
||||
void setHighlighted(bool highlight) override { return; }
|
||||
void reload() { m_view.reload(); }
|
||||
private:
|
||||
int numberOfSubviews() const override { return 1; }
|
||||
View * subviewAtIndex(int index) override { return &m_view; }
|
||||
void layoutSubviews(bool force = false) override { m_view.setFrame(bounds(), force); }
|
||||
View * view() override { return &m_view; }
|
||||
ComplexGraphView m_view;
|
||||
};
|
||||
|
||||
|
||||
12
apps/calculation/additional_outputs/illustration_cell.cpp
Normal file
12
apps/calculation/additional_outputs/illustration_cell.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "illustration_cell.h"
|
||||
|
||||
using namespace Shared;
|
||||
using namespace Poincare;
|
||||
|
||||
namespace Calculation {
|
||||
|
||||
void IllustrationCell::layoutSubviews(bool force) {
|
||||
view()->setFrame(KDRect(Metric::CellSeparatorThickness, Metric::CellSeparatorThickness, bounds().width() - 2*Metric::CellSeparatorThickness, bounds().height() - 2*Metric::CellSeparatorThickness), force);
|
||||
}
|
||||
|
||||
}
|
||||
22
apps/calculation/additional_outputs/illustration_cell.h
Normal file
22
apps/calculation/additional_outputs/illustration_cell.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef CALCULATION_ADDITIONAL_OUTPUTS_ILLUSTRATION_CELL_H
|
||||
#define CALCULATION_ADDITIONAL_OUTPUTS_ILLUSTRATION_CELL_H
|
||||
|
||||
#include <escher/bordered_cell.h>
|
||||
|
||||
namespace Calculation {
|
||||
|
||||
class IllustrationCell : public BorderedCell {
|
||||
public:
|
||||
using BorderedCell::BorderedCell;
|
||||
void setHighlighted(bool highlight) override { return; }
|
||||
private:
|
||||
int numberOfSubviews() const override { return 1; }
|
||||
View * subviewAtIndex(int index) override { return view(); }
|
||||
void layoutSubviews(bool force = false) override;
|
||||
virtual View * view() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "../../shared/curve_view.h"
|
||||
#include "trigonometry_model.h"
|
||||
#include "illustration_cell.h"
|
||||
|
||||
namespace Calculation {
|
||||
|
||||
@@ -15,14 +16,11 @@ private:
|
||||
TrigonometryModel * m_model;
|
||||
};
|
||||
|
||||
class TrigonometryGraphCell : public HighlightCell {
|
||||
class TrigonometryGraphCell : public IllustrationCell {
|
||||
public:
|
||||
TrigonometryGraphCell(TrigonometryModel * model) : m_view(model) {}
|
||||
void setHighlighted(bool highlight) override { return; }
|
||||
private:
|
||||
int numberOfSubviews() const override { return 1; }
|
||||
View * subviewAtIndex(int index) override { return &m_view; }
|
||||
void layoutSubviews(bool force = false) override { m_view.setFrame(bounds(), force); }
|
||||
View * view() override { return &m_view; }
|
||||
TrigonometryGraphView m_view;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user