]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
somehow log target wasn't being created automatically anymore. Restored.
[wxWidgets.git] / src / msw / window.cpp
index 3c61e27b286f9ae59eb8251f60861a684b598e65..db9a0969bd6c9be79ccb8ec986405d19d4fe5f8d 100644 (file)
@@ -504,6 +504,12 @@ void wxWindow::ReleaseMouse(void)
   }
 }
 
+void wxWindow::SetAcceleratorTable(const wxAcceleratorTable& accel)
+{
+    m_acceleratorTable = accel;
+}
+
+
 // Push/pop event handler (i.e. allow a chain of event handlers
 // be searched)
 void wxWindow::PushEventHandler(wxEvtHandler *handler)
@@ -1025,10 +1031,19 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
           break;
         }
 
+        case WM_MOVE:
+          {
+            wxMoveEvent event(wxPoint(LOWORD(lParam), HIWORD(lParam)),
+                              m_windowId);
+            event.SetEventObject(this);
+            if ( !GetEventHandler()->ProcessEvent(event) )
+              Default();
+          }
+          break;
+
         case WM_WINDOWPOSCHANGING:
         {
-          WINDOWPOS *pos = (WINDOWPOS *)lParam;
-          MSWOnWindowPosChanging((void *)pos);
+          MSWOnWindowPosChanging((void *)lParam);
           break;
         }
 
@@ -1909,7 +1924,7 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
 
     // WM_GETDLGCODE: if the control wants it for itself, don't process it
     // (except for Ctrl-Tab combination which is always processed)
-    LONG lDlgCode;
+    LONG lDlgCode = 0;
     if ( bProcess && !bCtrlDown ) {
       lDlgCode = ::SendMessage(msg->hwnd, WM_GETDLGCODE, 0, 0);
     }
@@ -1918,7 +1933,7 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
     if ( bProcess ) {
       switch ( msg->wParam ) {
         case VK_TAB:
-          if ( lDlgCode & DLGC_WANTTAB )
+          if ( lDlgCode & DLGC_WANTTAB )  // this is FALSE for Ctrl-Tab
             bProcess = FALSE;
           else
             bForward = !(::GetKeyState(VK_SHIFT) & 0x100);
@@ -1961,9 +1976,13 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
   return FALSE;
 }
 
-bool wxWindow::MSWTranslateMessage(WXMSG* WXUNUSED(pMsg))
+bool wxWindow::MSWTranslateMessage(WXMSG* pMsg)
 {
-    return FALSE;
+    if (m_acceleratorTable.Ok() &&
+          ::TranslateAccelerator((HWND) GetHWND(), (HACCEL) m_acceleratorTable.GetHACCEL(), (MSG *)pMsg))
+        return TRUE;
+    else
+        return FALSE;
 }
 
 long wxWindow::MSWOnMDIActivate(long WXUNUSED(flag), WXHWND WXUNUSED(activate), WXHWND WXUNUSED(deactivate))
@@ -2042,7 +2061,7 @@ void wxWindow::MSWOnWindowPosChanging(void *WXUNUSED(lpPos))
 }
 
 // Deal with child commands from buttons etc.
-bool wxWindow::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND WXUNUSED(control))
+bool wxWindow::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
 {
 #if WXDEBUG > 1
   wxDebugMsg("wxWindow::MSWOnCommand\n");
@@ -2074,27 +2093,11 @@ bool wxWindow::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND WXUNUSED(control))
   }
   else
   {
-#if WXDEBUG > 1
-    wxDebugMsg("Could not find item!\n");
-    char buf[100];
-    wxDebugMsg("Item ids for this panel:\n");
-
-    wxNode *current = GetChildren()->First();
-    while (current)
-    {
-      wxObject *obj = (wxObject *)current->Data() ;
-      if (obj->IsKindOf(CLASSINFO(wxControl)))
-      {
-        wxControl *item = (wxControl *)current->Data();
-        sprintf(buf, "  %d\n", (int)item->m_windowId);
-        wxDebugMsg(buf);
-      }
-      current = current->Next();  
-    }
-    wxYield();
-#endif
-    return FALSE;
+    wxWindow *win = wxFindWinFromHandle(control);
+    if (win)
+      return win->MSWCommand(cmd, id);
   }
+  return FALSE;
 }
 
 long wxWindow::MSWOnSysCommand(WXWPARAM wParam, WXLPARAM lParam)
@@ -4378,7 +4381,18 @@ void wxWindow::OnIdle(wxIdleEvent& event)
         {
             // Generate a LEAVE event
             m_mouseInWindow = FALSE;
-            MSWOnMouseLeave(pt.x, pt.y, 0);
+
+            int state;
+            if (::GetKeyState(VK_SHIFT) != 0)
+                state |= MK_SHIFT;
+            if (::GetKeyState(VK_CONTROL) != 0)
+                state |= MK_CONTROL;
+
+            // Unfortunately the mouse button and keyboard state may have changed
+            // by the time the OnIdle function is called, so 'state' may be
+            // meaningless.
+
+            MSWOnMouseLeave(pt.x, pt.y, state);
         }
     }
     UpdateWindowUI();