aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Menu.hh
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2011-01-15 20:31:37 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2011-01-15 20:31:37 (GMT)
commitbb480030f54947b19b761f37dd3c4756b361b5e1 (patch)
treeb5934dc12278b7b48d96f82dd31061c8fc554fcf /src/FbTk/Menu.hh
parentaccb8c3fa34b67ff59ecc2ea791eb10e1dcb90fc (diff)
downloadfluxbox-bb480030f54947b19b761f37dd3c4756b361b5e1.zip
fluxbox-bb480030f54947b19b761f37dd3c4756b361b5e1.tar.bz2
small refactoring of FbTk/Menu code
* removed useless struct _menu * code deduplication via renderMenuPixmap() * improved documentation: - 'sublevel' actually means 'column' - 'persub' means 'row_per_column'
Diffstat (limited to 'src/FbTk/Menu.hh')
-rw-r--r--src/FbTk/Menu.hh57
1 files changed, 38 insertions, 19 deletions
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh
index a7bb982..161a4ac 100644
--- a/src/FbTk/Menu.hh
+++ b/src/FbTk/Menu.hh
@@ -114,7 +114,7 @@ public:
114 virtual void updateMenu(); 114 virtual void updateMenu();
115 void setItemSelected(unsigned int index, bool val); 115 void setItemSelected(unsigned int index, bool val);
116 void setItemEnabled(unsigned int index, bool val); 116 void setItemEnabled(unsigned int index, bool val);
117 void setMinimumSublevels(int m) { menu.minsub = m; } 117 void setMinimumColumns(int columns) { m_min_columns = columns; }
118 virtual void drawSubmenu(unsigned int index); 118 virtual void drawSubmenu(unsigned int index);
119 /// show menu 119 /// show menu
120 virtual void show(); 120 virtual void show();
@@ -130,17 +130,17 @@ public:
130 bool isTorn() const { return m_torn; } 130 bool isTorn() const { return m_torn; }
131 bool isVisible() const { return m_visible; } 131 bool isVisible() const { return m_visible; }
132 bool isMoving() const { return m_moving; } 132 bool isMoving() const { return m_moving; }
133 int screenNumber() const { return menu.window.screenNumber(); } 133 int screenNumber() const { return m_window.screenNumber(); }
134 Window window() const { return menu.window.window(); } 134 Window window() const { return m_window.window(); }
135 FbWindow &fbwindow() { return menu.window; } 135 FbWindow &fbwindow() { return m_window; }
136 const FbWindow &fbwindow() const { return menu.window; } 136 const FbWindow &fbwindow() const { return m_window; }
137 FbWindow &titleWindow() { return menu.title; } 137 FbWindow &titleWindow() { return m_title; }
138 FbWindow &frameWindow() { return menu.frame; } 138 FbWindow &frameWindow() { return m_frame; }
139 const FbTk::BiDiString &label() const { return menu.label; } 139 const FbTk::BiDiString &label() const { return m_label; }
140 int x() const { return menu.window.x(); } 140 int x() const { return m_window.x(); }
141 int y() const { return menu.window.y(); } 141 int y() const { return m_window.y(); }
142 unsigned int width() const { return menu.window.width(); } 142 unsigned int width() const { return m_window.width(); }
143 unsigned int height() const { return menu.window.height(); } 143 unsigned int height() const { return m_window.height(); }
144 size_t numberOfItems() const { return menuitems.size(); } 144 size_t numberOfItems() const { return menuitems.size(); }
145 int currentSubmenu() const { return m_which_sub; } 145 int currentSubmenu() const { return m_which_sub; }
146 146
@@ -221,18 +221,37 @@ private:
221 int m_which_sub; 221 int m_which_sub;
222 Alignment m_alignment; 222 Alignment m_alignment;
223 223
224 struct _menu { 224 // the menu window
225 Pixmap frame_pixmap, title_pixmap, hilite_pixmap; 225 FbTk::FbWindow m_window;
226 FbTk::FbWindow window, frame, title; 226 Pixmap m_hilite_pixmap;
227 227
228 FbTk::BiDiString label; 228 // the title
229 int x_move, y_move, sublevels, persub, minsub, grab_x, grab_y; 229 FbTk::FbWindow m_title;
230 Pixmap m_title_pixmap;
231 FbTk::BiDiString m_label;
230 232
231 unsigned int frame_h, item_w; 233 // area for the menuitems
232 } menu; 234 FbTk::FbWindow m_frame;
235 Pixmap m_frame_pixmap;
236 unsigned int m_frame_h;
237
238 int m_x_move;
239 int m_y_move;
240 int m_grab_x;
241 int m_grab_y;
242
243 // the menuitems are rendered in a grid with
244 // 'm_columns' (a minimum of 'm_min_columns') and
245 // a max of 'm_rows_per_column'
246 int m_columns;
247 int m_rows_per_column;
248 int m_min_columns;
249
250 unsigned int m_item_w;
233 251
234 int m_active_index; ///< current highlighted index 252 int m_active_index; ///< current highlighted index
235 253
254 // the corners
236 std::auto_ptr<FbTk::Shape> m_shape; 255 std::auto_ptr<FbTk::Shape> m_shape;
237 256
238 Drawable m_root_pm; 257 Drawable m_root_pm;