aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Menu.hh
diff options
context:
space:
mode:
authorMathias Gumz <akira@fluxbox.org>2015-01-21 20:59:42 (GMT)
committerMathias Gumz <akira@fluxbox.org>2015-01-21 20:59:42 (GMT)
commit145cf94ea67a7d58ccd0a90dae8cba8c38a3275a (patch)
tree6b7bb923bbf956982b5c638672548b27e20ef41c /src/FbTk/Menu.hh
parentf64727caff069f830dfadb63786df0eba7b3bdb4 (diff)
downloadfluxbox-145cf94ea67a7d58ccd0a90dae8cba8c38a3275a.zip
fluxbox-145cf94ea67a7d58ccd0a90dae8cba8c38a3275a.tar.bz2
Refactor: bundle related members together
Also: try to avoid unsigned/signed problems in drawing code.
Diffstat (limited to 'src/FbTk/Menu.hh')
-rw-r--r--src/FbTk/Menu.hh80
1 files changed, 43 insertions, 37 deletions
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh
index 27d5b12..9716a89 100644
--- a/src/FbTk/Menu.hh
+++ b/src/FbTk/Menu.hh
@@ -83,7 +83,7 @@ public:
83 83
84 void disableTitle(); 84 void disableTitle();
85 void enableTitle(); 85 void enableTitle();
86 bool isTitleVisible() const { return m_title_vis; } 86 bool isTitleVisible() const { return m_title.visible; }
87 87
88 void setScreen(int x, int y, unsigned int w, unsigned int h); 88 void setScreen(int x, int y, unsigned int w, unsigned int h);
89 89
@@ -117,22 +117,23 @@ public:
117 @name accessors 117 @name accessors
118 */ 118 */
119 //@{ 119 //@{
120 bool isTorn() const { return m_torn; } 120 bool isTorn() const { return m_state.torn; }
121 bool isVisible() const { return m_visible; } 121 bool isVisible() const { return m_state.visible; }
122 bool isMoving() const { return m_moving; } 122 bool isMoving() const { return m_state.moving; }
123 int screenNumber() const { return m_window.screenNumber(); } 123 int screenNumber() const { return m_window.screenNumber(); }
124 Window window() const { return m_window.window(); } 124 Window window() const { return m_window.window(); }
125 FbWindow &fbwindow() { return m_window; } 125 FbWindow &fbwindow() { return m_window; }
126 const FbWindow &fbwindow() const { return m_window; } 126 const FbWindow &fbwindow() const { return m_window; }
127 FbWindow &titleWindow() { return m_title; } 127 FbWindow &titleWindow() { return m_title.win; }
128 FbWindow &frameWindow() { return m_frame; } 128 FbWindow &frameWindow() { return m_frame.win; }
129 const FbTk::BiDiString &label() const { return m_label; } 129
130 int x() const { return m_window.x(); } 130 const FbTk::BiDiString &label() const { return m_title.label; }
131 int y() const { return m_window.y(); } 131 int x() const { return m_window.x(); }
132 unsigned int width() const { return m_window.width(); } 132 int y() const { return m_window.y(); }
133 unsigned int height() const { return m_window.height(); } 133 unsigned int width() const { return m_window.width(); }
134 size_t numberOfItems() const { return m_items.size(); } 134 unsigned int height() const { return m_window.height(); }
135 int currentSubmenu() const { return m_which_sub; } 135 size_t numberOfItems() const { return m_items.size(); }
136 int currentSubmenu() const { return m_which_sub; }
136 137
137 bool isItemSelected(unsigned int index) const; 138 bool isItemSelected(unsigned int index) const;
138 bool isItemEnabled(unsigned int index) const; 139 bool isItemEnabled(unsigned int index) const;
@@ -159,13 +160,7 @@ public:
159protected: 160protected:
160 161
161 void themeReconfigured(); 162 void themeReconfigured();
162 void setTitleVisibility(bool b) { 163 void setTitleVisibility(bool b);
163 m_title_vis = b; m_need_update = true;
164 if (!b)
165 titleWindow().lower();
166 else
167 titleWindow().raise();
168 }
169 164
170 // renders item onto pm 165 // renders item onto pm
171 int drawItem(FbDrawable &pm, unsigned int index, 166 int drawItem(FbDrawable &pm, unsigned int index,
@@ -199,16 +194,21 @@ private:
199 void drawLine(int index, int size); 194 void drawLine(int index, int size);
200 void fixMenuItemIndices(); 195 void fixMenuItemIndices();
201 196
202 int m_screen_x, m_screen_y; 197 struct Rect {
203 unsigned int m_screen_width, m_screen_height; 198 int x, y;
204 bool m_moving; ///< if we're moving/draging or not 199 unsigned int width, height;
205 bool m_closing; ///< if we're right clicking on the menu title 200 } m_screen;
206 bool m_visible; ///< menu visibility 201
207 bool m_torn; ///< torn from parent 202 struct State {
208 bool m_internal_menu; ///< whether we should destroy this menu or if it's managed somewhere else 203 bool moving;
209 bool m_title_vis; ///< title visibility 204 bool closing; // right click title
205 bool visible;
206 bool torn; // torn from parent
207 } m_state;
210 208
209 bool m_internal_menu; ///< whether we should destroy this menu or if it's managed somewhere else
211 int m_which_sub; 210 int m_which_sub;
211
212 Alignment m_alignment; 212 Alignment m_alignment;
213 213
214 // the menu window 214 // the menu window
@@ -216,14 +216,20 @@ private:
216 Pixmap m_hilite_pixmap; 216 Pixmap m_hilite_pixmap;
217 217
218 // the title 218 // the title
219 FbTk::FbWindow m_title; 219 struct Title {
220 Pixmap m_title_pixmap; 220 FbTk::FbWindow win;
221 FbTk::BiDiString m_label; 221 Pixmap pixmap;
222 FbTk::BiDiString label;
223 bool visible;
224 } m_title;
222 225
223 // area for the menuitems 226 // area for the menuitems
224 FbTk::FbWindow m_frame; 227 struct Frame {
225 Pixmap m_frame_pixmap; 228 FbTk::FbWindow win;
226 unsigned int m_frame_h; 229 Pixmap pixmap;
230 unsigned int height;
231 } m_frame;
232
227 233
228 int m_x_move; 234 int m_x_move;
229 int m_y_move; 235 int m_y_move;