/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock

« back to all changes in this revision

Viewing changes to src/mode_switcher.cc

  • Committer: Dan
  • Date: 2011-11-03 00:54:13 UTC
  • Revision ID: dan@waxworlds.org-20111103005413-miheyjsrpm3a0r1e
modified notes

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
}