/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "mode_switcher.h"
#include "test_mode.h"


ModeSwitcher::ModeSwitcher()
{
	static TestMode test_mode;

	_modes.push_back( &test_mode );
}


void ModeSwitcher::short_press()
{
	_modes[ _mode ]->next_flavour();
}


void ModeSwitcher::long_press()
{
	if( ++_mode >= (signed)_modes.size() )
		_mode = 0;
	_modes[ _mode ]->activate();
}


void ModeSwitcher::activate()
{
	_mode = 0;
	_modes[ _mode ]->activate();
}


Drawer &ModeSwitcher::get_drawer()
{
	return *_modes[ _mode ];
}