]> git.saurik.com Git - wxWidgets.git/commitdiff
Use symbolic names for popup menu ids in wxEVT_MENU_HIGHLIGHT events in wxMSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 22 Apr 2010 11:21:30 +0000 (11:21 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 22 Apr 2010 11:21:30 +0000 (11:21 +0000)
No real changes, just use wxID_NONE instead of hardcoded -1 (in one place) and
-3 (in another one). Hardcoding them not only made the code less readable but
also resulted in two numbers actually becoming different when they almost
certainly were meant to be the same.

This shouldn't result in any changes in the user-visible behaviour but we now
avoid searching the menu bar for menu items with id of -1 needlessly.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64103 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/framecmn.cpp
src/msw/frame.cpp

index f83d3e488bac101f61d4b02c07e29257283f2e04..916c0ea76d7db990a79ad7e84aefbac3b350ee20 100644 (file)
@@ -347,8 +347,10 @@ bool wxFrameBase::ShowMenuHelp(int menuId)
 {
 #if wxUSE_MENUS
     // if no help string found, we will clear the status bar text
+    //
+    // NB: wxID_NONE is used for (sub)menus themselves by wxMSW
     wxString helpString;
-    if ( menuId != wxID_SEPARATOR && menuId != -3 /* wxID_TITLE */ )
+    if ( menuId != wxID_SEPARATOR && menuId != wxID_NONE )
     {
         const wxMenuItem * const item = FindItemInMenuBar(menuId);
         if ( item && !item->IsSeparator() )
index b820a08d2159c89b91344b627366a1a8c9ad6d3a..2313b03a3ca4847fdad61c1dc6ee219754e0ef6b 100644 (file)
@@ -904,7 +904,7 @@ wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU WXUNUSED(hMenu))
     // any valid identifier in wxMenuEvent so use an otherwise unused value for
     // them
     if ( flags & (MF_POPUP | MF_SEPARATOR) )
-        item = -1;
+        item = wxID_NONE;
 
     wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item);
     event.SetEventObject(this);
@@ -915,7 +915,7 @@ wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU WXUNUSED(hMenu))
     // by default, i.e. if the event wasn't handled above, clear the status bar
     // text when an item which can't have any associated help string in wx API
     // is selected
-    if ( item == -1 )
+    if ( item == wxID_NONE )
         DoGiveHelp(wxEmptyString, true);
 
     return false;