aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Menu.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2004-06-27 13:51:24 (GMT)
committerfluxgen <fluxgen>2004-06-27 13:51:24 (GMT)
commit5e5a4982d3bdc2c32b1310a636d3a62b98709b48 (patch)
tree831ddceaad594d0d6c304ec9363616bbf4766ed5 /src/FbTk/Menu.hh
parent9bd6c403f2dda7b40a0a0c7e56e1569261e1251f (diff)
downloadfluxbox_pavel-5e5a4982d3bdc2c32b1310a636d3a62b98709b48.zip
fluxbox_pavel-5e5a4982d3bdc2c32b1310a636d3a62b98709b48.tar.bz2
added m_active_index. added validIndex function which validates indexes, removed highlight from drawItem since it should only highlight the m_active_index
Diffstat (limited to 'src/FbTk/Menu.hh')
-rw-r--r--src/FbTk/Menu.hh18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh
index 625a7d7..8c6c738 100644
--- a/src/FbTk/Menu.hh
+++ b/src/FbTk/Menu.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: Menu.hh,v 1.36 2004/06/14 12:23:57 fluxgen Exp $ 25// $Id: Menu.hh,v 1.37 2004/06/27 13:51:24 fluxgen Exp $
26 26
27#ifndef FBTK_MENU_HH 27#ifndef FBTK_MENU_HH
28#define FBTK_MENU_HH 28#define FBTK_MENU_HH
@@ -125,12 +125,14 @@ public:
125 /// hide menu 125 /// hide menu
126 virtual void hide(); 126 virtual void hide();
127 virtual void clearWindow(); 127 virtual void clearWindow();
128 void setActiveIndex(int index) { m_active_index = index; }
128 /*@}*/ 129 /*@}*/
129 130
130 /** 131 /**
131 @name accessors 132 @name accessors
132 */ 133 */
133 //@{ 134 //@{
135 inline int activeIndex() const { return m_active_index; }
134 inline bool isTorn() const { return torn; } 136 inline bool isTorn() const { return torn; }
135 inline bool isVisible() const { return visible; } 137 inline bool isVisible() const { return visible; }
136 inline int screenNumber() const { return menu.window.screenNumber(); } 138 inline int screenNumber() const { return menu.window.screenNumber(); }
@@ -156,6 +158,8 @@ public:
156 inline const MenuItem *find(unsigned int index) const { return menuitems[index]; } 158 inline const MenuItem *find(unsigned int index) const { return menuitems[index]; }
157 inline MenuItem *find(unsigned int index) { return menuitems[index]; } 159 inline MenuItem *find(unsigned int index) { return menuitems[index]; }
158 //@} 160 //@}
161 /// @return true if index is valid
162 inline bool validIndex(int index) const { return (index < static_cast<int>(numberOfItems()) && index >= 0); }
159 163
160protected: 164protected:
161 165
@@ -168,8 +172,8 @@ protected:
168 } 172 }
169 173
170 virtual void itemSelected(int button, unsigned int index) { } 174 virtual void itemSelected(int button, unsigned int index) { }
171 virtual int drawItem(unsigned int index, bool highlight = false, 175 virtual int drawItem(unsigned int index,
172 bool clear= false, bool render_trans = true, 176 bool clear = false, bool render_trans = true,
173 int x= -1, int y= -1, 177 int x= -1, int y= -1,
174 unsigned int width= 0, unsigned int height= 0); 178 unsigned int width= 0, unsigned int height= 0);
175 virtual void redrawTitle(); 179 virtual void redrawTitle();
@@ -178,7 +182,8 @@ protected:
178 inline const Menu *parent() const { return m_parent; } 182 inline const Menu *parent() const { return m_parent; }
179 183
180 void update(FbTk::Subject *); 184 void update(FbTk::Subject *);
181 185 void renderTransp(int x, int y,
186 unsigned int width, unsigned int height);
182private: 187private:
183 188
184 void openSubmenu(); 189 void openSubmenu();
@@ -186,8 +191,7 @@ private:
186 void startHide(); 191 void startHide();
187 void stopHide(); 192 void stopHide();
188 193
189 void renderTransp(int x, int y, 194
190 unsigned int width, unsigned int height);
191 typedef std::vector<MenuItem *> Menuitems; 195 typedef std::vector<MenuItem *> Menuitems;
192 const MenuTheme &m_theme; 196 const MenuTheme &m_theme;
193 Menu *m_parent; 197 Menu *m_parent;
@@ -216,6 +220,8 @@ private:
216 unsigned int frame_h, item_w; 220 unsigned int frame_h, item_w;
217 } menu; 221 } menu;
218 222
223 int m_active_index; ///< current highlighted index
224
219 Drawable m_root_pm; 225 Drawable m_root_pm;
220 static Menu *s_focused; ///< holds current input focused menu, so one can determine if a menu is focused 226 static Menu *s_focused; ///< holds current input focused menu, so one can determine if a menu is focused
221 FbPixmap m_frame_pm, ///< buffer pixmap 227 FbPixmap m_frame_pm, ///< buffer pixmap