]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
*** empty log message ***
[wxWidgets.git] / src / msw / window.cpp
index cb7ceddbda28516b8c27de3bb05388411a8acaeb..96ab891d7bb188e7eec28b7e2461940d2bc65f34 100644 (file)
@@ -119,7 +119,7 @@ extern MSG s_currentMsg;
 
 wxMenu *wxCurrentPopupMenu = NULL;
 extern wxList WXDLLEXPORT wxPendingDelete;
-extern wxChar wxCanvasClassName[];
+extern const wxChar *wxCanvasClassName;
 
 // ---------------------------------------------------------------------------
 // private functions
@@ -141,9 +141,7 @@ wxWindow *wxFindWinFromHandle(WXHWND hWnd);
 // event tables
 // ---------------------------------------------------------------------------
 
-#if !USE_SHARED_LIBRARY
     IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
-#endif
 
 BEGIN_EVENT_TABLE(wxWindow, wxWindowBase)
     EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground)
@@ -163,6 +161,17 @@ END_EVENT_TABLE()
 // Find an item given the MS Windows id
 wxWindow *wxWindow::FindItem(long id) const
 {
+    wxControl *item = wxDynamicCast(this, wxControl);
+    if ( item )
+    {
+        // i it we or one of our "internal" children?
+        if ( item->GetId() == id ||
+             (item->GetSubcontrols().Index(id) != wxNOT_FOUND) )
+        {
+            return item;
+        }
+    }
+
     wxWindowList::Node *current = GetChildren().GetFirst();
     while (current)
     {
@@ -172,19 +181,6 @@ wxWindow *wxWindow::FindItem(long id) const
         if ( wnd )
             return wnd;
 
-        if ( childWin->IsKindOf(CLASSINFO(wxControl)) )
-        {
-            wxControl *item = (wxControl *)childWin;
-            if ( item->GetId() == id )
-                return item;
-            else
-            {
-                // In case it's a 'virtual' control (e.g. radiobox)
-                if ( item->GetSubcontrols().Member((wxObject *)id) )
-                    return item;
-            }
-        }
-
         current = current->GetNext();
     }
 
@@ -1841,8 +1837,9 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
                 short y = HIWORD(lParam);
 
                 processed = HandleMouseMove(x, y, wParam);
-                break;
-            }
+           }
+           break;
+
         case WM_LBUTTONDOWN:
         case WM_LBUTTONUP:
         case WM_LBUTTONDBLCLK:
@@ -2945,7 +2942,8 @@ bool wxWindow::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
         return popupMenu->MSWCommand(cmd, id);
     }
 
-    wxWindow *win = FindItem(id);
+    // must cast to a signed type before comparing with other ids!
+    wxWindow *win = FindItem((signed short)id);
     if ( !win )
     {
         win = wxFindWinFromHandle(control);