]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/dccg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/dccg.cpp
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
18 #include "wx/dcmemory.h"
19 #include "wx/region.h"
22 #include "wx/mac/uma.h"
27 // in case our functions were defined outside std, we make it known all the same
33 #include "wx/mac/private.h"
38 // The textctrl implementation still needs that (needs what?) for the non-HIView implementation
40 wxMacWindowClipper::wxMacWindowClipper( const wxWindow
* win
) :
41 wxMacPortSaver( (GrafPtr
) GetWindowPort( (WindowRef
) win
->MacGetTopLevelWindowRef() ) )
43 m_newPort
= (GrafPtr
) GetWindowPort( (WindowRef
) win
->MacGetTopLevelWindowRef() ) ;
44 m_formerClip
= NewRgn() ;
45 m_newClip
= NewRgn() ;
46 GetClip( m_formerClip
) ;
50 // guard against half constructed objects, this just leads to a empty clip
54 win
->MacWindowToRootWindow( &x
, &y
) ;
56 // get area including focus rect
57 CopyRgn( (RgnHandle
) ((wxWindow
*)win
)->MacGetVisibleRegion(true).GetWXHRGN() , m_newClip
) ;
58 if ( !EmptyRgn( m_newClip
) )
59 OffsetRgn( m_newClip
, x
, y
) ;
62 SetClip( m_newClip
) ;
66 wxMacWindowClipper::~wxMacWindowClipper()
68 SetPort( m_newPort
) ;
69 SetClip( m_formerClip
) ;
70 DisposeRgn( m_newClip
) ;
71 DisposeRgn( m_formerClip
) ;
74 wxMacWindowStateSaver::wxMacWindowStateSaver( const wxWindow
* win
) :
75 wxMacWindowClipper( win
)
77 // the port is already set at this point
78 m_newPort
= (GrafPtr
) GetWindowPort( (WindowRef
) win
->MacGetTopLevelWindowRef() ) ;
79 GetThemeDrawingState( &m_themeDrawingState
) ;
82 wxMacWindowStateSaver::~wxMacWindowStateSaver()
84 SetPort( m_newPort
) ;
85 SetThemeDrawingState( m_themeDrawingState
, true ) ;