Numworks Epsilon  1.4.1
Graphing Calculator Operating System
controller.h
Go to the documentation of this file.
1 #ifndef HOME_CONTROLLER_H
2 #define HOME_CONTROLLER_H
3 
4 #include <escher.h>
5 #include "app_cell.h"
6 
7 class AppsContainer;
8 
9 namespace Home {
10 
12 public:
13  Controller(Responder * parentResponder, ::AppsContainer * container, SelectableTableViewDataSource * selectionDataSource);
14 
15  View * view() override;
16 
17  bool handleEvent(Ion::Events::Event event) override;
18  void didBecomeFirstResponder() override;
19  void viewWillAppear() override;
20 
21  virtual int numberOfRows() override;
22  virtual int numberOfColumns() override;
23  virtual KDCoordinate cellHeight() override;
24  virtual KDCoordinate cellWidth() override;
25  virtual HighlightCell * reusableCell(int index) override;
26  virtual int reusableCellCount() override;
27  void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override;
28  void tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY) override;
29 private:
30  int numberOfIcons();
31  class ContentView : public View {
32  public:
33  ContentView(Controller * controller, SelectableTableViewDataSource * selectionDataSource);
34  SelectableTableView * selectableTableView();
35  void drawRect(KDContext * ctx, KDRect rect) const override;
36  void reloadBottomRightCorner(SimpleTableViewDataSource * dataSource);
37  private:
38  int numberOfSubviews() const override;
39  View * subviewAtIndex(int index) override;
40  void layoutSubviews() override;
41  SelectableTableView m_selectableTableView;
42  };
43  AppsContainer * m_container;
44  static constexpr KDCoordinate k_sideMargin = 4;
45  static constexpr KDCoordinate k_indicatorThickness = 28;
46  static constexpr KDCoordinate k_indicatorMargin = 116;
47  static constexpr int k_numberOfColumns = 4;
48  static constexpr int k_numberOfApps = 10;
49  static constexpr int k_maxNumberOfCells = 16;
50  static constexpr int k_cellHeight = 98;
51  static constexpr int k_cellWidth = 104;
52  ContentView m_view;
53  AppCell m_cells[k_maxNumberOfCells];
54  SelectableTableViewDataSource * m_selectionDataSource;
55 };
56 
57 }
58 
59 #endif
virtual HighlightCell * reusableCell(int index) override
Definition: controller.cpp:99
virtual int numberOfColumns() override
Definition: controller.cpp:87
int16_t KDCoordinate
Definition: coordinate.h:6
View * view() override
Definition: controller.cpp:79
Responder * parentResponder() const
Definition: responder.cpp:12
void didBecomeFirstResponder() override
Definition: controller.cpp:67
virtual int numberOfRows() override
Definition: controller.cpp:83
void viewWillAppear() override
Definition: controller.cpp:76
bool handleEvent(Ion::Events::Event event) override
Definition: controller.cpp:54
virtual KDCoordinate cellHeight() override
Definition: controller.cpp:91
Definition: app.cpp:9
void willDisplayCellAtLocation(HighlightCell *cell, int i, int j) override
Definition: controller.cpp:107
Definition: rect.h:26
virtual int reusableCellCount() override
Definition: controller.cpp:103
Definition: view.h:23
Controller(Responder *parentResponder, ::AppsContainer *container, SelectableTableViewDataSource *selectionDataSource)
Definition: controller.cpp:46
virtual KDCoordinate cellWidth() override
Definition: controller.cpp:95
void tableViewDidChangeSelection(SelectableTableView *t, int previousSelectedCellX, int previousSelectedCellY) override
Definition: controller.cpp:124