]>
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"
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
)
51 wxWindowMac
* rootwindow
;
53 // this time it is really the full window
55 the_canvas
->MacGetPortParams(&m_macLocalOrigin
, &clipRect
, &windowref
, &rootwindow
);
56 SetRectRgn( m_macBoundaryClipRgn
, clipRect
.left
, clipRect
.top
, clipRect
.right
, clipRect
.bottom
) ;
57 CopyRgn( m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
58 m_macPort
= UMAGetWindowPort( windowref
) ;
60 wxSize size
= the_canvas
->GetSize() ;
65 SetBackground(wxBrush(the_canvas
->GetBackgroundColour(), wxSOLID
));
68 wxWindowDC::~wxWindowDC()
76 wxClientDC::wxClientDC()
80 wxClientDC::wxClientDC(wxWindow
*window
)
83 wxWindowMac
* rootwindow
;
86 window
->MacGetPortClientParams(&m_macLocalOrigin
, &clipRect
, &windowref
, &rootwindow
);
87 SetRectRgn( m_macBoundaryClipRgn
, clipRect
.left
, clipRect
.top
, clipRect
.right
, clipRect
.bottom
) ;
88 CopyRgn( m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
89 m_macPort
= UMAGetWindowPort( windowref
) ;
91 wxSize size
= window
->GetSize() ;
95 SetBackground(wxBrush(window
->GetBackgroundColour(), wxSOLID
));
96 SetFont( window
->GetFont() ) ;
99 wxClientDC::~wxClientDC()
107 wxPaintDC::wxPaintDC()
111 wxPaintDC::wxPaintDC(wxWindow
*window
)
113 WindowRef windowref
;
114 wxWindowMac
* rootwindow
;
117 window
->MacGetPortClientParams(&m_macLocalOrigin
, &clipRect
, &windowref
, &rootwindow
);
118 CopyRgn( window
->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn
) ;
119 CopyRgn( m_macBoundaryClipRgn
, m_macCurrentClipRgn
) ;
120 m_macPort
= UMAGetWindowPort( windowref
) ;
123 wxCoord x , y ,w , h ;
124 window->GetUpdateRegion().GetBox( x , y , w , h ) ;
126 wxSize size = window->GetSize() ;
129 SetClippingRegion( x , y , w , h ) ;
131 SetBackground(wxBrush(window
->GetBackgroundColour(), wxSOLID
));
132 SetFont(window
->GetFont() ) ;
135 wxPaintDC::~wxPaintDC()