]> git.saurik.com Git - wxWidgets.git/commitdiff
Implemented input disabling for disabled windows since MicroWindows doesn't do it
authorJulian Smart <julian@anthemion.co.uk>
Fri, 6 Jul 2001 13:18:11 +0000 (13:18 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 6 Jul 2001 13:18:11 +0000 (13:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10860 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/univ/frame.h
src/msw/window.cpp
src/univ/framuniv.cpp

index 693d7e23777d38e53bc03b2d135ef1e5e92fdcc7..371a024bb415dfcc5786cd4dcb5c4756ad7f89a7 100644 (file)
@@ -43,6 +43,7 @@ public:
             const wxString& name = wxFrameNameStr);
 
     virtual wxPoint GetClientAreaOrigin() const;
+    virtual bool Enable( bool enable = TRUE );
 
 protected:
     void OnSize(wxSizeEvent& event);
index 64ad5feeaa707bbea763d42cfea95a5ca9b9c885..b62d5371f7fd2ca79c77e47cb1192b996d248795 100644 (file)
@@ -2155,12 +2155,6 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
 #endif
 
         case WM_LBUTTONDOWN:
-           // set focus to this window
-           if (AcceptsFocus())
-                SetFocus();
-
-           // fall through
-
         case WM_LBUTTONUP:
         case WM_LBUTTONDBLCLK:
         case WM_RBUTTONDOWN:
@@ -2169,12 +2163,69 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
         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
+               if (!processed)
+               {
+                    if (message == WM_LBUTTONDOWN && AcceptsFocus())
+                        SetFocus();
+                     processed = HandleMouseEvent(message,
                                          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
+           
 #ifdef MM_JOY1MOVE // __WXMICROWIN__
         case MM_JOY1MOVE:
         case MM_JOY2MOVE:
index 92a7ae405e760658f99998f8d0f7c82e9575ac57..4ae3912a68946dc9357ef6cf2bffa62e49a75e7b 100644 (file)
@@ -108,3 +108,13 @@ wxPoint wxFrame::GetClientAreaOrigin() const
     return pt;
 }
 
+bool wxFrame::Enable( bool enable )
+{
+    if (!wxFrameNative::Enable(enable))
+       return FALSE;
+#ifdef __WXMICROWIN__
+    if (m_frameMenuBar)
+        m_frameMenuBar->Enable(enable);
+#endif
+    return TRUE;
+}