mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-22 15:20:39 +01:00
70 lines
2.2 KiB
C++
70 lines
2.2 KiB
C++
#ifndef SHARED_SCROLLABLE_EXACT_APPROXIMATE_EXPRESSIONS_VIEW_H
|
|
#define SHARED_SCROLLABLE_EXACT_APPROXIMATE_EXPRESSIONS_VIEW_H
|
|
|
|
#include <escher.h>
|
|
|
|
namespace Shared {
|
|
|
|
class ScrollableExactApproximateExpressionsView : public ScrollableView, public ScrollViewDataSource {
|
|
public:
|
|
enum class SubviewType {
|
|
ExactOutput,
|
|
ApproximativeOutput
|
|
};
|
|
ScrollableExactApproximateExpressionsView(Responder * parentResponder);
|
|
::EvenOddCell * evenOddCell() {
|
|
return &m_contentCell;
|
|
}
|
|
void setLayouts(Poincare::LayoutReference approximatelayout, Poincare::LayoutReference exactLayout);
|
|
void setEqualMessage(I18n::Message equalSignMessage);
|
|
SubviewType selectedSubviewType() {
|
|
return m_contentCell.selectedSubviewType();
|
|
}
|
|
void setSelectedSubviewType(SubviewType subviewType) {
|
|
m_contentCell.setSelectedSubviewType(subviewType);
|
|
}
|
|
void didBecomeFirstResponder() override;
|
|
bool handleEvent(Ion::Events::Event event) override;
|
|
KDSize minimalSizeForOptimalDisplay() const override;
|
|
Poincare::LayoutRef layoutRef() const {
|
|
return m_contentCell.layoutRef();
|
|
}
|
|
private:
|
|
class ContentCell : public ::EvenOddCell {
|
|
public:
|
|
ContentCell();
|
|
KDColor backgroundColor() const override;
|
|
void setHighlighted(bool highlight) override;
|
|
void reloadCell() override;
|
|
KDSize minimalSizeForOptimalDisplay() const override;
|
|
ExpressionView * approximateExpressionView() {
|
|
return &m_approximateExpressionView;
|
|
}
|
|
ExpressionView * exactExpressionView() {
|
|
return &m_exactExpressionView;
|
|
}
|
|
MessageTextView * approximateSign() {
|
|
return &m_approximateSign;
|
|
}
|
|
SubviewType selectedSubviewType() {
|
|
return m_selectedSubviewType;
|
|
}
|
|
void setSelectedSubviewType(SubviewType subviewType);
|
|
void layoutSubviews() override;
|
|
int numberOfSubviews() const override;
|
|
Poincare::LayoutRef layoutRef() const override;
|
|
private:
|
|
View * subviewAtIndex(int index) override;
|
|
constexpr static KDCoordinate k_digitHorizontalMargin = 10;
|
|
ExpressionView m_approximateExpressionView;
|
|
MessageTextView m_approximateSign;
|
|
ExpressionView m_exactExpressionView;
|
|
SubviewType m_selectedSubviewType;
|
|
};
|
|
ContentCell m_contentCell;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|