diff options
author | simonb <simonb> | 2005-05-03 13:53:25 (GMT) |
---|---|---|
committer | simonb <simonb> | 2005-05-03 13:53:25 (GMT) |
commit | 7d4f711204ab0b51d45eaff332708f529c11c9f5 (patch) | |
tree | 57488fc9d10740f0501396f68b4e061b0cec8810 /src/FbTk/MenuItem.hh | |
parent | 575578d810733e0ca8d970f5923594a9d1930216 (diff) | |
download | fluxbox_pavel-7d4f711204ab0b51d45eaff332708f529c11c9f5.zip fluxbox_pavel-7d4f711204ab0b51d45eaff332708f529c11c9f5.tar.bz2 |
fix some menu drawing issues
Diffstat (limited to 'src/FbTk/MenuItem.hh')
-rw-r--r-- | src/FbTk/MenuItem.hh | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/FbTk/MenuItem.hh b/src/FbTk/MenuItem.hh index 20da8f7..b3b2f6b 100644 --- a/src/FbTk/MenuItem.hh +++ b/src/FbTk/MenuItem.hh | |||
@@ -42,6 +42,7 @@ class MenuItem { | |||
42 | public: | 42 | public: |
43 | MenuItem() | 43 | MenuItem() |
44 | : m_label(""), | 44 | : m_label(""), |
45 | m_menu(0), | ||
45 | m_submenu(0), | 46 | m_submenu(0), |
46 | m_enabled(true), | 47 | m_enabled(true), |
47 | m_selected(false), | 48 | m_selected(false), |
@@ -50,14 +51,25 @@ public: | |||
50 | explicit MenuItem( | 51 | explicit MenuItem( |
51 | const char *label) | 52 | const char *label) |
52 | : m_label(label ? label : ""), | 53 | : m_label(label ? label : ""), |
54 | m_menu(0), | ||
55 | m_submenu(0), | ||
56 | m_enabled(true), | ||
57 | m_selected(false), | ||
58 | m_toggle_item(false) | ||
59 | { } | ||
60 | |||
61 | MenuItem(const char *label, Menu &host_menu) | ||
62 | : m_label(label ? label : ""), | ||
63 | m_menu(&host_menu), | ||
53 | m_submenu(0), | 64 | m_submenu(0), |
54 | m_enabled(true), | 65 | m_enabled(true), |
55 | m_selected(false), | 66 | m_selected(false), |
56 | m_toggle_item(false) | 67 | m_toggle_item(false) |
57 | { } | 68 | { } |
58 | /// create a menu item with a specific command to be executed on click | 69 | /// create a menu item with a specific command to be executed on click |
59 | MenuItem(const char *label, RefCount<Command> &cmd): | 70 | MenuItem(const char *label, RefCount<Command> &cmd, Menu *menu = 0): |
60 | m_label(label ? label : ""), | 71 | m_label(label ? label : ""), |
72 | m_menu(menu), | ||
61 | m_submenu(0), | 73 | m_submenu(0), |
62 | m_command(cmd), | 74 | m_command(cmd), |
63 | m_enabled(true), | 75 | m_enabled(true), |
@@ -66,8 +78,9 @@ public: | |||
66 | 78 | ||
67 | } | 79 | } |
68 | 80 | ||
69 | MenuItem(const char *label, Menu *submenu) | 81 | MenuItem(const char *label, Menu *submenu, Menu *host_menu = 0) |
70 | : m_label(label ? label : "") | 82 | : m_label(label ? label : "") |
83 | , m_menu(host_menu) | ||
71 | , m_submenu(submenu) | 84 | , m_submenu(submenu) |
72 | , m_enabled(true) | 85 | , m_enabled(true) |
73 | , m_selected(false), | 86 | , m_selected(false), |
@@ -110,9 +123,13 @@ public: | |||
110 | RefCount<Command> &command() { return m_command; } | 123 | RefCount<Command> &command() { return m_command; } |
111 | const RefCount<Command> &command() const { return m_command; } | 124 | const RefCount<Command> &command() const { return m_command; } |
112 | //@} | 125 | //@} |
126 | |||
127 | void setMenu(Menu &menu) { m_menu = &menu; } | ||
128 | Menu *menu() { return m_menu; } | ||
113 | 129 | ||
114 | private: | 130 | private: |
115 | std::string m_label; ///< label of this item | 131 | std::string m_label; ///< label of this item |
132 | Menu *m_menu; ///< the menu we live in | ||
116 | Menu *m_submenu; ///< a submenu, 0 if we don't have one | 133 | Menu *m_submenu; ///< a submenu, 0 if we don't have one |
117 | RefCount<Command> m_command; ///< command to be executed | 134 | RefCount<Command> m_command; ///< command to be executed |
118 | bool m_enabled, m_selected; | 135 | bool m_enabled, m_selected; |
@@ -123,6 +140,7 @@ private: | |||
123 | std::string filename; | 140 | std::string filename; |
124 | }; | 141 | }; |
125 | std::auto_ptr<Icon> m_icon; | 142 | std::auto_ptr<Icon> m_icon; |
143 | |||
126 | }; | 144 | }; |
127 | 145 | ||
128 | } // end namespace FbTk | 146 | } // end namespace FbTk |