]> git.saurik.com Git - wxWidgets.git/commitdiff
added port state save class
authorStefan Csomor <csomor@advancedconcepts.ch>
Mon, 29 Mar 2004 11:28:08 +0000 (11:28 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Mon, 29 Mar 2004 11:28:08 +0000 (11:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26451 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/mac/carbon/private.h
src/mac/carbon/dc.cpp

index c64fcbb0b37104a61192165d0b3c39280a8ff286..fcb7cb0aa23b0a2bbacf579c9ab7c542ca2b2c01 100644 (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
 {
index 53ab8a3f7fbe5f69208c547e13847cd47a7e0628..49de162c0a83ef77537d4c9c2a98adc98faf880b 100644 (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
 //-----------------------------------------------------------------------------