/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/modes/settings_major_mode.h

  • Committer: edam
  • Date: 2012-05-18 12:11:01 UTC
  • Revision ID: tim@ed.am-20120518121101-0wik922hyvjkcjdi
switched back to using classes for modes

Show diffs side-by-side

added added

removed removed

1
1
/*
2
 
 * settings_mode.h
 
2
 * settings_major_mode.h
3
3
 *
4
4
 * Copyright (C) 2011 Tim Marston <tim@ed.am> and Dan Marston.
5
5
 *
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/>.
22
22
 */
23
 
#ifndef _SETTINGS_MODE_H_
24
 
#define _SETTINGS_MODE_H_
25
 
 
26
 
 
27
 
/**
28
 
 * Called to inform the mode that there has been a (short) button press.
29
 
 */
30
 
extern void settings_mode_press();
31
 
 
32
 
/**
33
 
 * Called to inform the mode that there has been a long button press.
34
 
 */
35
 
extern void settings_mode_long_press();
36
 
 
37
 
/**
38
 
 * Draw an individual segment (column of pixels)
39
 
 *
40
 
 * @param segment the segment number
41
 
 */
42
 
extern void settings_mode_draw( int segment );
43
 
 
44
 
/**
45
 
 * Called before the first segment is drawn, once per "frame".
46
 
 */
47
 
extern void settings_mode_draw_reset();
48
 
 
49
 
/**
50
 
 * Called when this minor mode becomes active
51
 
 */
52
 
extern void settings_mode_activate();
53
 
 
54
 
 
55
 
#endif //_SETTINGS_MODE_H_
 
23
#ifndef _SETTINGS_MAJOR_MODE_H_
 
24
#define _SETTINGS_MAJOR_MODE_H_
 
25
 
 
26
 
 
27
#include "major_mode.h"
 
28
 
 
29
 
 
30
class SettingsMajorMode : public MajorMode
 
31
{
 
32
public:
 
33
 
 
34
        /**
 
35
         * Called once per segment to draw a column of LEDs.
 
36
         * @param segment the segment number to draw
 
37
         */
 
38
        void draw( int segment );
 
39
 
 
40
        /**
 
41
         * Called at the start of a "frame", before any segments are drawn.
 
42
         */
 
43
        void draw_reset();
 
44
 
 
45
        /**
 
46
         * Called when the mode is becoming active.
 
47
         */
 
48
        void activate();
 
49
 
 
50
        /**
 
51
         * Called when the mode is becoming inactive.
 
52
         */
 
53
        void deactivate();
 
54
 
 
55
        /**
 
56
         * Called when the button has been pressed.
 
57
         */
 
58
        void press();
 
59
 
 
60
        /**
 
61
         * Called when the button haas been long-pressed.
 
62
         */
 
63
        void long_press();
 
64
 
 
65
private:
 
66
 
 
67
        /**
 
68
         * Set up message buffers.
 
69
         */
 
70
        void reset_messages();
 
71
 
 
72
        /** item we're setting */
 
73
        int _item;
 
74
        
 
75
        /** part of item that we're setting */
 
76
        int _part;
 
77
};
 
78
 
 
79
 
 
80
#endif //_SETTINGS_MAJOR_MODE_H_