Numworks Epsilon  1.4.1
Graphing Calculator Operating System
switch_view.h
Go to the documentation of this file.
1 #ifndef ESCHER_SWITCH_VIEW_H
2 #define ESCHER_SWITCH_VIEW_H
3 
4 #include <escher/view.h>
5 
6 class SwitchView : public View {
7 public:
8  SwitchView();
9  bool state();
10  void setState(bool state);
11  void drawRect(KDContext * ctx, KDRect rect) const override;
12  KDSize minimalSizeForOptimalDisplay() const override;
13  /* k_switchHeight and k_switchWidth are the dimensions of the switch
14  * (including the outline of the switch). */
15  constexpr static KDCoordinate k_onOffSize = 12;
16  constexpr static KDCoordinate k_switchHeight = 12;
17  constexpr static KDCoordinate k_switchWidth = 22;
18 private:
19  bool m_state;
20 };
21 
22 #endif
void drawRect(KDContext *ctx, KDRect rect) const override
Definition: switch_view.cpp:52
int16_t KDCoordinate
Definition: coordinate.h:6
Definition: size.h:6
static constexpr KDCoordinate k_switchHeight
Definition: switch_view.h:16
KDSize minimalSizeForOptimalDisplay() const override
Definition: switch_view.cpp:68
bool state()
Definition: switch_view.cpp:41
Definition: rect.h:26
static constexpr KDCoordinate k_onOffSize
Definition: switch_view.h:15
Definition: view.h:23
static constexpr KDCoordinate k_switchWidth
Definition: switch_view.h:17
void setState(bool state)
Definition: switch_view.cpp:45