]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/dcclient.cpp
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"
20 #include "wx/toplevel.h"
23 //-----------------------------------------------------------------------------
25 //-----------------------------------------------------------------------------
27 #define RAD2DEG 57.2957795131
29 //-----------------------------------------------------------------------------
31 //-----------------------------------------------------------------------------
33 #if !USE_SHARED_LIBRARY
34 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC
, wxDC
)
35 IMPLEMENT_DYNAMIC_CLASS(wxClientDC
, wxWindowDC
)
36 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC
, wxWindowDC
)
43 #include "wx/mac/uma.h"
45 wxWindowDC::wxWindowDC()
49 wxWindowDC::wxWindowDC(wxWindow
*the_canvas
)
51 wxTopLevelWindowMac
* rootwindow
= the_canvas
->MacGetTopLevelWindow() ;
52 WindowRef windowref
= rootwindow
->MacGetWindowRef() ;
56 the_canvas
->MacWindowToRootWindow( &x
, &y
) ;
57 m_macLocalOrigin
.h
= x
;
58 m_macLocalOrigin
.v
= y
;
59 CopyRgn( the_canvas
->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn
) ;
60 OffsetRgn( m_macBoundaryClipRgn
, m_macLocalOrigin
.h
, m_macLocalOrigin
.v
) ;
61 CopyRgn( m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
62 m_macPort
= UMAGetWindowPort( windowref
) ;
64 wxSize size
= the_canvas
->GetSize() ;
69 SetBackground(the_canvas
->MacGetBackgroundBrush());
72 wxWindowDC::~wxWindowDC()
80 wxClientDC::wxClientDC()
84 wxClientDC::wxClientDC(wxWindow
*window
)
86 wxTopLevelWindowMac
* rootwindow
= window
->MacGetTopLevelWindow() ;
87 WindowRef windowref
= rootwindow
->MacGetWindowRef() ;
88 wxPoint origin
= window
->GetClientAreaOrigin() ;
89 wxSize size
= window
->GetClientSize() ;
93 window
->MacWindowToRootWindow( &x
, &y
) ;
94 m_macLocalOrigin
.h
= x
;
95 m_macLocalOrigin
.v
= y
;
96 SetRectRgn( m_macBoundaryClipRgn
, origin
.x
, origin
.y
, origin
.x
+ size
.x
, origin
.y
+ size
.y
) ;
97 SectRgn( m_macBoundaryClipRgn
, window
->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn
) ;
98 OffsetRgn( m_macBoundaryClipRgn
, -origin
.x
, -origin
.y
) ;
99 OffsetRgn( m_macBoundaryClipRgn
, m_macLocalOrigin
.h
, m_macLocalOrigin
.v
) ;
100 CopyRgn( m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
101 m_macPort
= UMAGetWindowPort( windowref
) ;
106 SetBackground(window
->MacGetBackgroundBrush());
107 SetFont( window
->GetFont() ) ;
110 wxClientDC::~wxClientDC()
118 wxPaintDC::wxPaintDC()
122 wxPaintDC::wxPaintDC(wxWindow
*window
)
124 wxTopLevelWindowMac
* rootwindow
= window
->MacGetTopLevelWindow() ;
125 WindowRef windowref
= rootwindow
->MacGetWindowRef() ;
126 wxPoint origin
= window
->GetClientAreaOrigin() ;
127 wxSize size
= window
->GetClientSize() ;
131 window
->MacWindowToRootWindow( &x
, &y
) ;
132 m_macLocalOrigin
.h
= x
;
133 m_macLocalOrigin
.v
= y
;
134 SetRectRgn( m_macBoundaryClipRgn
, origin
.x
, origin
.y
, origin
.x
+ size
.x
, origin
.y
+ size
.y
) ;
135 SectRgn( m_macBoundaryClipRgn
, window
->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn
) ;
136 OffsetRgn( m_macBoundaryClipRgn
, -origin
.x
, -origin
.y
) ;
137 SectRgn( m_macBoundaryClipRgn
, window
->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn
) ;
138 OffsetRgn( m_macBoundaryClipRgn
, m_macLocalOrigin
.h
, m_macLocalOrigin
.v
) ;
139 CopyRgn( m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
140 m_macPort
= UMAGetWindowPort( windowref
) ;
145 SetBackground(window
->MacGetBackgroundBrush());
146 SetFont( window
->GetFont() ) ;
149 wxPaintDC::~wxPaintDC()