From: Julian Smart Date: Fri, 6 Jul 2001 13:18:11 +0000 (+0000) Subject: Implemented input disabling for disabled windows since MicroWindows doesn't do it X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/98363307d3b0c8c4f3182b9a82d7f87ca06a1a82 Implemented input disabling for disabled windows since MicroWindows doesn't do it git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10860 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/univ/frame.h b/include/wx/univ/frame.h index 693d7e2377..371a024bb4 100644 --- a/include/wx/univ/frame.h +++ b/include/wx/univ/frame.h @@ -43,6 +43,7 @@ public: const wxString& name = wxFrameNameStr); virtual wxPoint GetClientAreaOrigin() const; + virtual bool Enable( bool enable = TRUE ); protected: void OnSize(wxSizeEvent& event); diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 64ad5feeaa..b62d5371f7 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -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: diff --git a/src/univ/framuniv.cpp b/src/univ/framuniv.cpp index 92a7ae405e..4ae3912a68 100644 --- a/src/univ/framuniv.cpp +++ b/src/univ/framuniv.cpp @@ -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; +}