]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
added wxListView class: this is going to be a wxListCtrl with human (inter)face
[wxWidgets.git] / src / msw / window.cpp
index 64ad5feeaa707bbea763d42cfea95a5ca9b9c885..5b07081f99cfaedefa4c32f5444a4340cbef3ca0 100644 (file)
@@ -424,7 +424,7 @@ void wxWindowMSW::SetFocus()
 #ifndef __WXMICROWIN__
     ::SetLastError(0);
 #endif
 #ifndef __WXMICROWIN__
     ::SetLastError(0);
 #endif
-    
+
     if ( !::SetFocus(hWnd) )
     {
         // was there really an error?
     if ( !::SetFocus(hWnd) )
     {
         // was there really an error?
@@ -497,15 +497,15 @@ bool wxWindowMSW::Show(bool show)
     if ( show )
     {
 #ifdef __WXMICROWIN__
     if ( show )
     {
 #ifdef __WXMICROWIN__
-       // It seems that MicroWindows brings the _parent_ of the
-       // window to the top, which can be the wrong one.
-       
-       /* activate (set focus to) specified window*/
-       ::SetFocus(hWnd);
-
-       /* raise top level parent to top of z order*/
-       ::SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0,
-               SWP_NOMOVE|SWP_NOSIZE);
+        // It seems that MicroWindows brings the _parent_ of the
+        // window to the top, which can be the wrong one.
+
+        // activate (set focus to) specified window
+        ::SetFocus(hWnd);
+
+        // raise top level parent to top of z order
+        ::SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0,
+                SWP_NOMOVE|SWP_NOSIZE);
 #else
         BringWindowToTop(hWnd);
 #endif
 #else
         BringWindowToTop(hWnd);
 #endif
@@ -521,15 +521,14 @@ void wxWindowMSW::Raise()
     ::BringWindowToTop(GetHwnd());
 #else // Win32
 #ifdef __WXMICROWIN__
     ::BringWindowToTop(GetHwnd());
 #else // Win32
 #ifdef __WXMICROWIN__
-       // It seems that MicroWindows brings the _parent_ of the
-       // window to the top, which can be the wrong one.
-       
-       /* activate (set focus to) specified window*/
-       ::SetFocus(GetHwnd());
-
-       /* raise top level parent to top of z order*/
-       ::SetWindowPos(GetHwnd(), HWND_TOP, 0, 0, 0, 0,
-               SWP_NOMOVE|SWP_NOSIZE);
+    // It seems that MicroWindows brings the _parent_ of the
+    // window to the top, which can be the wrong one.
+
+    // activate (set focus to) specified window
+    ::SetFocus(GetHwnd());
+
+    // raise top level parent to top of z order
+    ::SetWindowPos(GetHwnd(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
 #else
     ::SetForegroundWindow(GetHwnd());
 #endif
 #else
     ::SetForegroundWindow(GetHwnd());
 #endif
@@ -947,7 +946,7 @@ void wxWindowMSW::SubclassWin(WXHWND hWnd)
     m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
 
     wxASSERT( (WXFARPROC) m_oldWndProc != (WXFARPROC) wxWndProc );
     m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
 
     wxASSERT( (WXFARPROC) m_oldWndProc != (WXFARPROC) wxWndProc );
-    
+
     SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
 }
 
     SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
 }
 
@@ -2155,12 +2154,6 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
 #endif
 
         case WM_LBUTTONDOWN:
 #endif
 
         case WM_LBUTTONDOWN:
-           // set focus to this window
-           if (AcceptsFocus())
-                SetFocus();
-
-           // fall through
-
         case WM_LBUTTONUP:
         case WM_LBUTTONDBLCLK:
         case WM_RBUTTONDOWN:
         case WM_LBUTTONUP:
         case WM_LBUTTONDBLCLK:
         case WM_RBUTTONDOWN:
@@ -2169,13 +2162,70 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
         case WM_MBUTTONDOWN:
         case WM_MBUTTONUP:
         case WM_MBUTTONDBLCLK:
         case WM_MBUTTONDOWN:
         case WM_MBUTTONUP:
         case WM_MBUTTONDBLCLK:
-            processed = HandleMouseEvent(message,
+         {
+                processed = FALSE;
+#ifdef __WXMICROWIN__
+                // MicroWindows seems to ignore the fact that a window is
+                // disabled. So catch mouse events and throw them away if
+                // necessary.
+                wxWindowMSW* win = this;
+                while (win)
+                {
+                    if (!win->IsEnabled())
+                    {
+                        processed = TRUE;
+                        break;
+                    }
+                    win = win->GetParent();
+                    if (win && win->IsTopLevel())
+                        break;
+                }
+#endif // __WXMICROWIN__
+                if (!processed)
+                {
+                    if (message == WM_LBUTTONDOWN && AcceptsFocus())
+                        SetFocus();
+                     processed = HandleMouseEvent(message,
                                          GET_X_LPARAM(lParam),
                                          GET_Y_LPARAM(lParam),
                                          GET_X_LPARAM(lParam),
                                          GET_Y_LPARAM(lParam),
-                                         wParam);
-            break;
+                                                  wParam);
+                }
+                break;
+         }
+
+#ifdef __WXMICROWIN__
+        case WM_NCLBUTTONDOWN:
+        case WM_NCLBUTTONUP:
+        case WM_NCLBUTTONDBLCLK:
+        case WM_NCRBUTTONDOWN:
+        case WM_NCRBUTTONUP:
+        case WM_NCRBUTTONDBLCLK:
+#if 0
+        case WM_NCMBUTTONDOWN:
+        case WM_NCMBUTTONUP:
+        case WM_NCMBUTTONDBLCLK:
+#endif
+            {
+                // MicroWindows seems to ignore the fact that a window
+                // is disabled. So catch mouse events and throw them away if necessary.
+                processed = FALSE;
+                wxWindowMSW* win = this;
+                while (win)
+                {
+                    if (!win->IsEnabled())
+                    {
+                        processed = TRUE;
+                        break;
+                    }
+                    win = win->GetParent();
+                    if (win && win->IsTopLevel())
+                        break;
+                }
+                break;
+            }
+#endif // __WXMICROWIN__
 
 
-#ifdef MM_JOY1MOVE // __WXMICROWIN__
+#ifdef MM_JOY1MOVE
         case MM_JOY1MOVE:
         case MM_JOY2MOVE:
         case MM_JOY1ZMOVE:
         case MM_JOY1MOVE:
         case MM_JOY2MOVE:
         case MM_JOY1ZMOVE:
@@ -2189,7 +2239,7 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
                                             GET_Y_LPARAM(lParam),
                                             wParam);
             break;
                                             GET_Y_LPARAM(lParam),
                                             wParam);
             break;
