From cbea84022c92098e94956cc50a4271599773a975 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 30 Nov 2007 10:19:57 +0000 Subject: [PATCH] moving code, fixing 10.5 only compiles git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50341 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/textctrl.cpp | 90 ++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 89ab18889a..f44ec41d34 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -170,6 +170,51 @@ private: RgnHandle m_newClip; }; +wxMacPortSaver::wxMacPortSaver( GrafPtr port ) +{ + ::GetPort( &m_port ); + ::SetPort( port ); +} + +wxMacPortSaver::~wxMacPortSaver() +{ + ::SetPort( m_port ); +} + +wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) : +wxMacPortSaver( (GrafPtr) GetWindowPort( (WindowRef) win->MacGetTopLevelWindowRef() ) ) +{ + m_newPort = (GrafPtr) GetWindowPort( (WindowRef) win->MacGetTopLevelWindowRef() ) ; + m_formerClip = NewRgn() ; + m_newClip = NewRgn() ; + GetClip( m_formerClip ) ; + + if ( win ) + { + // guard against half constructed objects, this just leads to a empty clip + if ( win->GetPeer() ) + { + int x = 0 , y = 0; + win->MacWindowToRootWindow( &x, &y ) ; + + // get area including focus rect + HIShapeGetAsQDRgn( ((wxWindow*)win)->MacGetVisibleRegion(true).GetWXHRGN() , m_newClip ); + if ( !EmptyRgn( m_newClip ) ) + OffsetRgn( m_newClip , x , y ) ; + } + + SetClip( m_newClip ) ; + } +} + +wxMacWindowClipper::~wxMacWindowClipper() +{ + SetPort( m_newPort ) ; + SetClip( m_formerClip ) ; + DisposeRgn( m_newClip ) ; + DisposeRgn( m_formerClip ) ; +} + // common parts for implementations based on MLTE class wxMacMLTEControl : public wxMacTextControl @@ -2258,51 +2303,6 @@ int wxMacMLTEControl::GetLineLength(long lineNo) const // while this can be solved on 10.3 by reassigning them the correct place, on 10.2 there is // no way out, therefore we are using our own implementation and our own scrollbars .... -wxMacPortSaver::wxMacPortSaver( GrafPtr port ) -{ - ::GetPort( &m_port ); - ::SetPort( port ); -} - -wxMacPortSaver::~wxMacPortSaver() -{ - ::SetPort( m_port ); -} - -wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) : - wxMacPortSaver( (GrafPtr) GetWindowPort( (WindowRef) win->MacGetTopLevelWindowRef() ) ) -{ - m_newPort = (GrafPtr) GetWindowPort( (WindowRef) win->MacGetTopLevelWindowRef() ) ; - m_formerClip = NewRgn() ; - m_newClip = NewRgn() ; - GetClip( m_formerClip ) ; - - if ( win ) - { - // guard against half constructed objects, this just leads to a empty clip - if ( win->GetPeer() ) - { - int x = 0 , y = 0; - win->MacWindowToRootWindow( &x, &y ) ; - - // get area including focus rect - HIShapeGetAsQDRgn( ((wxWindow*)win)->MacGetVisibleRegion(true).GetWXHRGN() , m_newClip ); - if ( !EmptyRgn( m_newClip ) ) - OffsetRgn( m_newClip , x , y ) ; - } - - SetClip( m_newClip ) ; - } -} - -wxMacWindowClipper::~wxMacWindowClipper() -{ - SetPort( m_newPort ) ; - SetClip( m_formerClip ) ; - DisposeRgn( m_newClip ) ; - DisposeRgn( m_formerClip ) ; -} - TXNScrollInfoUPP gTXNScrollInfoProc = NULL ; ControlActionUPP gTXNScrollActionProc = NULL ; -- 2.45.2