Numworks Epsilon  1.4.1
Graphing Calculator Operating System
selectable_table_view.h
Go to the documentation of this file.
1 #ifndef ESCHER_SELECTABLE_TABLE_VIEW_H
2 #define ESCHER_SELECTABLE_TABLE_VIEW_H
3 
4 #include <escher/table_view.h>
5 #include <escher/app.h>
9 #include <escher/palette.h>
10 #include <escher/responder.h>
11 
12 /* SelectableTableView is a Table View that handles selection. To implement it,
13  * it needs a class which should be both data source and view controller. This
14  * takes the selectable table view as instance variable and makes it first
15  * responder. The selectable table view bubles up events when they do not
16  * concern selection. */
17 
18 class SelectableTableView : public TableView, public Responder {
19 public:
21  SelectableTableViewDataSource * selectionDataSource = nullptr, SelectableTableViewDelegate * delegate = nullptr);
22  template <typename T> SelectableTableView(T * p) : SelectableTableView(p, p, p) {};
23  int selectedRow();
24  int selectedColumn();
25  void selectRow(int j);
26  void selectColumn(int i);
27  void reloadData(bool setFirstResponder = true);
28  virtual bool handleEvent(Ion::Events::Event event) override;
29  virtual void didEnterResponderChain(Responder * previousFirstResponder) override;
30  virtual void willExitResponderChain(Responder * nextFirstResponder) override;
31  void deselectTable();
32  bool selectCellAtLocation(int i, int j, bool setFirstResponder = true);
34 protected:
37 private:
38  void unhighlightSelectedCell();
39 };
40 
41 #endif
HighlightCell * selectedCell()
SelectableTableView(Responder *parentResponder, TableViewDataSource *dataSource, SelectableTableViewDataSource *selectionDataSource=nullptr, SelectableTableViewDelegate *delegate=nullptr)
Responder * parentResponder() const
Definition: responder.cpp:12
SelectableTableViewDelegate * m_delegate
#define T(x)
Definition: events.cpp:26
bool selectCellAtLocation(int i, int j, bool setFirstResponder=true)
virtual void didEnterResponderChain(Responder *previousFirstResponder) override
TableViewDataSource * dataSource()
Definition: table_view.cpp:20
void reloadData(bool setFirstResponder=true)
virtual bool handleEvent(Ion::Events::Event event) override
virtual void willExitResponderChain(Responder *nextFirstResponder) override
SelectableTableViewDataSource * m_selectionDataSource