-#endif
+#endif // __WXMICROWIN__
 
         case WM_SYSCOMMAND:
             processed = HandleSysCommand(wParam, lParam);
 
         case WM_SYSCOMMAND:
             processed = HandleSysCommand(wParam, lParam);
@@ -2212,7 +2262,7 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
 #endif  // Win95
 
             // for these messages we must return TRUE if process the message
 #endif  // Win95
 
             // for these messages we must return TRUE if process the message
-#ifdef WM_DRAWITEM // __WXMICROWIN__
+#ifdef WM_DRAWITEM
         case WM_DRAWITEM:
         case WM_MEASUREITEM:
             {
         case WM_DRAWITEM:
         case WM_MEASUREITEM:
             {
@@ -2232,7 +2282,8 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
                     rc.result = TRUE;
             }
             break;
                     rc.result = TRUE;
             }
             break;
-#endif
+#endif // defined(WM_DRAWITEM)
+
         case WM_GETDLGCODE:
             if ( m_lDlgCode )
             {
         case WM_GETDLGCODE:
             if ( m_lDlgCode )
             {
@@ -2368,7 +2419,7 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
                                            lParam);
             }
             break;
                                            lParam);
             }
             break;
-#endif
+#endif // !__WXMICROWIN__
 
             // the return value for this message is ignored
         case WM_SYSCOLORCHANGE:
 
             // the return value for this message is ignored
         case WM_SYSCOLORCHANGE:
@@ -2760,8 +2811,7 @@ bool wxWindowMSW::MSWCreate(int id,
 
     }
     else // creating a normal window, not a dialog
 
     }
     else // creating a normal window, not a dialog
-#endif
-       // __WXMICROWIN__
+#endif // !__WXMICROWIN__
     {
         int controlId = 0;
         if ( style & WS_CHILD )
     {
         int controlId = 0;
         if ( style & WS_CHILD )
@@ -2858,7 +2908,7 @@ bool wxWindowMSW::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
 
     // finally try this window too (catches toolbar case)
     return MSWOnNotify(idCtrl, lParam, result);
 
     // finally try this window too (catches toolbar case)
     return MSWOnNotify(idCtrl, lParam, result);
-#else
+#else // __WXMICROWIN__
     return FALSE;
 #endif
 }
     return FALSE;
 #endif
 }
@@ -3093,7 +3143,7 @@ bool wxWindowMSW::HandleDropFiles(WXWPARAM wParam)
     delete[] files;
 
     return rc;
     delete[] files;
 
     return rc;
-#else
+#else // __WXMICROWIN__
     return FALSE;
 #endif
 }
     return FALSE;
 #endif
 }
@@ -3179,7 +3229,8 @@ bool wxWindowMSW::HandleSetCursor(WXHWND WXUNUSED(hWnd),
         // cursor set, stop here
         return TRUE;
     }
         // cursor set, stop here
         return TRUE;
     }
-#endif
+#endif // __WXMICROWIN__
+
     // pass up the window chain
     return FALSE;
 }
     // pass up the window chain
     return FALSE;
 }
@@ -3295,7 +3346,7 @@ bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush,
         *brush = hBrush;
 
     return hBrush != 0;
         *brush = hBrush;
 
     return hBrush != 0;
-#else
+#else // __WXMICROWIN__
     return FALSE;
 #endif
 }
     return FALSE;
 #endif
 }
@@ -4370,7 +4421,8 @@ wxKeyboardHook(int nCode, WORD wParam, DWORD lParam)
 
     return (int)CallNextHookEx(wxTheKeyboardHook, nCode, wParam, lParam);
 }
 
     return (int)CallNextHookEx(wxTheKeyboardHook, nCode, wParam, lParam);
 }
-#endif
+
+#endif // !__WXMICROWIN__
 
 #ifdef __WXDEBUG__
 const char *wxGetMessageName(int message)
 
 #ifdef __WXDEBUG__
 const char *wxGetMessageName(int message)