diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2008-09-22 05:44:50 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2008-09-22 05:44:50 (GMT) |
commit | 769ca8f1c8e156d919f6cacf90e0651530c4d943 (patch) | |
tree | 81e47249c7953961fd61e4aa466ff50265896975 /src/FbTk/Menu.cc | |
parent | 984fb5bef200cd7db7a9a13354f50b55919978af (diff) | |
parent | 3f33657fb721645292f798480e9e0b46d64aedf8 (diff) | |
download | fluxbox-769ca8f1c8e156d919f6cacf90e0651530c4d943.zip fluxbox-769ca8f1c8e156d919f6cacf90e0651530c4d943.tar.bz2 |
Merge branch 'master' of fluxbox@dev:fluxbox
Diffstat (limited to 'src/FbTk/Menu.cc')
-rw-r--r-- | src/FbTk/Menu.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 7d50302..7cb5599 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -219,6 +219,8 @@ int Menu::insert(MenuItem *item, int pos) { | |||
219 | } else { | 219 | } else { |
220 | menuitems.insert(menuitems.begin() + pos, item); | 220 | menuitems.insert(menuitems.begin() + pos, item); |
221 | fixMenuItemIndices(); | 221 | fixMenuItemIndices(); |
222 | if (m_active_index >= pos) | ||
223 | m_active_index++; | ||
222 | } | 224 | } |
223 | m_need_update = true; // we need to redraw the menu | 225 | m_need_update = true; // we need to redraw the menu |
224 | return menuitems.size(); | 226 | return menuitems.size(); |
@@ -233,7 +235,7 @@ int Menu::remove(unsigned int index) { | |||
233 | if (index >= menuitems.size()) { | 235 | if (index >= menuitems.size()) { |
234 | #ifdef DEBUG | 236 | #ifdef DEBUG |
235 | cout << "Bad index (" << index << ") given to Menu::remove()" | 237 | cout << "Bad index (" << index << ") given to Menu::remove()" |
236 | << " -- should be between 0 and " << menuitems.size() | 238 | << " -- should be between 0 and " << menuitems.size()-1 |
237 | << " inclusive." << endl; | 239 | << " inclusive." << endl; |
238 | #endif // DEBUG | 240 | #endif // DEBUG |
239 | return -1; | 241 | return -1; |
@@ -271,6 +273,9 @@ int Menu::remove(unsigned int index) { | |||
271 | else if (static_cast<unsigned int>(m_which_sub) > index) | 273 | else if (static_cast<unsigned int>(m_which_sub) > index) |
272 | m_which_sub--; | 274 | m_which_sub--; |
273 | 275 | ||
276 | if (static_cast<unsigned int>(m_active_index) > index) | ||
277 | m_active_index--; | ||
278 | |||
274 | m_need_update = true; // we need to redraw the menu | 279 | m_need_update = true; // we need to redraw the menu |
275 | 280 | ||
276 | return menuitems.size(); | 281 | return menuitems.size(); |
@@ -366,7 +371,7 @@ void Menu::enableTitle() { | |||
366 | setTitleVisibility(true); | 371 | setTitleVisibility(true); |
367 | } | 372 | } |
368 | 373 | ||
369 | void Menu::updateMenu(int active_index) { | 374 | void Menu::updateMenu() { |
370 | if (m_title_vis) { | 375 | if (m_title_vis) { |
371 | menu.item_w = theme()->titleFont().textWidth(menu.label, | 376 | menu.item_w = theme()->titleFont().textWidth(menu.label, |
372 | menu.label.size()); | 377 | menu.label.size()); |