diff options
author | fluxgen <fluxgen> | 2002-02-08 13:20:23 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-02-08 13:20:23 (GMT) |
commit | fa46eaeeaaa75e3f738032a35777aee9a2b35e7b (patch) | |
tree | c6c64f82121386415755781df2b45b5daf5c9d88 /src/Basemenu.cc | |
parent | bac6c2ddb5f10f430c0d63e37eab33a32ebb471f (diff) | |
download | fluxbox-fa46eaeeaaa75e3f738032a35777aee9a2b35e7b.zip fluxbox-fa46eaeeaaa75e3f738032a35777aee9a2b35e7b.tar.bz2 |
back to stl vector
Diffstat (limited to 'src/Basemenu.cc')
-rw-r--r-- | src/Basemenu.cc | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/Basemenu.cc b/src/Basemenu.cc index 4beca57..4abc055 100644 --- a/src/Basemenu.cc +++ b/src/Basemenu.cc | |||
@@ -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: Basemenu.cc,v 1.8 2002/02/04 22:33:09 fluxgen Exp $ | 25 | // $Id: Basemenu.cc,v 1.9 2002/02/08 13:20:23 fluxgen Exp $ |
26 | 26 | ||
27 | // stupid macros needed to access some functions in version 2 of the GNU C | 27 | // stupid macros needed to access some functions in version 2 of the GNU C |
28 | // library | 28 | // library |
@@ -196,12 +196,7 @@ Basemenu::~Basemenu(void) { | |||
196 | } | 196 | } |
197 | 197 | ||
198 | 198 | ||
199 | int Basemenu::insert(const char *l, int function, const char *e, int pos) { | 199 | int Basemenu::insert(const char *label, int function, const char *exec, int pos) { |
200 | char *label = 0, *exec = 0; | ||
201 | |||
202 | if (l) label = StringUtil::strdup(l); | ||
203 | if (e) exec = StringUtil::strdup(e); | ||
204 | |||
205 | BasemenuItem *item = new BasemenuItem(label, function, exec); | 200 | BasemenuItem *item = new BasemenuItem(label, function, exec); |
206 | if (pos == -1) { | 201 | if (pos == -1) { |
207 | menuitems.push_back(item); | 202 | menuitems.push_back(item); |
@@ -213,11 +208,7 @@ int Basemenu::insert(const char *l, int function, const char *e, int pos) { | |||
213 | } | 208 | } |
214 | 209 | ||
215 | 210 | ||
216 | int Basemenu::insert(const char *l, Basemenu *submenu, int pos) { | 211 | int Basemenu::insert(const char *label, Basemenu *submenu, int pos) { |
217 | char *label = 0; | ||
218 | |||
219 | if (l) label = StringUtil::strdup(l); | ||
220 | |||
221 | BasemenuItem *item = new BasemenuItem(label, submenu); | 212 | BasemenuItem *item = new BasemenuItem(label, submenu); |
222 | if (pos == -1) { | 213 | if (pos == -1) { |
223 | menuitems.push_back(item); | 214 | menuitems.push_back(item); |
@@ -232,7 +223,8 @@ int Basemenu::insert(const char *l, Basemenu *submenu, int pos) { | |||
232 | 223 | ||
233 | 224 | ||
234 | int Basemenu::insert(const char **ulabel, int pos, int function) { | 225 | int Basemenu::insert(const char **ulabel, int pos, int function) { |
235 | BasemenuItem *item = new BasemenuItem(ulabel, function); | 226 | assert(ulabel); |
227 | BasemenuItem *item = new BasemenuItem(*ulabel, function); | ||
236 | if (pos == -1) { | 228 | if (pos == -1) { |
237 | menuitems.push_back(item); | 229 | menuitems.push_back(item); |
238 | } else { | 230 | } else { |
@@ -259,13 +251,8 @@ int Basemenu::remove(int index) { | |||
259 | tmp->internal_hide(); | 251 | tmp->internal_hide(); |
260 | } | 252 | } |
261 | 253 | ||
262 | if (item->label()) | ||
263 | delete [] item->label(); | ||
264 | |||
265 | if (item->exec()) | ||
266 | delete [] item->exec(); | ||
267 | |||
268 | delete item; | 254 | delete item; |
255 | menuitems.erase(it); | ||
269 | } | 256 | } |
270 | 257 | ||
271 | if (which_sub == index) | 258 | if (which_sub == index) |
@@ -323,8 +310,7 @@ void Basemenu::update(void) { | |||
323 | for (; it != it_end; ++it) { | 310 | for (; it != it_end; ++it) { |
324 | BasemenuItem *itmp = (*it); | 311 | BasemenuItem *itmp = (*it); |
325 | 312 | ||
326 | const char *s = ((itmp->u && *itmp->u) ? *itmp->u : | 313 | const char *s = itmp->label(); |
327 | ((itmp->l) ? itmp->l : (const char *) 0)); | ||
328 | int l = strlen(s); | 314 | int l = strlen(s); |
329 | 315 | ||
330 | if (i18n->multibyte()) { | 316 | if (i18n->multibyte()) { |
@@ -635,7 +621,7 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear, | |||
635 | if (! item) return; | 621 | if (! item) return; |
636 | 622 | ||
637 | Bool dotext = True, dohilite = True, dosel = True; | 623 | Bool dotext = True, dohilite = True, dosel = True; |
638 | const char *text = (item->ulabel()) ? *item->ulabel() : item->label(); | 624 | const char *text = item->label(); |
639 | int sbl = index / menu.persub, i = index - (sbl * menu.persub); | 625 | int sbl = index / menu.persub, i = index - (sbl * menu.persub); |
640 | int item_x = (sbl * menu.item_w), item_y = (i * menu.item_h); | 626 | int item_x = (sbl * menu.item_w), item_y = (i * menu.item_h); |
641 | int hilite_x = item_x, hilite_y = item_y, hoff_x = 0, hoff_y = 0; | 627 | int hilite_x = item_x, hilite_y = item_y, hoff_x = 0, hoff_y = 0; |