diff options
-rw-r--r-- | src/FbTk/MenuItem.hh | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/FbTk/MenuItem.hh b/src/FbTk/MenuItem.hh index 4dcecc7..712b480 100644 --- a/src/FbTk/MenuItem.hh +++ b/src/FbTk/MenuItem.hh | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: MenuItem.hh,v 1.2 2003/02/17 12:28:06 fluxgen Exp $ | 22 | // $Id: MenuItem.hh,v 1.3 2003/08/27 14:18:02 fluxgen Exp $ |
23 | 23 | ||
24 | #ifndef FBTK_MENUITEM_HH | 24 | #ifndef FBTK_MENUITEM_HH |
25 | #define FBTK_MENUITEM_HH | 25 | #define FBTK_MENUITEM_HH |
@@ -38,9 +38,10 @@ public: | |||
38 | MenuItem( | 38 | MenuItem( |
39 | const char *label) | 39 | const char *label) |
40 | : m_label(label ? label : ""), | 40 | : m_label(label ? label : ""), |
41 | m_submenu(0), | 41 | m_submenu(0), |
42 | m_enabled(true), | 42 | m_enabled(true), |
43 | m_selected(false) | 43 | m_selected(false), |
44 | m_toggle_item(false) | ||
44 | { } | 45 | { } |
45 | /// create a menu item with a specific command to be executed on click | 46 | /// create a menu item with a specific command to be executed on click |
46 | MenuItem(const char *label, RefCount<Command> &cmd): | 47 | MenuItem(const char *label, RefCount<Command> &cmd): |
@@ -48,7 +49,8 @@ public: | |||
48 | m_submenu(0), | 49 | m_submenu(0), |
49 | m_command(cmd), | 50 | m_command(cmd), |
50 | m_enabled(true), | 51 | m_enabled(true), |
51 | m_selected(false) { | 52 | m_selected(false), |
53 | m_toggle_item(false) { | ||
52 | 54 | ||
53 | } | 55 | } |
54 | 56 | ||
@@ -56,7 +58,8 @@ public: | |||
56 | : m_label(label ? label : "") | 58 | : m_label(label ? label : "") |
57 | , m_submenu(submenu) | 59 | , m_submenu(submenu) |
58 | , m_enabled(true) | 60 | , m_enabled(true) |
59 | , m_selected(false) | 61 | , m_selected(false), |
62 | m_toggle_item(false) | ||
60 | { } | 63 | { } |
61 | virtual ~MenuItem() { } | 64 | virtual ~MenuItem() { } |
62 | 65 | ||
@@ -64,6 +67,7 @@ public: | |||
64 | virtual void setSelected(bool selected) { m_selected = selected; } | 67 | virtual void setSelected(bool selected) { m_selected = selected; } |
65 | virtual void setEnabled(bool enabled) { m_enabled = enabled; } | 68 | virtual void setEnabled(bool enabled) { m_enabled = enabled; } |
66 | virtual void setLabel(const char *label) { m_label = (label ? label : ""); } | 69 | virtual void setLabel(const char *label) { m_label = (label ? label : ""); } |
70 | virtual void setToggleItem(bool val) { m_toggle_item = val; } | ||
67 | Menu *submenu() { return m_submenu; } | 71 | Menu *submenu() { return m_submenu; } |
68 | /** | 72 | /** |
69 | @name accessors | 73 | @name accessors |
@@ -73,11 +77,12 @@ public: | |||
73 | const Menu *submenu() const { return m_submenu; } | 77 | const Menu *submenu() const { return m_submenu; } |
74 | virtual bool isEnabled() const { return m_enabled; } | 78 | virtual bool isEnabled() const { return m_enabled; } |
75 | virtual bool isSelected() const { return m_selected; } | 79 | virtual bool isSelected() const { return m_selected; } |
80 | virtual bool isToggleItem() const { return m_toggle_item; } | ||
76 | /** | 81 | /** |
77 | Called when the item was clicked with a specific button | 82 | Called when the item was clicked with a specific button |
78 | @param button the button number | 83 | @param button the button number |
79 | @param time the time stamp | 84 | @param time the time stamp |
80 | */ | 85 | */ |
81 | virtual void click(int button, int time); | 86 | virtual void click(int button, int time); |
82 | RefCount<Command> &command() { return m_command; } | 87 | RefCount<Command> &command() { return m_command; } |
83 | const RefCount<Command> &command() const { return m_command; } | 88 | const RefCount<Command> &command() const { return m_command; } |
@@ -88,6 +93,7 @@ private: | |||
88 | Menu *m_submenu; ///< a submenu, 0 if we don't have one | 93 | Menu *m_submenu; ///< a submenu, 0 if we don't have one |
89 | RefCount<Command> m_command; ///< command to be executed | 94 | RefCount<Command> m_command; ///< command to be executed |
90 | bool m_enabled, m_selected; | 95 | bool m_enabled, m_selected; |
96 | bool m_toggle_item; | ||
91 | }; | 97 | }; |
92 | 98 | ||
93 | };// end namespace FbTk | 99 | };// end namespace FbTk |