aboutsummaryrefslogtreecommitdiff
path: root/src/Basemenu.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-02-08 13:20:23 (GMT)
committerfluxgen <fluxgen>2002-02-08 13:20:23 (GMT)
commitfa46eaeeaaa75e3f738032a35777aee9a2b35e7b (patch)
treec6c64f82121386415755781df2b45b5daf5c9d88 /src/Basemenu.hh
parentbac6c2ddb5f10f430c0d63e37eab33a32ebb471f (diff)
downloadfluxbox-fa46eaeeaaa75e3f738032a35777aee9a2b35e7b.zip
fluxbox-fa46eaeeaaa75e3f738032a35777aee9a2b35e7b.tar.bz2
back to stl vector
Diffstat (limited to 'src/Basemenu.hh')
-rw-r--r--src/Basemenu.hh89
1 files changed, 40 insertions, 49 deletions
diff --git a/src/Basemenu.hh b/src/Basemenu.hh
index af40983..126f06e 100644
--- a/src/Basemenu.hh
+++ b/src/Basemenu.hh
@@ -22,12 +22,14 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Basemenu.hh,v 1.5 2002/02/04 22:33:09 fluxgen Exp $ 25// $Id: Basemenu.hh,v 1.6 2002/02/08 13:20:23 fluxgen Exp $
26 26
27#ifndef _BASEMENU_HH_ 27#ifndef _BASEMENU_HH_
28#define _BASEMENU_HH_ 28#define _BASEMENU_HH_
29 29
30#include <X11/Xlib.h> 30#include <X11/Xlib.h>
31#include <vector>
32#include <string>
31 33
32// forward declarations 34// forward declarations
33class Basemenu; 35class Basemenu;
@@ -37,8 +39,6 @@ class Fluxbox;
37class BImageControl; 39class BImageControl;
38class BScreen; 40class BScreen;
39 41
40#include <vector>
41
42class Basemenu { 42class Basemenu {
43private: 43private:
44 typedef std::vector<BasemenuItem *> Menuitems; 44 typedef std::vector<BasemenuItem *> Menuitems;
@@ -139,55 +139,46 @@ public:
139 139
140}; 140};
141 141
142
143class BasemenuItem { 142class BasemenuItem {
144private: 143public:
145 Basemenu *s; 144 BasemenuItem(
146 const char **u, *l, *e; 145 const char *label,
147 int f, enabled, selected; 146 int function,
147 const char *exec = (const char *) 0)
148 : m_label(label ? label : "")
149 , m_exec(exec ? exec : "")
150 , m_submenu(0)
151 , m_function(function)
152 , m_enabled(true)
153 , m_selected(false)
154 { }
155
156 BasemenuItem(const char *label, Basemenu *submenu)
157 : m_label(label ? label : "")
158 , m_exec("")
159 , m_submenu(submenu)
160 , m_function(0)
161 , m_enabled(true)
162 , m_selected(false)
163 { }
164
165 inline const char *exec(void) const { return m_exec.c_str(); }
166 inline const char *label(void) const { return m_label.c_str(); }
167 inline int function(void) const { return m_function; }
168 inline Basemenu *submenu(void) { return m_submenu; }
169
170 inline bool isEnabled(void) const { return m_enabled; }
171 inline void setEnabled(bool enabled) { m_enabled = enabled; }
172 inline bool isSelected(void) const { return m_selected; }
173 inline void setSelected(bool selected) { m_selected = selected; }
148 174
149 friend class Basemenu; 175private:
176 std::string m_label, m_exec;
177 Basemenu *m_submenu;
178 int m_function;
179 bool m_enabled, m_selected;
150 180
151public: 181 friend class Basemenu;
152 BasemenuItem(const char *lp, int fp, const char *ep = (const char *) 0) {
153 l = lp;
154 e = ep;
155 s = 0;
156 f = fp;
157 u = 0;
158 enabled = 1;
159 selected = 0;
160 }
161
162 BasemenuItem(const char *lp, Basemenu *mp) {
163 l = lp;
164 s = mp;
165 e = 0;
166 f = 0;
167 u = 0;
168 enabled = 1;
169 selected = 0;
170 }
171
172 BasemenuItem(const char **up, int fp) {
173 u = up;
174 l = e = 0;
175 f = fp;
176 s = 0;
177 enabled = 1;
178 selected = 0;
179 }
180
181 inline const char *exec(void) const { return e; }
182 inline const char *label(void) const { return l; }
183 inline const char **ulabel(void) const { return u; }
184 inline const int &function(void) const { return f; }
185 inline Basemenu *submenu(void) { return s; }
186
187 inline const int &isEnabled(void) const { return enabled; }
188 inline void setEnabled(int e) { enabled = e; }
189 inline const int &isSelected(void) const { return selected; }
190 inline void setSelected(int s) { selected = s; }
191}; 182};
192 183
193 184