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
This commit is contained in:
Julian Smart 2001-07-06 13:18:11 +00:00
parent 9aa80360d1
commit 98363307d3
3 changed files with 71 additions and 9 deletions

View File

@ -43,6 +43,7 @@ public:
const wxString& name = wxFrameNameStr); const wxString& name = wxFrameNameStr);
virtual wxPoint GetClientAreaOrigin() const; virtual wxPoint GetClientAreaOrigin() const;
virtual bool Enable( bool enable = TRUE );
protected: protected:
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);

View File

@ -2155,12 +2155,6 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
#endif #endif
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
// set focus to this window
if (AcceptsFocus())
SetFocus();
// fall through
case WM_LBUTTONUP: case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
@ -2169,12 +2163,69 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
case WM_MBUTTONDOWN: case WM_MBUTTONDOWN:
case WM_MBUTTONUP: case WM_MBUTTONUP:
case WM_MBUTTONDBLCLK: 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_X_LPARAM(lParam),
GET_Y_LPARAM(lParam), GET_Y_LPARAM(lParam),
wParam); wParam);
break; }
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__ #ifdef MM_JOY1MOVE // __WXMICROWIN__
case MM_JOY1MOVE: case MM_JOY1MOVE:
case MM_JOY2MOVE: case MM_JOY2MOVE:

View File

@ -108,3 +108,13 @@ wxPoint wxFrame::GetClientAreaOrigin() const
return pt; 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;
}