Blame view

epsilon-master/apps/shared/scrollable_exact_approximate_expressions_view.h 2.19 KB
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  #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 setExpressions(Poincare::ExpressionLayout ** expressionsLayout);
    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::ExpressionLayout * expressionLayout() const {
      return m_contentCell.expressionLayout();
    }
  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::ExpressionLayout * expressionLayout() 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