From: Stefan Csomor Date: Thu, 31 Mar 2005 05:12:46 +0000 (+0000) Subject: content clipping becomes a runtime attribute X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/8adc196b0e9581f2d731710200d104b10b135c98 content clipping becomes a runtime attribute git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33210 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/generic/laywin.h b/include/wx/generic/laywin.h index ef1c162d9f..0f8ede2e8d 100644 --- a/include/wx/generic/laywin.h +++ b/include/wx/generic/laywin.h @@ -184,10 +184,6 @@ public: // Called by layout algorithm to retrieve information about the window. void OnQueryLayoutInfo(wxQueryLayoutInfoEvent& event); -#ifdef __WXMAC__ - virtual bool MacClipChildren() const { return true ; } -#endif - private: void Init(); diff --git a/include/wx/generic/scrolwin.h b/include/wx/generic/scrolwin.h index 91c76bbbf3..c7ecc79bf1 100644 --- a/include/wx/generic/scrolwin.h +++ b/include/wx/generic/scrolwin.h @@ -79,9 +79,6 @@ public: // (this isn't a virtual size, this is a sensible size for the window) virtual wxSize DoGetBestSize() const; -#ifdef __WXMAC__ - virtual bool MacClipChildren() const { return true ; } -#endif protected: // this is needed for wxEVT_PAINT processing hack described in // wxScrollHelperEvtHandler::ProcessEvent() diff --git a/include/wx/mac/carbon/window.h b/include/wx/mac/carbon/window.h index 97d3c3cfd7..3d5fa0d152 100644 --- a/include/wx/mac/carbon/window.h +++ b/include/wx/mac/carbon/window.h @@ -209,7 +209,8 @@ public: wxRegion MacGetVisibleRegion( bool includeOuterStructures = false ) ; // returns true if children have to clipped to the content area (eg scrolled window) - virtual bool MacClipChildren() const { return false ; } + bool MacClipChildren() const { return m_clipChildren ; } + void MacSetClipChildren( bool clip ) { m_clipChildren = clip ; } // returns true if the grandchildren have to be clipped to the children's content area (eg // splitter window) virtual bool MacClipGrandChildren() const { return false ; } @@ -274,6 +275,10 @@ protected: wxScrollBar* m_hScrollBar ; wxScrollBar* m_vScrollBar ; wxString m_label ; + // returns true if we do a sharp clip at the content area of this window + // must be dynamic as eg a panel normally is not clipping precisely, but if + // it becomes the target window of a scrolled window it has to... + bool m_clipChildren ; void MacCreateScrollBars( long style ) ; void MacRepositionScrollBars() ; diff --git a/src/generic/laywin.cpp b/src/generic/laywin.cpp index 3a9b076403..aa608278d1 100644 --- a/src/generic/laywin.cpp +++ b/src/generic/laywin.cpp @@ -54,6 +54,9 @@ void wxSashLayoutWindow::Init() { m_orientation = wxLAYOUT_HORIZONTAL; m_alignment = wxLAYOUT_TOP; +#ifdef __WXMAC__ + MacSetClipChildren( true ) ; +#endif } // This is the function that wxLayoutAlgorithm calls to ascertain the window diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index 7add087eda..94a3d59f5f 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -424,6 +424,9 @@ void wxScrollHelper::SetWindow(wxWindow *win) void wxScrollHelper::DoSetTargetWindow(wxWindow *target) { m_targetWindow = target; +#ifdef __WXMAC__ + target->MacSetClipChildren( true ) ; +#endif // install the event handler which will intercept the events we're // interested in (but only do it for our real window, not the target window @@ -1250,6 +1253,9 @@ bool wxGenericScrolledWindow::Create(wxWindow *parent, const wxString& name) { m_targetWindow = this; +#ifdef __WXMAC__ + MacSetClipChildren( true ) ; +#endif bool ok = wxPanel::Create(parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, name); diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index bf7ec22feb..9800febda5 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -748,6 +748,7 @@ void wxWindowMac::Init() #if wxMAC_USE_CORE_GRAPHICS m_cgContextRef = NULL ; #endif + m_clipChildren = false ; // we need a valid font for the encodings wxWindowBase::SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); }