aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Menu.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/Menu.hh')
-rw-r--r--src/FbTk/Menu.hh49
1 files changed, 22 insertions, 27 deletions
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh
index 9716a89..39440a8 100644
--- a/src/FbTk/Menu.hh
+++ b/src/FbTk/Menu.hh
@@ -33,7 +33,6 @@
33#include "EventHandler.hh" 33#include "EventHandler.hh"
34#include "MenuTheme.hh" 34#include "MenuTheme.hh"
35#include "Timer.hh" 35#include "Timer.hh"
36#include "TypeAhead.hh"
37 36
38namespace FbTk { 37namespace FbTk {
39 38
@@ -53,6 +52,7 @@ public:
53 52
54 enum Alignment{ ALIGNDONTCARE = 1, ALIGNTOP, ALIGNBOTTOM }; 53 enum Alignment{ ALIGNDONTCARE = 1, ALIGNTOP, ALIGNBOTTOM };
55 enum { RIGHT = 1, LEFT }; 54 enum { RIGHT = 1, LEFT };
55 enum { UP = 1, DOWN = 0 };
56 56
57 /** 57 /**
58 Bullet type 58 Bullet type
@@ -71,6 +71,7 @@ public:
71 int insertSubmenu(const FbString &label, Menu *submenu, int pos= -1); 71 int insertSubmenu(const FbString &label, Menu *submenu, int pos= -1);
72 int insertItem(MenuItem *item, int pos=-1); 72 int insertItem(MenuItem *item, int pos=-1);
73 int remove(unsigned int item); 73 int remove(unsigned int item);
74 int removeItem(MenuItem* item);
74 void removeAll(); 75 void removeAll();
75 void setInternalMenu(bool val = true) { m_internal_menu = val; } 76 void setInternalMenu(bool val = true) { m_internal_menu = val; }
76 void setAlignment(Alignment a) { m_alignment = a; } 77 void setAlignment(Alignment a) { m_alignment = a; }
@@ -180,24 +181,16 @@ private:
180 void startHide(); 181 void startHide();
181 void stopHide(); 182 void stopHide();
182 183
183 FbTk::ThemeProxy<MenuTheme> &m_theme;
184 Menu *m_parent;
185 ImageControl &m_image_ctrl;
186
187 typedef std::vector<MenuItem *> Menuitems;
188 Menuitems m_items;
189 TypeAhead<Menuitems, MenuItem *> m_type_ahead;
190 Menuitems m_matches;
191
192 void resetTypeAhead(); 184 void resetTypeAhead();
193 void drawTypeAheadItems(); 185 void drawTypeAheadItems();
194 void drawLine(int index, int size);
195 void fixMenuItemIndices();
196 186
197 struct Rect { 187
198 int x, y; 188 Menu *m_parent;
199 unsigned int width, height; 189
200 } m_screen; 190 class TypeSearch;
191
192 std::vector<MenuItem *> m_items;
193 std::auto_ptr<TypeSearch> m_search;
201 194
202 struct State { 195 struct State {
203 bool moving; 196 bool moving;
@@ -206,14 +199,20 @@ private:
206 bool torn; // torn from parent 199 bool torn; // torn from parent
207 } m_state; 200 } m_state;
208 201
202 bool m_need_update;
209 bool m_internal_menu; ///< whether we should destroy this menu or if it's managed somewhere else 203 bool m_internal_menu; ///< whether we should destroy this menu or if it's managed somewhere else
204 int m_active_index; ///< current highlighted index
210 int m_which_sub; 205 int m_which_sub;
206 int m_x_move;
207 int m_y_move;
211 208
212 Alignment m_alignment; 209 struct Rect {
210 int x, y;
211 unsigned int width, height;
212 } m_screen;
213 213
214 // the menu window 214 // the menu window
215 FbTk::FbWindow m_window; 215 FbTk::FbWindow m_window;
216 Pixmap m_hilite_pixmap;
217 216
218 // the title 217 // the title
219 struct Title { 218 struct Title {
@@ -231,24 +230,20 @@ private:
231 } m_frame; 230 } m_frame;
232 231
233 232
234 int m_x_move;
235 int m_y_move;
236
237 // the menuitems are rendered in a grid with 233 // the menuitems are rendered in a grid with
238 // 'm_columns' (a minimum of 'm_min_columns') and 234 // 'm_columns' (a minimum of 'm_min_columns') and
239 // a max of 'm_rows_per_column' 235 // a max of 'm_rows_per_column'
240 int m_columns; 236 int m_columns;
241 int m_rows_per_column; 237 int m_rows_per_column;
242 int m_min_columns; 238 int m_min_columns;
243
244 unsigned int m_item_w; 239 unsigned int m_item_w;
245 240
246 int m_active_index; ///< current highlighted index 241 FbTk::ThemeProxy<MenuTheme>& m_theme;
247 242 ImageControl& m_image_ctrl;
248 // the corners 243 std::auto_ptr<FbTk::Shape> m_shape; // the corners
249 std::auto_ptr<FbTk::Shape> m_shape; 244 Pixmap m_hilite_pixmap;
245 Alignment m_alignment;
250 246
251 bool m_need_update;
252 Timer m_submenu_timer; 247 Timer m_submenu_timer;
253 Timer m_hide_timer; 248 Timer m_hide_timer;
254 249