added port state save class

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26451 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-03-29 11:28:08 +00:00
parent d09dd96e31
commit 01299d5694
2 changed files with 29 additions and 0 deletions

View File

@@ -105,10 +105,23 @@ public:
wxMacWindowClipper( const wxWindow* win ) ;
~wxMacWindowClipper() ;
private:
GrafPtr m_newPort ;
RgnHandle m_formerClip ;
RgnHandle m_newClip ;
} ;
class WXDLLEXPORT wxMacWindowStateSaver : public wxMacWindowClipper
{
DECLARE_NO_COPY_CLASS(wxMacWindowStateSaver)
public:
wxMacWindowStateSaver( const wxWindow* win ) ;
~wxMacWindowStateSaver() ;
private:
GrafPtr m_newPort ;
ThemeDrawingState m_themeDrawingState ;
} ;
/*
class wxMacDrawingHelper
{

View File

@@ -107,6 +107,7 @@ typedef wxMacPortSetter wxMacFastPortSetter ;
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 ) ;
@@ -126,11 +127,26 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) :
wxMacWindowClipper::~wxMacWindowClipper()
{
SetPort( m_newPort ) ;
SetClip( m_formerClip ) ;
DisposeRgn( m_newClip ) ;
DisposeRgn( m_formerClip ) ;
}
wxMacWindowStateSaver::wxMacWindowStateSaver( const wxWindow* win ) :
wxMacWindowClipper( win )
{
// the port is already set at this point
m_newPort =(GrafPtr) GetWindowPort((WindowRef) win->MacGetTopLevelWindowRef()) ;
GetThemeDrawingState( &m_themeDrawingState ) ;
}
wxMacWindowStateSaver::~wxMacWindowStateSaver()
{
SetPort( m_newPort ) ;
SetThemeDrawingState( m_themeDrawingState , true ) ;
}
//-----------------------------------------------------------------------------
// Local functions
//-----------------------------------------------------------------------------