1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxClientDC class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "dcclient.h"
16 #include "wx/dcclient.h"
17 #include "wx/dcmemory.h"
18 #include "wx/region.h"
19 #include "wx/window.h"
22 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
26 #define RAD2DEG 57.2957795131
28 //-----------------------------------------------------------------------------
30 //-----------------------------------------------------------------------------
32 #if !USE_SHARED_LIBRARY
33 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC
, wxDC
)
34 IMPLEMENT_DYNAMIC_CLASS(wxClientDC
, wxWindowDC
)
35 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC
, wxWindowDC
)
42 #include "wx/mac/uma.h"
44 wxWindowDC::wxWindowDC()
48 wxWindowDC::wxWindowDC(wxWindow
*the_canvas
)
50 wxTopLevelWindowMac
* rootwindow
= the_canvas
->MacGetTopLevelWindow() ;
51 WindowRef windowref
= rootwindow
->MacGetWindowRef() ;
55 the_canvas
->MacWindowToRootWindow( &x
, &y
) ;
56 m_macLocalOrigin
.h
= x
;
57 m_macLocalOrigin
.v
= y
;
58 CopyRgn( the_canvas
->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn
) ;
59 OffsetRgn( m_macBoundaryClipRgn
, m_macLocalOrigin
.h
, m_macLocalOrigin
.v
) ;
60 CopyRgn( m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
61 m_macPort
= UMAGetWindowPort( windowref
) ;
63 wxSize size
= the_canvas
->GetSize() ;
68 SetBackground(the_canvas
->MacGetBackgroundBrush());
71 wxWindowDC::~wxWindowDC()
79 wxClientDC::wxClientDC()
83 wxClientDC::wxClientDC(wxWindow
*window
)
85 wxTopLevelWindowMac
* rootwindow
= window
->MacGetTopLevelWindow() ;
86 WindowRef windowref
= rootwindow
->MacGetWindowRef() ;
87 wxPoint origin
= window
->GetClientAreaOrigin() ;
88 wxSize size
= window
->GetClientSize() ;
92 window
->MacWindowToRootWindow( &x
, &y
) ;
93 m_macLocalOrigin
.h
= x
;
94 m_macLocalOrigin
.v
= y
;
95 SetRectRgn( m_macBoundaryClipRgn
, origin
.x
, origin
.y
, origin
.x
+ size
.x
, origin
.y
+ size
.y
) ;
96 SectRgn( m_macBoundaryClipRgn
, window
->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn
) ;
97 OffsetRgn( m_macBoundaryClipRgn
, -origin
.x
, -origin
.y
) ;
98 OffsetRgn( m_macBoundaryClipRgn
, m_macLocalOrigin
.h
, m_macLocalOrigin
.v
) ;
99 CopyRgn( m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
100 m_macPort
= UMAGetWindowPort( windowref
) ;
105 SetBackground(window
->MacGetBackgroundBrush());
106 SetFont( window
->GetFont() ) ;
109 wxClientDC::~wxClientDC()
117 wxPaintDC::wxPaintDC()
121 wxPaintDC::wxPaintDC(wxWindow
*window
)
123 wxTopLevelWindowMac
* rootwindow
= window
->MacGetTopLevelWindow() ;
124 WindowRef windowref
= rootwindow
->MacGetWindowRef() ;
125 wxPoint origin
= window
->GetClientAreaOrigin() ;
126 wxSize size
= window
->GetClientSize() ;
130 window
->MacWindowToRootWindow( &x
, &y
) ;
131 m_macLocalOrigin
.h
= x
;
132 m_macLocalOrigin
.v
= y
;
133 SetRectRgn( m_macBoundaryClipRgn
, origin
.x
, origin
.y
, origin
.x
+ size
.x
, origin
.y
+ size
.y
) ;
134 SectRgn( m_macBoundaryClipRgn
, window
->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn
) ;
135 OffsetRgn( m_macBoundaryClipRgn
, -origin
.x
, -origin
.y
) ;
136 SectRgn( m_macBoundaryClipRgn
, window
->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn
) ;
137 OffsetRgn( m_macBoundaryClipRgn
, m_macLocalOrigin
.h
, m_macLocalOrigin
.v
) ;
138 CopyRgn( m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
139 m_macPort
= UMAGetWindowPort( windowref
) ;
144 SetBackground(window
->MacGetBackgroundBrush());
145 SetFont( window
->GetFont() ) ;
148 wxPaintDC::~wxPaintDC()