Blame view

build2/epsilon-master/apps/variable_box_controller.h 2.34 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 APPS_VARIABLE_BOX_CONTROLLER_H
  #define APPS_VARIABLE_BOX_CONTROLLER_H
  
  #define MATRIX_VARIABLES 1
  
  #include <escher.h>
  #include <poincare.h>
  #include "variable_box_leaf_cell.h"
  #include "i18n.h"
  
  class VariableBoxController : public StackViewController {
  public:
    VariableBoxController(Poincare::GlobalContext * context);
    void didBecomeFirstResponder() override;
    void setSender(Responder * sender);
    void viewWillAppear() override;
    void viewDidDisappear() override;
  private:
    class ContentViewController : public ViewController, public ListViewDataSource, public SelectableTableViewDataSource {
    public:
      ContentViewController(Responder * parentResponder, Poincare::GlobalContext * context);
      View * view() override;
      const char * title() override;
      void didBecomeFirstResponder() override;
      bool handleEvent(Ion::Events::Event event) override;
      int numberOfRows() override;
      HighlightCell * reusableCell(int index, int type) override;
      int reusableCellCount(int type) override;
      void willDisplayCellForIndex(HighlightCell * cell, int index) override;
      KDCoordinate rowHeight(int j) override;
      int typeAtLocation(int i, int j) override;
      void setSender(Responder * responder) { m_sender = responder; }
      void reloadData();
      void resetPage();
      void viewDidDisappear() override;
    private:
      enum class Page {
        RootMenu,
        Scalar,
  #if LIST_VARIABLES
        List,
  #endif
        Matrix
      };
      constexpr static int k_maxNumberOfDisplayedRows = 6; //240/Matrix::ToolboxRowHeight
  #if LIST_VARIABLES
      constexpr static int k_numberOfMenuRows = 3;
  #else
      constexpr static int k_numberOfMenuRows = 2;
  #endif
      constexpr static KDCoordinate k_leafMargin = 20;
      Page pageAtIndex(int index);
      void putLabelAtIndexInBuffer(int index, char * buffer);
      I18n::Message nodeLabelAtIndex(int index);
      const Poincare::Expression * expressionForIndex(int index);
      Poincare::ExpressionLayout * expressionLayoutForIndex(int index);
      Poincare::GlobalContext * m_context;
      Responder * m_sender;
      int m_firstSelectedRow;
      int m_previousSelectedRow;
      Page m_currentPage;
      VariableBoxLeafCell m_leafCells[k_maxNumberOfDisplayedRows];
      MessageTableCellWithChevron m_nodeCells[k_numberOfMenuRows];
      SelectableTableView m_selectableTableView;
    };
    ContentViewController m_contentViewController;
  };
  
  #endif