Blame view

epsilon-master/apps/solver/equation_list_view.h 1.28 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
  #ifndef SOLVER_EQUATION_LIST_VIEW_H
  #define SOLVER_EQUATION_LIST_VIEW_H
  
  #include <escher.h>
  
  namespace Solver {
  
  class EquationListView : public Responder, public View, public ScrollViewDelegate, public ScrollViewDataSource {
  public:
    enum class BraceStyle {
      None,
      OneRowShort,
      Full
    };
    EquationListView(Responder * parentResponder, TableViewDataSource * dataSource, SelectableTableViewDataSource * selectionDataSource);
    void setBraceStyle(BraceStyle style);
    void scrollViewDidChangeOffset(ScrollViewDataSource * scrollViewDataSource) override;
    void didBecomeFirstResponder() override;
    SelectableTableView * selectableTableView() {
      return &m_listView;
    }
    constexpr static KDCoordinate k_margin = 10;
    constexpr static KDCoordinate k_braceTotalWidth = 30;//2*k_margin+BraceView::k_braceWidth;
    void layoutSubviews() override;
  private:
    int numberOfSubviews() const override;
    View * subviewAtIndex(int index) override;
  
    class BraceView : public View {
    public:
      void drawRect(KDContext * ctx, KDRect rect) const override;
      KDSize minimalSizeForOptimalDisplay() const override;
      constexpr static KDCoordinate k_braceWidth = 10;
    };
    BraceStyle m_braceStyle;
    SelectableTableView m_listView;
    BraceView m_braceView;
    ScrollView m_scrollBraceView;
  };
  
  }
  
  #endif