20
20
* You should have received a copy of the GNU Lesser General Public License
21
21
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23
#include "switcher_major_mode.h"
23
#include "mode_switcher.h"
24
24
#include "test_mode.h"
25
25
#include "analogue_clock_mode.h"
26
#include "digital_clock_mode.h"
30
SwitcherMajorMode::SwitcherMajorMode()
28
ModeSwitcher::ModeSwitcher()
32
for( int a = 0; a < MAX_MINOR_MODES; a++ )
35
30
static TestMode test_mode;
36
31
static AnalogueClockMode analogue_clock_mode;
37
static DigitalClockMode digital_clock_mode;
40
_modes[ mode++ ] = &analogue_clock_mode;
41
_modes[ mode++ ] = &digital_clock_mode;
42
_modes[ mode++ ] = &test_mode;
46
void SwitcherMajorMode::press()
48
_modes[ _mode ]->press();
52
void SwitcherMajorMode::long_press()
55
if( ++_mode >= MAX_MINOR_MODES )
57
} while( _modes[ _mode ] == NULL );
33
_modes.push_back( &test_mode );
34
_modes.push_back( &analogue_clock_mode );
38
void ModeSwitcher::short_press()
40
_modes[ _mode ]->next_flavour();
44
void ModeSwitcher::long_press()
46
if( ++_mode >= (signed)_modes.size() )
58
48
_modes[ _mode ]->activate();
62
void SwitcherMajorMode::activate()
52
void ModeSwitcher::activate()
65
55
_modes[ _mode ]->activate();
69
Drawer &SwitcherMajorMode::get_drawer()
59
Drawer &ModeSwitcher::get_drawer()
71
61
return *_modes[ _mode ];