bzr branch
http://bzr.ed.am/elec/propeller-clock
56
by edam
updated software to include drawing abstraction infrastructure |
1 |
#include "mode_switcher.h" |
2 |
#include "test_mode.h" |
|
3 |
||
4 |
||
5 |
ModeSwitcher::ModeSwitcher() |
|
6 |
{ |
|
7 |
static TestMode test_mode; |
|
8 |
||
9 |
_modes.push_back( &test_mode ); |
|
10 |
} |
|
11 |
||
12 |
||
13 |
void ModeSwitcher::short_press() |
|
14 |
{ |
|
15 |
_modes[ _mode ]->next_flavour(); |
|
16 |
} |
|
17 |
||
18 |
||
19 |
void ModeSwitcher::long_press() |
|
20 |
{ |
|
21 |
if( ++_mode >= (signed)_modes.size() ) |
|
22 |
_mode = 0; |
|
23 |
_modes[ _mode ]->activate(); |
|
24 |
} |
|
25 |
||
26 |
||
27 |
void ModeSwitcher::activate() |
|
28 |
{ |
|
29 |
_mode = 0; |
|
30 |
_modes[ _mode ]->activate(); |
|
31 |
} |
|
32 |
||
33 |
||
34 |
Drawer &ModeSwitcher::get_drawer() |
|
35 |
{ |
|
36 |
return *_modes[ _mode ]; |
|
37 |
} |