]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
added debug/release DLL configurations so that VC++ chooses the right one when buildi...
[wxWidgets.git] / src / msw / window.cpp
index 105459f34c5790feb3734f3ff0e021c108c926ff..903d55ffcf0c68c48b70ac699d4fade4d5e117df 100644 (file)
 #include "wx/msw/missing.h"
 
 #if defined(__WXWINCE__)
-#include "wx/msw/wince/missing.h"
+    #include "wx/msw/wince/missing.h"
 #endif
 
+#if defined(TME_LEAVE) && defined(WM_MOUSELEAVE)
+    #define HAVE_TRACKMOUSEEVENT
+#endif // everything needed for TrackMouseEvent()
+
 // ---------------------------------------------------------------------------
 // global variables
 // ---------------------------------------------------------------------------
@@ -1246,7 +1250,7 @@ bool wxWindowMSW::IsMouseInWindow() const
 
 void wxWindowMSW::OnInternalIdle()
 {
-#ifdef __WXWINCE__
+#ifndef HAVE_TRACKMOUSEEVENT
     // Check if we need to send a LEAVE event
     if ( m_mouseInWindow )
     {
@@ -1257,7 +1261,7 @@ void wxWindowMSW::OnInternalIdle()
             GenerateMouseLeave();
         }
     }
-#endif // !__WXWINCE__
+#endif // !HAVE_TRACKMOUSEEVENT
 
     if (wxUpdateUIEvent::CanUpdate(this))
         UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
@@ -1523,7 +1527,7 @@ void wxWindowMSW::DoMoveWindow(int x, int y, int width, int height)
     // otherwise (or if deferring failed) move the window in place immediately
     if ( !hdwp )
     {
-        if ( !::MoveWindow(GetHwnd(), x, y, width, height, TRUE) )
+        if ( !::MoveWindow(GetHwnd(), x, y, width, height, IsShown()) )
         {
             wxLogLastError(wxT("MoveWindow"));
         }
@@ -1828,7 +1832,8 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
             }
 
             bool bForward = true,
-                 bWindowChange = false;
+                 bWindowChange = false,
+                 bFromTab = false;
 
             // should we process this message specially?
             bool bProcess = true;
@@ -1842,6 +1847,7 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
                         // Ctrl-Tab cycles thru notebook pages
                         bWindowChange = bCtrlDown;
                         bForward = !bShiftDown;
+                        bFromTab = true;
                     }
                     break;
 
@@ -1966,6 +1972,7 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
                 wxNavigationKeyEvent event;
                 event.SetDirection(bForward);
                 event.SetWindowChange(bWindowChange);
+                event.SetFromTab(bFromTab);
                 event.SetEventObject(this);
 
                 if ( GetEventHandler()->ProcessEvent(event) )
@@ -2312,12 +2319,21 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
             }
 
 #ifdef WM_PRINT
+        case WM_PRINTCLIENT:
+            if ( GetParent() &&
+                  GetParent()->MSWPrintChild((wxWindow *)this, wParam, lParam) )
+            {
+                processed = true;
+            }
+            break;
+
         case WM_PRINT:
             {
                 if ( lParam & PRF_ERASEBKGND )
                     HandleEraseBkgnd((WXHDC)(HDC)wParam);
 
                 wxPaintDCEx dc((wxWindow *)this, (WXHDC)wParam);
+
                 processed = HandlePaint();
             }
             break;
@@ -2348,23 +2364,20 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
                                         wParam);
             break;
 
-#ifdef WM_MOUSELEAVE
+#ifdef HAVE_TRACKMOUSEEVENT
         case WM_MOUSELEAVE:
+            // filter out excess WM_MOUSELEAVE events sent after PopupMenu() (on XP at least)
+            if ( m_mouseInWindow )
             {
-                // filter out excess WM_MOUSELEAVE events sent after PopupMenu() (on XP at least)
-                if ( m_mouseInWindow )
-                {
-                    GenerateMouseLeave();
-                }
-
-                // always pass processed back as false, this allows the window
-                // manager to process the message too.  This is needed to
-                // ensure windows XP themes work properly as the mouse moves
-                // over widgets like buttons.
-                processed = false;
+                GenerateMouseLeave();
             }
+
+            // always pass processed back as false, this allows the window
+            // manager to process the message too.  This is needed to
+            // ensure windows XP themes work properly as the mouse moves
+            // over widgets like buttons. So don't set processed to true here.
             break;
-#endif // WM_MOUSELEAVE
+#endif // HAVE_TRACKMOUSEEVENT
 
 #if wxUSE_MOUSEWHEEL
         case WM_MOUSEWHEEL:
@@ -4035,6 +4048,14 @@ WXHBRUSH wxWindowMSW::MSWGetBgBrush(WXHDC hDC)
     return 0;
 }
 
+bool
+wxWindowMSW::MSWPrintChild(wxWindow * WXUNUSED(win),
+                           WXWPARAM WXUNUSED(wParam),
+                           WXLPARAM WXUNUSED(lParam))
+{
+    return false;
+}
+
 // ---------------------------------------------------------------------------
 // moving and resizing
 // ---------------------------------------------------------------------------
@@ -4398,17 +4419,18 @@ bool wxWindowMSW::HandleMouseMove(int x, int y, WXUINT flags)
         {
             // Generate an ENTER event
             m_mouseInWindow = true;
-#ifndef __WXWINCE__
-            TRACKMOUSEEVENT trackinfo;
 
-            trackinfo.cbSize = sizeof(trackinfo);
+#ifdef HAVE_TRACKMOUSEEVENT
+            WinStruct<TRACKMOUSEEVENT> trackinfo;
+
             trackinfo.dwFlags = TME_LEAVE;
             trackinfo.hwndTrack = GetHwnd();
-            //Use the commctrl.h _TrackMouseEvent, which will call the
-            // appropriate TrackMouseEvent or emulate it ( win95 )
-            // else we need _WIN32_WINNT >= 0x0400
+
+            // Use the commctrl.h _TrackMouseEvent(), which will call the real
+            // TrackMouseEvent() if available or emulate it
             _TrackMouseEvent(&trackinfo);
-#endif // __WXWINCE__
+#endif // HAVE_TRACKMOUSEEVENT
+
             wxMouseEvent event(wxEVT_ENTER_WINDOW);
             InitMouseEvent(event, x, y, flags);