Blame view

build4/epsilon-master/apps/home/controller.h 2.08 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
  #ifndef HOME_CONTROLLER_H
  #define HOME_CONTROLLER_H
  
  #include <escher.h>
  #include "app_cell.h"
  
  class AppsContainer;
  
  namespace Home {
  
  class Controller : public ViewController, public SimpleTableViewDataSource, public SelectableTableViewDelegate {
  public:
    Controller(Responder * parentResponder, ::AppsContainer * container, SelectableTableViewDataSource * selectionDataSource);
  
    View * view() override;
  
    bool handleEvent(Ion::Events::Event event) override;
    void didBecomeFirstResponder() override;
    void viewWillAppear() override;
  
    virtual int numberOfRows() override;
    virtual int numberOfColumns() override;
    virtual KDCoordinate cellHeight() override;
    virtual KDCoordinate cellWidth() override;
    virtual HighlightCell * reusableCell(int index) override;
    virtual int reusableCellCount() override;
    void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override;
    void tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY) override;
  private:
    int numberOfIcons();
    class ContentView : public View {
    public:
      ContentView(Controller * controller, SelectableTableViewDataSource * selectionDataSource);
      SelectableTableView * selectableTableView();
      void drawRect(KDContext * ctx, KDRect rect) const override;
      void reloadBottomRightCorner(SimpleTableViewDataSource * dataSource);
    private:
      int numberOfSubviews() const override;
      View * subviewAtIndex(int index) override;
      void layoutSubviews() override;
      SelectableTableView m_selectableTableView;
    };
    AppsContainer * m_container;
    static constexpr KDCoordinate k_sideMargin = 4;
    static constexpr KDCoordinate k_bottomMargin = 14;
    static constexpr KDCoordinate k_indicatorThickness = 15;
    static constexpr KDCoordinate k_indicatorMargin = 61;
    static constexpr int k_numberOfColumns = 3;
    static constexpr int k_maxNumberOfCells = 16;
    static constexpr int k_cellHeight = 104;
    static constexpr int k_cellWidth = 104;
    ContentView m_view;
    AppCell m_cells[k_maxNumberOfCells];
    SelectableTableViewDataSource * m_selectionDataSource;
  };
  
  }
  
  #endif