Numworks Epsilon  1.4.1
Graphing Calculator Operating System
tab_view.h
Go to the documentation of this file.
1 #ifndef ESCHER_TAB_VIEW_H
2 #define ESCHER_TAB_VIEW_H
3 
4 #include <escher/view.h>
5 #include <escher/i18n.h>
6 #include <escher/tab_view_cell.h>
8 
10 
11 class TabView : public View {
12 public:
13  TabView();
14  int numberOfTabs() const;
15  void drawRect(KDContext * ctx, KDRect rect) const override;
16 
17  void addTab(ViewController * controller);
18  //TODO: void removeLastTab();
19  void setActiveIndex(int index);
20  void setSelectedIndex(int index);
21 protected:
22 #if ESCHER_VIEW_LOGGING
23  const char * className() const override;
24  void logAttributes(std::ostream &os) const override;
25 #endif
26 private:
27  constexpr static KDCoordinate k_activeTabHeight = 5;
28  int numberOfSubviews() const override;
29  View * subviewAtIndex(int index) override;
30  void layoutSubviews() override;
31 
32  constexpr static uint8_t k_maxNumberOfTabs = 4;
33  TabViewCell m_cells[k_maxNumberOfTabs];
34  uint8_t m_numberOfTabs;
35  int8_t m_activeTabIndex;
36  int8_t m_selectedTabIndex;
37 };
38 
39 #endif
int16_t KDCoordinate
Definition: coordinate.h:6
unsigned char uint8_t
Definition: stdint.h:4
TabView()
Definition: tab_view.cpp:7
void setActiveIndex(int index)
Definition: tab_view.cpp:34
signed char int8_t
Definition: stdint.h:9
int numberOfTabs() const
Definition: tab_view.cpp:15
Definition: rect.h:26
Definition: view.h:23
void setSelectedIndex(int index)
Definition: tab_view.cpp:46
void drawRect(KDContext *ctx, KDRect rect) const override
Definition: tab_view.cpp:19
void addTab(ViewController *controller)
Definition: tab_view.cpp:26