------------------------------------------------------------ revno: 3101 committer: poy <p...@123gen.com> branch nick: trunk timestamp: Thu 2012-11-01 19:30:30 +0100 message: rename some dwt::Menu members to be more STL-like modified: dwt/include/dwt/widgets/Menu.h dwt/src/widgets/Menu.cpp win32/MainWindow.cpp win32/ShellMenu.cpp
-- lp:dcplusplus https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk Your team Dcplusplus-team is subscribed to branch lp:dcplusplus. To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dwt/include/dwt/widgets/Menu.h' --- dwt/include/dwt/widgets/Menu.h 2012-06-18 16:32:14 +0000 +++ dwt/include/dwt/widgets/Menu.h 2012-11-01 18:30:30 +0000 @@ -142,12 +142,12 @@ * all subsequent items change positions. To remove a range of items, remove from * end to start. */ - void removeItem(unsigned index); + void remove(unsigned index); /// Remove all items from the menu /** Will also delete any submenus. */ - void removeAllItems(); + void clear(); /// Return the number of items in the menu unsigned size() const; === modified file 'dwt/src/widgets/Menu.cpp' --- dwt/src/widgets/Menu.cpp 2012-10-29 18:19:03 +0000 +++ dwt/src/widgets/Menu.cpp 2012-11-01 18:30:30 +0000 @@ -230,13 +230,12 @@ titleFont = font; } -void Menu::clearTitle( bool clearSidebar /* = false */) -{ +void Menu::clearTitle(bool clearSidebar) { if(!ownerDrawn) return; - if ( !clearSidebar && !itsTitle.empty() ) - removeItem( 0 ); + if(!clearSidebar && !itsTitle.empty()) + remove(0); // clear title text itsTitle.clear(); @@ -735,11 +734,11 @@ } } -void Menu::removeItem(unsigned index) { +void Menu::remove(unsigned index) { auto child = ::GetSubMenu(itsHandle, index); if(!::RemoveMenu(itsHandle, index, MF_BYPOSITION)) { - throw Win32Exception("Couldn't remove item in Menu::removeItem"); + throw Win32Exception("Couldn't remove item in Menu::remove"); } if(ownerDrawn) { @@ -766,10 +765,10 @@ } } -void Menu::removeAllItems() { +void Menu::clear() { // must be backwards, since higher indexes change when removing lower ones for(int i = size() - 1, end = itsTitle.empty() ? 0 : 1; i >= end; --i) { - removeItem(i); + remove(i); } } === modified file 'win32/MainWindow.cpp' --- win32/MainWindow.cpp 2012-11-01 18:22:20 +0000 +++ win32/MainWindow.cpp 2012-11-01 18:30:30 +0000 @@ -651,7 +651,7 @@ pluginCommands[text] = command; if(WinUtil::mainWindow && !WinUtil::mainWindow->closing()) { - WinUtil::mainWindow->pluginMenu->removeAllItems(); + WinUtil::mainWindow->pluginMenu->clear(); WinUtil::mainWindow->refreshPluginMenu(); } } @@ -663,7 +663,7 @@ pluginCommands.erase(i); if(WinUtil::mainWindow && !WinUtil::mainWindow->closing()) { - WinUtil::mainWindow->pluginMenu->removeItem(index + 1 /* account for the menu title */); + WinUtil::mainWindow->pluginMenu->remove(index + 1 /* account for the menu title */); if(pluginCommands.empty()) { WinUtil::mainWindow->refreshPluginMenu(); } === modified file 'win32/ShellMenu.cpp' --- win32/ShellMenu.cpp 2012-03-03 19:33:45 +0000 +++ win32/ShellMenu.cpp 2012-11-01 18:30:30 +0000 @@ -195,7 +195,7 @@ HMENU menu = reinterpret_cast<HMENU>(msg.wParam); for(auto& i: handlers) if(i.first->handle() == menu) - i.first->removeAllItems(); + i.first->clear(); return dispatch(msg, ret); }
_______________________________________________ Mailing list: https://launchpad.net/~linuxdcpp-team Post to : linuxdcpp-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~linuxdcpp-team More help : https://help.launchpad.net/ListHelp