aboutsummaryrefslogtreecommitdiff
path: root/src/Basemenu.hh
diff options
context:
space:
mode:
authorrathnor <rathnor>2002-12-01 13:42:15 (GMT)
committerrathnor <rathnor>2002-12-01 13:42:15 (GMT)
commit28b5c604490094e187494dcc566bd3d7a05a2c25 (patch)
tree8f78f5714a5cd055c10b067a2656fe7b2338e71a /src/Basemenu.hh
parentb9134162f9633784d9097df18769a699a62650fe (diff)
downloadfluxbox_pavel-28b5c604490094e187494dcc566bd3d7a05a2c25.zip
fluxbox_pavel-28b5c604490094e187494dcc566bd3d7a05a2c25.tar.bz2
Indenting from tabs to emacs 4-space
Diffstat (limited to 'src/Basemenu.hh')
-rw-r--r--src/Basemenu.hh274
1 files changed, 137 insertions, 137 deletions
diff --git a/src/Basemenu.hh b/src/Basemenu.hh
index 7a94c72..e14dd01 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.19 2002/11/26 16:06:36 fluxgen Exp $ 25// $Id: Basemenu.hh,v 1.20 2002/12/01 13:41:54 rathnor Exp $
26 26
27#ifndef BASEMENU_HH 27#ifndef BASEMENU_HH
28#define BASEMENU_HH 28#define BASEMENU_HH
@@ -37,122 +37,122 @@ class Fluxbox;
37class BImageControl; 37class BImageControl;
38class BScreen; 38class BScreen;
39/** 39/**
40 Base class for menus 40 Base class for menus
41*/ 41*/
42class Basemenu { 42class Basemenu {
43public: 43public:
44 enum Alignment{ ALIGNDONTCARE = 1, ALIGNTOP, ALIGNBOTTOM }; 44 enum Alignment{ ALIGNDONTCARE = 1, ALIGNTOP, ALIGNBOTTOM };
45 enum { RIGHT = 1, LEFT }; 45 enum { RIGHT = 1, LEFT };
46 46
47 /** 47 /**
48 Bullet type 48 Bullet type
49 */ 49 */
50 enum { EMPTY = 0, SQUARE, TRIANGLE, DIAMOND }; 50 enum { EMPTY = 0, SQUARE, TRIANGLE, DIAMOND };
51 51
52 explicit Basemenu(BScreen *screen); 52 explicit Basemenu(BScreen *screen);
53 virtual ~Basemenu(); 53 virtual ~Basemenu();
54 54
55 /** 55 /**
56 @name manipulators 56 @name manipulators
57 */ 57 */
58 //@{ 58 //@{
59 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);
60 int insert(const char *label, Basemenu *submenu, int pos= -1); 60 int insert(const char *label, Basemenu *submenu, int pos= -1);
61 int remove(unsigned int item); 61 int remove(unsigned int item);
62 inline void setInternalMenu() { internal_menu = true; } 62 inline void setInternalMenu() { internal_menu = true; }
63 inline void setAlignment(Alignment a) { m_alignment = a; } 63 inline void setAlignment(Alignment a) { m_alignment = a; }
64 inline void setTorn() { torn = true; } 64 inline void setTorn() { torn = true; }
65 inline void removeParent() { if (internal_menu) m_parent = 0; } 65 inline void removeParent() { if (internal_menu) m_parent = 0; }
66 void raise(); 66 void raise();
67 void lower(); 67 void lower();
68 /** 68 /**
69 @name event handlers 69 @name event handlers
70 */ 70 */
71 //@{ 71 //@{
72 void buttonPressEvent(XButtonEvent *bp); 72 void buttonPressEvent(XButtonEvent *bp);
73 void buttonReleaseEvent(XButtonEvent *br); 73 void buttonReleaseEvent(XButtonEvent *br);
74 void motionNotifyEvent(XMotionEvent *mn); 74 void motionNotifyEvent(XMotionEvent *mn);
75 void enterNotifyEvent(XCrossingEvent *en); 75 void enterNotifyEvent(XCrossingEvent *en);
76 void leaveNotifyEvent(XCrossingEvent *ce); 76 void leaveNotifyEvent(XCrossingEvent *ce);
77 void exposeEvent(XExposeEvent *ee); 77 void exposeEvent(XExposeEvent *ee);
78 //@} 78 //@}
79 79
80 void reconfigure(); 80 void reconfigure();
81 /// set label string 81 /// set label string
82 void setLabel(const char *labelstr); 82 void setLabel(const char *labelstr);
83 /// move menu to x,y 83 /// move menu to x,y
84 void move(int x, int y); 84 void move(int x, int y);
85 void update(); 85 void update();
86 void setItemSelected(unsigned int index, bool val); 86 void setItemSelected(unsigned int index, bool val);
87 void setItemEnabled(unsigned int index, bool val); 87 void setItemEnabled(unsigned int index, bool val);
88 virtual void drawSubmenu(unsigned int index); 88 virtual void drawSubmenu(unsigned int index);
89 virtual void show(); 89 virtual void show();
90 virtual void hide(); 90 virtual void hide();
91 /*@}*/ 91 /*@}*/
92 92
93 /** 93 /**
94 @name accessors 94 @name accessors
95 */ 95 */
96 //@{ 96 //@{
97 bool isTorn() const { return torn; } 97 bool isTorn() const { return torn; }
98 bool isVisible() const { return visible; } 98 bool isVisible() const { return visible; }
99 const BScreen *screen() const { return m_screen; } 99 const BScreen *screen() const { return m_screen; }
100 BScreen *screen() { return m_screen; } 100 BScreen *screen() { return m_screen; }
101 Window windowID() const { return menu.window; } 101 Window windowID() const { return menu.window; }
102 const std::string &label() const { return menu.label; } 102 const std::string &label() const { return menu.label; }
103 int x() const { return menu.x; } 103 int x() const { return menu.x; }
104 int y() const { return menu.y; } 104 int y() const { return menu.y; }
105 unsigned int width() const { return menu.width; } 105 unsigned int width() const { return menu.width; }
106 unsigned int height() const { return menu.height; } 106 unsigned int height() const { return menu.height; }
107 unsigned int numberOfItems() const { return menuitems.size(); } 107 unsigned int numberOfItems() const { return menuitems.size(); }
108 int currentSubmenu() const { return which_sub; } 108 int currentSubmenu() const { return which_sub; }
109 unsigned int titleHeight() const { return menu.title_h; } 109 unsigned int titleHeight() const { return menu.title_h; }
110 bool hasSubmenu(unsigned int index) const; 110 bool hasSubmenu(unsigned int index) const;
111 bool isItemSelected(unsigned int index) const; 111 bool isItemSelected(unsigned int index) const;
112 bool isItemEnabled(unsigned int index) const; 112 bool isItemEnabled(unsigned int index) const;
113 //@} 113 //@}
114 114
115protected: 115protected:
116 116
117 inline BasemenuItem *find(unsigned int index) const { return menuitems[index]; } 117 inline BasemenuItem *find(unsigned int index) const { return menuitems[index]; }
118 inline void setTitleVisibility(bool b) { title_vis = b; } 118 inline void setTitleVisibility(bool b) { title_vis = b; }
119 inline void setMovable(bool b) { movable = b; } 119 inline void setMovable(bool b) { movable = b; }
120 inline void setHideTree(bool h) { hide_tree = h; } 120 inline void setHideTree(bool h) { hide_tree = h; }
121 inline void setMinimumSublevels(int m) { menu.minsub = m; } 121 inline void setMinimumSublevels(int m) { menu.minsub = m; }
122 122
123 virtual void itemSelected(int button, unsigned int index) = 0; 123 virtual void itemSelected(int button, unsigned int index) = 0;
124 virtual void drawItem(unsigned int index, bool highlight= false, bool clear= false, 124 virtual void drawItem(unsigned int index, bool highlight= false, bool clear= false,
125 int x= -1, int y= -1, unsigned int width= 0, unsigned int height= 0); 125 int x= -1, int y= -1, unsigned int width= 0, unsigned int height= 0);
126 virtual void redrawTitle(); 126 virtual void redrawTitle();
127 virtual void internal_hide(); 127 virtual void internal_hide();
128 inline Basemenu *parent() { return m_parent; } 128 inline Basemenu *parent() { return m_parent; }
129 inline const Basemenu *parent() const { return m_parent; } 129 inline const Basemenu *parent() const { return m_parent; }
130 130
131private: 131private:
132 132
133 typedef std::vector<BasemenuItem *> Menuitems; 133 typedef std::vector<BasemenuItem *> Menuitems;
134 BScreen *m_screen; 134 BScreen *m_screen;
135 Display *m_display; 135 Display *m_display;
136 Basemenu *m_parent; 136 Basemenu *m_parent;
137 BImageControl *m_image_ctrl; 137 BImageControl *m_image_ctrl;
138 Menuitems menuitems; 138 Menuitems menuitems;
139 139
140 bool moving, visible, movable, torn, internal_menu, title_vis, shifted, 140 bool moving, visible, movable, torn, internal_menu, title_vis, shifted,
141 hide_tree; 141 hide_tree;
142 142
143 int which_sub, which_press, which_sbl; 143 int which_sub, which_press, which_sbl;
144 Alignment m_alignment; 144 Alignment m_alignment;
145 145
146 struct _menu { 146 struct _menu {
147 Pixmap frame_pixmap, title_pixmap, hilite_pixmap, sel_pixmap; 147 Pixmap frame_pixmap, title_pixmap, hilite_pixmap, sel_pixmap;
148 Window window, frame, title; 148 Window window, frame, title;
149 149
150 std::string label; 150 std::string label;
151 int x, y, x_move, y_move, x_shift, y_shift, sublevels, persub, minsub, 151 int x, y, x_move, y_move, x_shift, y_shift, sublevels, persub, minsub,
152 grab_x, grab_y; 152 grab_x, grab_y;
153 unsigned int width, height, title_h, frame_h, item_w, item_h, bevel_w, 153 unsigned int width, height, title_h, frame_h, item_w, item_h, bevel_w,
154 bevel_h; 154 bevel_h;
155 } menu; 155 } menu;
156 156
157}; 157};
158 158
@@ -161,50 +161,50 @@ private:
161*/ 161*/
162class BasemenuItem { 162class BasemenuItem {
163public: 163public:
164 BasemenuItem( 164 BasemenuItem(
165 const char *label, 165 const char *label,
166 int function, 166 int function,
167 const char *exec = (const char *) 0) 167 const char *exec = (const char *) 0)
168 : m_label(label ? label : "") 168 : m_label(label ? label : "")
169 , m_exec(exec ? exec : "") 169 , m_exec(exec ? exec : "")
170 , m_submenu(0) 170 , m_submenu(0)
171 , m_function(function) 171 , m_function(function)
172 , m_enabled(true) 172 , m_enabled(true)
173 , m_selected(false) 173 , m_selected(false)
174 { } 174 { }
175 175
176 BasemenuItem(const char *label, Basemenu *submenu) 176 BasemenuItem(const char *label, Basemenu *submenu)
177 : m_label(label ? label : "") 177 : m_label(label ? label : "")
178 , m_exec("") 178 , m_exec("")
179 , m_submenu(submenu) 179 , m_submenu(submenu)
180 , m_function(0) 180 , m_function(0)
181 , m_enabled(true) 181 , m_enabled(true)
182 , m_selected(false) 182 , m_selected(false)
183 { } 183 { }
184 184
185 void setSelected(bool selected) { m_selected = selected; } 185 void setSelected(bool selected) { m_selected = selected; }
186 void setEnabled(bool enabled) { m_enabled = enabled; } 186 void setEnabled(bool enabled) { m_enabled = enabled; }
187 Basemenu *submenu() { return m_submenu; } 187 Basemenu *submenu() { return m_submenu; }
188 /** 188 /**
189 @name accessors 189 @name accessors
190 */ 190 */
191 //@{ 191 //@{
192 const std::string &exec() const { return m_exec; } 192 const std::string &exec() const { return m_exec; }
193 const std::string &label() const { return m_label; } 193 const std::string &label() const { return m_label; }
194 int function() const { return m_function; } 194 int function() const { return m_function; }
195 const Basemenu *submenu() const { return m_submenu; } 195 const Basemenu *submenu() const { return m_submenu; }
196 bool isEnabled() const { return m_enabled; } 196 bool isEnabled() const { return m_enabled; }
197 bool isSelected() const { return m_selected; } 197 bool isSelected() const { return m_selected; }
198 //@} 198 //@}
199 199
200private: 200private:
201 std::string m_label; ///< label of this item 201 std::string m_label; ///< label of this item
202 std::string m_exec; ///< command string to execute 202 std::string m_exec; ///< command string to execute
203 Basemenu *m_submenu; ///< a submenu, 0 if we don't have one 203 Basemenu *m_submenu; ///< a submenu, 0 if we don't have one
204 int m_function; 204 int m_function;
205 bool m_enabled, m_selected; 205 bool m_enabled, m_selected;
206 206
207 friend class Basemenu; 207 friend class Basemenu;
208}; 208};
209 209
210 210