summaryrefslogtreecommitdiff
path: root/src/FbTk/MenuItem.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/MenuItem.hh')
-rw-r--r--src/FbTk/MenuItem.hh40
1 files changed, 22 insertions, 18 deletions
diff --git a/src/FbTk/MenuItem.hh b/src/FbTk/MenuItem.hh
index 7fac8c7..3b02f2e 100644
--- a/src/FbTk/MenuItem.hh
+++ b/src/FbTk/MenuItem.hh
@@ -47,15 +47,16 @@ public:
47 m_submenu(0), 47 m_submenu(0),
48 m_enabled(true), 48 m_enabled(true),
49 m_selected(false), 49 m_selected(false),
50 m_close_on_click(true),
50 m_toggle_item(false) 51 m_toggle_item(false)
51 { } 52 { }
52 explicit MenuItem( 53 explicit MenuItem(const FbString &label)
53 const FbString &label)
54 : m_label(label), 54 : m_label(label),
55 m_menu(0), 55 m_menu(0),
56 m_submenu(0), 56 m_submenu(0),
57 m_enabled(true), 57 m_enabled(true),
58 m_selected(false), 58 m_selected(false),
59 m_close_on_click(true),
59 m_toggle_item(false) 60 m_toggle_item(false)
60 { } 61 { }
61 62
@@ -65,26 +66,28 @@ public:
65 m_submenu(0), 66 m_submenu(0),
66 m_enabled(true), 67 m_enabled(true),
67 m_selected(false), 68 m_selected(false),
69 m_close_on_click(true),
68 m_toggle_item(false) 70 m_toggle_item(false)
69 { } 71 { }
70 /// create a menu item with a specific command to be executed on click 72 /// create a menu item with a specific command to be executed on click
71 MenuItem(const FbString &label, RefCount<Command> &cmd, Menu *menu = 0): 73 MenuItem(const FbString &label, RefCount<Command> &cmd, Menu *menu = 0)
72 m_label(label), 74 : m_label(label),
73 m_menu(menu), 75 m_menu(menu),
74 m_submenu(0), 76 m_submenu(0),
75 m_command(cmd), 77 m_command(cmd),
76 m_enabled(true), 78 m_enabled(true),
77 m_selected(false), 79 m_selected(false),
78 m_toggle_item(false) { 80 m_close_on_click(true),
79 81 m_toggle_item(false)
80 } 82 { }
81 83
82 MenuItem(const FbString &label, Menu *submenu, Menu *host_menu = 0) 84 MenuItem(const FbString &label, Menu *submenu, Menu *host_menu = 0)
83 : m_label(label) 85 : m_label(label),
84 , m_menu(host_menu) 86 m_menu(host_menu),
85 , m_submenu(submenu) 87 m_submenu(submenu),
86 , m_enabled(true) 88 m_enabled(true),
87 , m_selected(false), 89 m_selected(false),
90 m_close_on_click(true),
88 m_toggle_item(false) 91 m_toggle_item(false)
89 { } 92 { }
90 virtual ~MenuItem() { } 93 virtual ~MenuItem() { }
@@ -94,6 +97,7 @@ public:
94 virtual void setEnabled(bool enabled) { m_enabled = enabled; } 97 virtual void setEnabled(bool enabled) { m_enabled = enabled; }
95 virtual void setLabel(const FbString &label) { m_label = label; } 98 virtual void setLabel(const FbString &label) { m_label = label; }
96 virtual void setToggleItem(bool val) { m_toggle_item = val; } 99 virtual void setToggleItem(bool val) { m_toggle_item = val; }
100 void setCloseOnClick(bool val) { m_close_on_click = val; }
97 void setIcon(const std::string &filename, int screen_num); 101 void setIcon(const std::string &filename, int screen_num);
98 virtual Menu *submenu() { return m_submenu; } 102 virtual Menu *submenu() { return m_submenu; }
99 /** 103 /**
@@ -150,7 +154,7 @@ private:
150 Menu *m_submenu; ///< a submenu, 0 if we don't have one 154 Menu *m_submenu; ///< a submenu, 0 if we don't have one
151 RefCount<Command> m_command; ///< command to be executed 155 RefCount<Command> m_command; ///< command to be executed
152 bool m_enabled, m_selected; 156 bool m_enabled, m_selected;
153 bool m_toggle_item; 157 bool m_close_on_click, m_toggle_item;
154 int m_index; 158 int m_index;
155 159
156 struct Icon { 160 struct Icon {