aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/MenuItem.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2004-06-07 20:34:23 (GMT)
committerfluxgen <fluxgen>2004-06-07 20:34:23 (GMT)
commit8eb2ea889d00a6facba0259883d9d29b0deac2ff (patch)
tree48f215fc674d90aef76db9dcb9eab99446b3d38d /src/FbTk/MenuItem.hh
parent34edd2640a35cb825a647e8d37db6cbc8e6afea1 (diff)
downloadfluxbox_pavel-8eb2ea889d00a6facba0259883d9d29b0deac2ff.zip
fluxbox_pavel-8eb2ea889d00a6facba0259883d9d29b0deac2ff.tar.bz2
drawing of items is now done in MenuItem
Diffstat (limited to 'src/FbTk/MenuItem.hh')
-rw-r--r--src/FbTk/MenuItem.hh41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/FbTk/MenuItem.hh b/src/FbTk/MenuItem.hh
index 6aeb40c..1d9ed20 100644
--- a/src/FbTk/MenuItem.hh
+++ b/src/FbTk/MenuItem.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: MenuItem.hh,v 1.4 2003/12/16 17:06:52 fluxgen Exp $ 22// $Id: MenuItem.hh,v 1.5 2004/06/07 20:33:20 fluxgen Exp $
23 23
24#ifndef FBTK_MENUITEM_HH 24#ifndef FBTK_MENUITEM_HH
25#define FBTK_MENUITEM_HH 25#define FBTK_MENUITEM_HH
@@ -31,11 +31,20 @@
31namespace FbTk { 31namespace FbTk {
32 32
33class Menu; 33class Menu;
34class MenuTheme;
35class FbDrawable;
34 36
35/// An interface for a menu item in Menu 37/// An interface for a menu item in Menu
36class MenuItem { 38class MenuItem {
37public: 39public:
38 MenuItem( 40 MenuItem()
41 : m_label(""),
42 m_submenu(0),
43 m_enabled(true),
44 m_selected(false),
45 m_toggle_item(false)
46 { }
47 explicit MenuItem(
39 const char *label) 48 const char *label)
40 : m_label(label ? label : ""), 49 : m_label(label ? label : ""),
41 m_submenu(0), 50 m_submenu(0),
@@ -63,21 +72,29 @@ public:
63 { } 72 { }
64 virtual ~MenuItem() { } 73 virtual ~MenuItem() { }
65 74
66 void setCommand(RefCount<Command> &cmd) { m_command = cmd; } 75 inline void setCommand(RefCount<Command> &cmd) { m_command = cmd; }
67 virtual void setSelected(bool selected) { m_selected = selected; } 76 virtual inline void setSelected(bool selected) { m_selected = selected; }
68 virtual void setEnabled(bool enabled) { m_enabled = enabled; } 77 virtual inline void setEnabled(bool enabled) { m_enabled = enabled; }
69 virtual void setLabel(const char *label) { m_label = (label ? label : ""); } 78 virtual inline void setLabel(const char *label) { m_label = (label ? label : ""); }
70 virtual void setToggleItem(bool val) { m_toggle_item = val; } 79 virtual inline void setToggleItem(bool val) { m_toggle_item = val; }
71 Menu *submenu() { return m_submenu; } 80 Menu *submenu() { return m_submenu; }
72 /** 81 /**
73 @name accessors 82 @name accessors
74 */ 83 */
75 //@{ 84 //@{
76 virtual const std::string &label() const { return m_label; } 85 virtual inline const std::string &label() const { return m_label; }
77 const Menu *submenu() const { return m_submenu; } 86 inline const Menu *submenu() const { return m_submenu; }
78 virtual bool isEnabled() const { return m_enabled; } 87 virtual inline bool isEnabled() const { return m_enabled; }
79 virtual bool isSelected() const { return m_selected; } 88 virtual inline bool isSelected() const { return m_selected; }
80 virtual bool isToggleItem() const { return m_toggle_item; } 89 virtual inline bool isToggleItem() const { return m_toggle_item; }
90 virtual unsigned int width(const MenuTheme &theme) const;
91 virtual unsigned int height(const MenuTheme &theme) const;
92 virtual void draw(FbDrawable &drawable,
93 const MenuTheme &theme,
94 bool highlight,
95 int x, int y,
96 unsigned int width, unsigned int height) const;
97 virtual void updateTheme(const MenuTheme &theme) { }
81 /** 98 /**
82 Called when the item was clicked with a specific button 99 Called when the item was clicked with a specific button
83 @param button the button number 100 @param button the button number