diff options
Diffstat (limited to 'src/FbTk/MenuItem.hh')
-rw-r--r-- | src/FbTk/MenuItem.hh | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/FbTk/MenuItem.hh b/src/FbTk/MenuItem.hh index 320d065..4bbfcf3 100644 --- a/src/FbTk/MenuItem.hh +++ b/src/FbTk/MenuItem.hh | |||
@@ -47,8 +47,7 @@ public: | |||
47 | m_enabled(true), | 47 | m_enabled(true), |
48 | m_selected(false), | 48 | m_selected(false), |
49 | m_close_on_click(true), | 49 | m_close_on_click(true), |
50 | m_toggle_item(false), | 50 | m_toggle_item(false) |
51 | m_index(0) | ||
52 | { } | 51 | { } |
53 | 52 | ||
54 | explicit MenuItem(const BiDiString &label) | 53 | explicit MenuItem(const BiDiString &label) |
@@ -58,8 +57,7 @@ public: | |||
58 | m_enabled(true), | 57 | m_enabled(true), |
59 | m_selected(false), | 58 | m_selected(false), |
60 | m_close_on_click(true), | 59 | m_close_on_click(true), |
61 | m_toggle_item(false), | 60 | m_toggle_item(false) |
62 | m_index(0) | ||
63 | { } | 61 | { } |
64 | 62 | ||
65 | MenuItem(const BiDiString &label, Menu &host_menu) | 63 | MenuItem(const BiDiString &label, Menu &host_menu) |
@@ -69,8 +67,7 @@ public: | |||
69 | m_enabled(true), | 67 | m_enabled(true), |
70 | m_selected(false), | 68 | m_selected(false), |
71 | m_close_on_click(true), | 69 | m_close_on_click(true), |
72 | m_toggle_item(false), | 70 | m_toggle_item(false) |
73 | m_index(0) | ||
74 | { } | 71 | { } |
75 | /// create a menu item with a specific command to be executed on click | 72 | /// create a menu item with a specific command to be executed on click |
76 | MenuItem(const BiDiString &label, RefCount<Command<void> > &cmd, Menu *menu = 0) | 73 | MenuItem(const BiDiString &label, RefCount<Command<void> > &cmd, Menu *menu = 0) |
@@ -81,8 +78,7 @@ public: | |||
81 | m_enabled(true), | 78 | m_enabled(true), |
82 | m_selected(false), | 79 | m_selected(false), |
83 | m_close_on_click(true), | 80 | m_close_on_click(true), |
84 | m_toggle_item(false), | 81 | m_toggle_item(false) |
85 | m_index(0) | ||
86 | { } | 82 | { } |
87 | 83 | ||
88 | MenuItem(const BiDiString &label, Menu *submenu, Menu *host_menu = 0) | 84 | MenuItem(const BiDiString &label, Menu *submenu, Menu *host_menu = 0) |
@@ -92,10 +88,9 @@ public: | |||
92 | m_enabled(true), | 88 | m_enabled(true), |
93 | m_selected(false), | 89 | m_selected(false), |
94 | m_close_on_click(true), | 90 | m_close_on_click(true), |
95 | m_toggle_item(false), | 91 | m_toggle_item(false) |
96 | m_index(0) | ||
97 | { } | 92 | { } |
98 | virtual ~MenuItem() { } | 93 | virtual ~MenuItem(); |
99 | 94 | ||
100 | void setCommand(RefCount<Command<void> > &cmd) { m_command = cmd; } | 95 | void setCommand(RefCount<Command<void> > &cmd) { m_command = cmd; } |
101 | virtual void setSelected(bool selected) { m_selected = selected; } | 96 | virtual void setSelected(bool selected) { m_selected = selected; } |
@@ -119,14 +114,12 @@ public: | |||
119 | virtual bool isToggleItem() const { return m_toggle_item; } | 114 | virtual bool isToggleItem() const { return m_toggle_item; } |
120 | 115 | ||
121 | // iType functions | 116 | // iType functions |
122 | virtual void setIndex(int index) { m_index = index; } | ||
123 | virtual int getIndex() { return m_index; } | ||
124 | const FbString &iTypeString() const { return m_label.visual(); } | 117 | const FbString &iTypeString() const { return m_label.visual(); } |
125 | virtual void drawLine(FbDrawable &draw, | 118 | virtual void drawLine(FbDrawable &draw, |
126 | const FbTk::ThemeProxy<MenuTheme> &theme, | 119 | const FbTk::ThemeProxy<MenuTheme> &theme, |
127 | size_t size, | 120 | size_t n_chars, |
128 | int text_x, int text_y, | 121 | int text_x, int text_y, |
129 | unsigned int width) const; | 122 | unsigned int width, size_t skip_chars = 0) const; |
130 | 123 | ||
131 | virtual unsigned int width(const FbTk::ThemeProxy<MenuTheme> &theme) const; | 124 | virtual unsigned int width(const FbTk::ThemeProxy<MenuTheme> &theme) const; |
132 | virtual unsigned int height(const FbTk::ThemeProxy<MenuTheme> &theme) const; | 125 | virtual unsigned int height(const FbTk::ThemeProxy<MenuTheme> &theme) const; |
@@ -160,14 +153,12 @@ private: | |||
160 | RefCount<Command<void> > m_command; ///< command to be executed | 153 | RefCount<Command<void> > m_command; ///< command to be executed |
161 | bool m_enabled, m_selected; | 154 | bool m_enabled, m_selected; |
162 | bool m_close_on_click, m_toggle_item; | 155 | bool m_close_on_click, m_toggle_item; |
163 | int m_index; | ||
164 | 156 | ||
165 | struct Icon { | 157 | struct Icon { |
166 | std::auto_ptr<PixmapWithMask> pixmap; | 158 | std::auto_ptr<PixmapWithMask> pixmap; |
167 | std::string filename; | 159 | std::string filename; |
168 | }; | 160 | }; |
169 | std::auto_ptr<Icon> m_icon; | 161 | std::auto_ptr<Icon> m_icon; |
170 | |||
171 | }; | 162 | }; |
172 | 163 | ||
173 | } // end namespace FbTk | 164 | } // end namespace FbTk |