]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
rewritten to use wxTheMimeTypesManager
[wxWidgets.git] / src / msw / window.cpp
index b7552a3d6ce1ce6f00c4fa26469fced363bfbeac..ec39a8be1d37c814c329040582eff6ac716d9178 100644 (file)
@@ -2982,15 +2982,32 @@ bool wxWindow::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
         return popupMenu->MSWCommand(cmd, id);
     }
 
         return popupMenu->MSWCommand(cmd, id);
     }
 
-    // must cast to a signed type before comparing with other ids!
-    wxWindow *win = FindItem((signed short)id);
-    if ( !win )
+    wxWindow *win;
+    if ( cmd == 0 || cmd == 1 ) // menu or accel - use id
     {
     {
+        // must cast to a signed type before comparing with other ids!
+        win = FindItem((signed short)id);
+    }
+    else
+    {
+        // find it from HWND - this works even with the broken programs using
+        // the same ids for different controls
         win = wxFindWinFromHandle(control);
     }
 
     if ( win )
         return win->MSWCommand(cmd, id);
         win = wxFindWinFromHandle(control);
     }
 
     if ( win )
         return win->MSWCommand(cmd, id);
+    else
+    {
+        // If no child window, it may be an accelerator, e.g. for
+        // a popup menu command.
+
+        wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED);
+        event.SetEventObject(this);
+        event.SetId(id);
+        event.SetInt(id);
+        return ProcessEvent(event);
+    }
 
     return FALSE;
 }
 
     return FALSE;
 }
@@ -3376,8 +3393,11 @@ bool wxWindow::MSWOnScroll(int orientation, WXWORD wParam,
         event.m_eventType = wxEVT_SCROLLWIN_PAGEDOWN;
         break;
 
         event.m_eventType = wxEVT_SCROLLWIN_PAGEDOWN;
         break;
 
-    case SB_THUMBTRACK:
     case SB_THUMBPOSITION:
     case SB_THUMBPOSITION:
+        event.m_isScrolling = FALSE;
+        /* fall-through */
+
+    case SB_THUMBTRACK:
         event.m_eventType = wxEVT_SCROLLWIN_THUMBTRACK;
         break;
 
         event.m_eventType = wxEVT_SCROLLWIN_THUMBTRACK;
         break;