From: Václav Slavík Date: Tue, 18 Sep 2001 22:36:18 +0000 (+0000) Subject: moved AdjustToClientAreaOrigin to wxWindowBase, needed worldwide for wxUniv X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a200c35efa060107d8243458fca160eb237b9c23 moved AdjustToClientAreaOrigin to wxWindowBase, needed worldwide for wxUniv git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11644 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 487ad1e542..3a77679b8a 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -198,10 +198,6 @@ public: // smaller virtual wxPoint GetClientAreaOrigin() const; - // Makes an adjustment to the window position (for example, a frame that has - // a toolbar that it manages itself). - virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags); - // Windows subclassing void SubclassWin(WXHWND hWnd); void UnsubclassWin(); diff --git a/include/wx/os2/window.h b/include/wx/os2/window.h index 4c3fc7391e..edc0e474bb 100644 --- a/include/wx/os2/window.h +++ b/include/wx/os2/window.h @@ -215,13 +215,6 @@ public: // smaller virtual wxPoint GetClientAreaOrigin(void) const; - // Makes an adjustment to the window position (for example, a frame that has - // a toolbar that it manages itself). - virtual void AdjustForParentClientOrigin( int& rX - ,int& rY - ,int nSizeFlags - ); - // Windows subclassing void SubclassWin(WXHWND hWnd); void UnsubclassWin(void); diff --git a/include/wx/window.h b/include/wx/window.h index 2e940e1ddd..734e518ca7 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -975,6 +975,10 @@ protected: virtual void DoSetClientData( void *data ); virtual void *DoGetClientData() const; + + // Makes an adjustment to the window position (for example, a frame that has + // a toolbar that it manages itself). + virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags); // what kind of data do we have? wxClientDataType m_clientDataType; diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index df455c9cfa..9a7b7a3bc6 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -1355,6 +1355,23 @@ void wxWindowBase::GetClientSizeConstraint(int *w, int *h) const GetClientSize(w, h); } +void wxWindowBase::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags) +{ + // don't do it for the dialogs/frames - they float independently of their + // parent + if ( !IsTopLevel() ) + { + wxWindow *parent = GetParent(); + if ( !(sizeFlags & wxSIZE_NO_ADJUSTMENTS) && parent ) + { + wxPoint pt(parent->GetClientAreaOrigin()); + x += pt.x; + y += pt.y; + } + } +} + + void wxWindowBase::GetPositionConstraint(int *x, int *y) const { wxLayoutConstraints *constr = GetConstraints(); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 9b8f1de926..866d2b4f8b 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2690,6 +2690,12 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags if (m_resizing) return; /* I don't like recursions */ m_resizing = TRUE; + if (x == -1) + x = m_x; + if (y == -1) + y = m_y; + AdjustForParentClientOrigin(x, y, sizeFlags); + if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */ { /* don't set the size for children of wxNotebook, just take the values. */ diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 9b8f1de926..866d2b4f8b 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -2690,6 +2690,12 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags if (m_resizing) return; /* I don't like recursions */ m_resizing = TRUE; + if (x == -1) + x = m_x; + if (y == -1) + y = m_y; + AdjustForParentClientOrigin(x, y, sizeFlags); + if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */ { /* don't set the size for children of wxNotebook, just take the values. */ diff --git a/src/mgl/window.cpp b/src/mgl/window.cpp index 61e992901f..8f3bb0905a 100644 --- a/src/mgl/window.cpp +++ b/src/mgl/window.cpp @@ -180,6 +180,8 @@ static ibool wxWindowMouseHandler(window_t *wnd, event_t *e) wxWindowMGL *win = (wxWindowMGL*)MGL_wmGetWindowUserData(wnd); wxPoint where = win->ScreenToClient(wxPoint(e->where_x, e->where_y)); + if ( !win->IsEnabled() ) return FALSE; + wxEventType type = wxEVT_NULL; wxMouseEvent event; event.SetEventObject(win); @@ -387,6 +389,9 @@ static ibool wxWindowKeybHandler(window_t *wnd, event_t *e) { wxEventType type = wxEVT_NULL; wxWindowMGL *win = (wxWindowMGL*)MGL_wmGetWindowUserData(wnd); + + if ( !win->IsEnabled() ) return FALSE; + wxPoint where = win->ScreenToClient(wxPoint(e->where_x, e->where_y)); wxKeyEvent event; @@ -847,9 +852,7 @@ void wxWindowMGL::DoSetSize(int x, int y, int width, int height, int sizeFlags) if ( y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) y = currentY; -#if 0 // FIXME_MGL -- what's this good for? AdjustForParentClientOrigin(x, y, sizeFlags); -#endif wxSize size(-1, -1); if ( width == -1 ) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index cd2ca7448d..59e4c2a5f1 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1554,24 +1554,6 @@ wxPoint wxWindowMSW::GetClientAreaOrigin() const return wxPoint(0, 0); } -// Makes an adjustment to the window position (for example, a frame that has -// a toolbar that it manages itself). -void wxWindowMSW::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags) -{ - // don't do it for the dialogs/frames - they float independently of their - // parent - if ( !IsTopLevel() ) - { - wxWindow *parent = GetParent(); - if ( !(sizeFlags & wxSIZE_NO_ADJUSTMENTS) && parent ) - { - wxPoint pt(parent->GetClientAreaOrigin()); - x += pt.x; - y += pt.y; - } - } -} - // --------------------------------------------------------------------------- // text metrics // --------------------------------------------------------------------------- diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 90180cf64c..bd50f98ca9 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -1639,29 +1639,6 @@ wxPoint wxWindowOS2::GetClientAreaOrigin() const return wxPoint(0, 0); } // end of wxWindowOS2::GetClientAreaOrigin -void wxWindowOS2::AdjustForParentClientOrigin( - int& rX -, int& rY -, int nSizeFlags -) -{ - // - // Don't do it for the dialogs/frames - they float independently of their - // parent - // - if (!IsTopLevel()) - { - wxWindow* pParent = GetParent(); - - if (!(nSizeFlags & wxSIZE_NO_ADJUSTMENTS) && pParent) - { - wxPoint vPoint(pParent->GetClientAreaOrigin()); - rX += vPoint.x; - rY += vPoint.y; - } - } -} // end of wxWindowOS2::AdjustForParentClientOrigin - // --------------------------------------------------------------------------- // text metrics // ---------------------------------------------------------------------------