aboutsummaryrefslogtreecommitdiff
path: root/src/Basemenu.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-08-04 15:55:13 (GMT)
committerfluxgen <fluxgen>2002-08-04 15:55:13 (GMT)
commit56a41b23f9b5ecdef5e9536c2e6eeed0db32e623 (patch)
tree8b6fd3a735918278d54f1d108042d90df696169f /src/Basemenu.hh
parent380d50ba274c0ceb0a2f973ea464792847a80e6d (diff)
downloadfluxbox-56a41b23f9b5ecdef5e9536c2e6eeed0db32e623.zip
fluxbox-56a41b23f9b5ecdef5e9536c2e6eeed0db32e623.tar.bz2
doxygen comments
Diffstat (limited to 'src/Basemenu.hh')
-rw-r--r--src/Basemenu.hh115
1 files changed, 74 insertions, 41 deletions
diff --git a/src/Basemenu.hh b/src/Basemenu.hh
index 4e48f4c..29bb3ac 100644
--- a/src/Basemenu.hh
+++ b/src/Basemenu.hh
@@ -22,7 +22,7 @@
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.15 2002/08/02 12:52:44 fluxgen Exp $ 25// $Id: Basemenu.hh,v 1.16 2002/08/04 15:55:13 fluxgen Exp $
26 26
27#ifndef BASEMENU_HH 27#ifndef BASEMENU_HH
28#define BASEMENU_HH 28#define BASEMENU_HH
@@ -36,17 +36,26 @@ class BasemenuItem;
36class Fluxbox; 36class Fluxbox;
37class BImageControl; 37class BImageControl;
38class BScreen; 38class BScreen;
39 39/**
40 Base class for menus
41*/
40class Basemenu { 42class Basemenu {
41public: 43public:
42 enum Alignment{ ALIGNDONTCARE = 1, ALIGNTOP, ALIGNBOTTOM }; 44 enum Alignment{ ALIGNDONTCARE = 1, ALIGNTOP, ALIGNBOTTOM };
43 enum { RIGHT = 1, LEFT }; 45 enum { RIGHT = 1, LEFT };
46
47 /**
48 Bullet type
49 */
44 enum { EMPTY = 0, SQUARE, TRIANGLE, DIAMOND }; 50 enum { EMPTY = 0, SQUARE, TRIANGLE, DIAMOND };
45 51
46 explicit Basemenu(BScreen *screen); 52 explicit Basemenu(BScreen *screen);
47 virtual ~Basemenu(); 53 virtual ~Basemenu();
48 54
49 //manipulators 55 /**
56 @name manipulators
57 */
58 //@{
50 int insert(const char *label, int function= 0, const char *exec = 0, int pos = -1); 59 int insert(const char *label, int function= 0, const char *exec = 0, int pos = -1);
51 int insert(const char *label, Basemenu *submenu, int pos= -1); 60 int insert(const char *label, Basemenu *submenu, int pos= -1);
52 int remove(unsigned int item); 61 int remove(unsigned int item);
@@ -54,14 +63,22 @@ public:
54 inline void setAlignment(Alignment a) { m_alignment = a; } 63 inline void setAlignment(Alignment a) { m_alignment = a; }
55 inline void setTorn() { torn = true; } 64 inline void setTorn() { torn = true; }
56 inline void removeParent() { if (internal_menu) m_parent = 0; } 65 inline void removeParent() { if (internal_menu) m_parent = 0; }
57 void buttonPressEvent(XButtonEvent *); 66 /**
58 void buttonReleaseEvent(XButtonEvent *); 67 @name event handlers
59 void motionNotifyEvent(XMotionEvent *); 68 */
60 void enterNotifyEvent(XCrossingEvent *); 69 //@{
61 void leaveNotifyEvent(XCrossingEvent *); 70 void buttonPressEvent(XButtonEvent *bp);
62 void exposeEvent(XExposeEvent *); 71 void buttonReleaseEvent(XButtonEvent *br);
72 void motionNotifyEvent(XMotionEvent *mn);
73 void enterNotifyEvent(XCrossingEvent *en);
74 void leaveNotifyEvent(XCrossingEvent *ce);
75 void exposeEvent(XExposeEvent *ee);
76 //@}
77
63 void reconfigure(); 78 void reconfigure();
79 /// set label string
64 void setLabel(const char *labelstr); 80 void setLabel(const char *labelstr);
81 /// move menu to x,y
65 void move(int x, int y); 82 void move(int x, int y);
66 void update(); 83 void update();
67 void setItemSelected(unsigned int index, bool val); 84 void setItemSelected(unsigned int index, bool val);
@@ -69,10 +86,14 @@ public:
69 virtual void drawSubmenu(unsigned int index); 86 virtual void drawSubmenu(unsigned int index);
70 virtual void show(); 87 virtual void show();
71 virtual void hide(); 88 virtual void hide();
89 /*@}*/
72 90
73 //accessors 91 /**
74 inline bool isTorn() const { return torn; } 92 @name accessors
75 inline bool isVisible() const { return visible; } 93 */
94 //@{
95 inline bool isTorn() const { return torn; }
96 inline bool isVisible() const { return visible; }
76 inline BScreen *screen() const { return m_screen; } 97 inline BScreen *screen() const { return m_screen; }
77 inline Window windowID() const { return menu.window; } 98 inline Window windowID() const { return menu.window; }
78 inline const std::string &label() const { return menu.label; } 99 inline const std::string &label() const { return menu.label; }
@@ -86,10 +107,28 @@ public:
86 bool hasSubmenu(unsigned int index) const; 107 bool hasSubmenu(unsigned int index) const;
87 bool isItemSelected(unsigned int index) const; 108 bool isItemSelected(unsigned int index) const;
88 bool isItemEnabled(unsigned int index) const; 109 bool isItemEnabled(unsigned int index) const;
110 //@}
111
112protected:
113
114 inline BasemenuItem *find(unsigned int index) const { return menuitems[index]; }
115 inline void setTitleVisibility(bool b) { title_vis = b; }
116 inline void setMovable(bool b) { movable = b; }
117 inline void setHideTree(bool h) { hide_tree = h; }
118 inline void setMinimumSublevels(int m) { menu.minsub = m; }
119
120 virtual void itemSelected(int button, unsigned int index) = 0;
121 virtual void drawItem(unsigned int index, bool highlight= false, bool clear= false,
122 int x= -1, int y= -1, unsigned int width= 0, unsigned int height= 0);
123 virtual void redrawTitle();
124 virtual void internal_hide();
125 inline Basemenu *parent() { return m_parent; }
126 inline const Basemenu *GetParent() const { return m_parent; }
89 127
90private: 128private:
129
91 typedef std::vector<BasemenuItem *> Menuitems; 130 typedef std::vector<BasemenuItem *> Menuitems;
92 Fluxbox *m_fluxbox; 131 Fluxbox *m_fluxbox; //< fluxbox object, obsolete
93 BScreen *m_screen; 132 BScreen *m_screen;
94 Display *m_display; 133 Display *m_display;
95 Basemenu *m_parent; 134 Basemenu *m_parent;
@@ -113,23 +152,11 @@ private:
113 bevel_h; 152 bevel_h;
114 } menu; 153 } menu;
115 154
116
117protected:
118 inline BasemenuItem *find(unsigned int index) const { return menuitems[index]; }
119 inline void setTitleVisibility(bool b) { title_vis = b; }
120 inline void setMovable(bool b) { movable = b; }
121 inline void setHideTree(bool h) { hide_tree = h; }
122 inline void setMinimumSublevels(int m) { menu.minsub = m; }
123
124 virtual void itemSelected(int button, unsigned int index) = 0;
125 virtual void drawItem(unsigned int index, bool highlight= false, bool clear= false,
126 int x= -1, int y= -1, unsigned int width= 0, unsigned int height= 0);
127 virtual void redrawTitle();
128 virtual void internal_hide();
129 inline Basemenu *GetParent() { return m_parent; }
130 inline const Basemenu *GetParent() const { return m_parent; }
131}; 155};
132 156
157/**
158 A menu item
159*/
133class BasemenuItem { 160class BasemenuItem {
134public: 161public:
135 BasemenuItem( 162 BasemenuItem(
@@ -153,19 +180,25 @@ public:
153 , m_selected(false) 180 , m_selected(false)
154 { } 181 { }
155 182
156 inline const std::string &exec() const { return m_exec; } 183 void setSelected(bool selected) { m_selected = selected; }
157 inline const std::string &label() const { return m_label; } 184 void setEnabled(bool enabled) { m_enabled = enabled; }
158 inline int function() const { return m_function; } 185 Basemenu *submenu() { return m_submenu; }
159 inline Basemenu *submenu() const { return m_submenu; } 186 /**
160 187 @name accessors
161 inline bool isEnabled() const { return m_enabled; } 188 */
162 inline void setEnabled(bool enabled) { m_enabled = enabled; } 189 //@{
163 inline bool isSelected() const { return m_selected; } 190 const std::string &exec() const { return m_exec; }
164 inline void setSelected(bool selected) { m_selected = selected; } 191 const std::string &label() const { return m_label; }
165 192 int function() const { return m_function; }
193 const Basemenu *submenu() const { return m_submenu; }
194 bool isEnabled() const { return m_enabled; }
195 bool isSelected() const { return m_selected; }
196 //@}
197
166private: 198private:
167 std::string m_label, m_exec; 199 std::string m_label; ///< label of this item
168 Basemenu *m_submenu; 200 std::string m_exec; ///< command string to execute
201 Basemenu *m_submenu; ///< a submenu, 0 if we don't have one
169 int m_function; 202 int m_function;
170 bool m_enabled, m_selected; 203 bool m_enabled, m_selected;
171 204
@@ -173,4 +206,4 @@ private:
173}; 206};
174 207
175 208
176#endif // _BASEMENU_HH_ 209#endif // BASEMENU_HH