]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/dcclient.cpp
Committing in .
[wxWidgets.git] / src / mac / carbon / dcclient.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dcclient.cpp
3 // Purpose: wxClientDC class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "dcclient.h"
14 #endif
15
16 #include "wx/dcclient.h"
17 #include "wx/dcmemory.h"
18 #include "wx/region.h"
19 #include <math.h>
20
21 //-----------------------------------------------------------------------------
22 // constants
23 //-----------------------------------------------------------------------------
24
25 #define RAD2DEG 57.2957795131
26
27 //-----------------------------------------------------------------------------
28 // wxPaintDC
29 //-----------------------------------------------------------------------------
30
31 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
32 IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
33 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
34
35 /*
36 * wxWindowDC
37 */
38
39 #include <wx/mac/uma.h>
40
41 wxWindowDC::wxWindowDC(void)
42 {
43 }
44
45 wxWindowDC::wxWindowDC(wxWindow *the_canvas)
46 {
47 WindowRef windowref ;
48 wxWindow* rootwindow ;
49
50 // this time it is really the full window
51
52 the_canvas->MacGetPortParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
53 m_macPort = UMAGetWindowPort( windowref ) ;
54 MacSetupPort() ;
55 m_ok = TRUE ;
56 }
57
58 wxWindowDC::~wxWindowDC(void)
59 {
60 }
61
62 /*
63 * wxClientDC
64 */
65
66 wxClientDC::wxClientDC(void)
67 {
68 }
69
70 wxClientDC::wxClientDC(wxWindow *window)
71 {
72 WindowRef windowref ;
73 wxWindow* rootwindow ;
74
75 window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
76 m_macPort = UMAGetWindowPort( windowref ) ;
77 MacSetupPort() ;
78 m_ok = TRUE ;
79 SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
80 SetFont( window->GetFont() ) ;
81 }
82
83 wxClientDC::~wxClientDC(void)
84 {
85 }
86
87 /*
88 * wxPaintDC
89 */
90
91 wxPaintDC::wxPaintDC(void)
92 {
93 }
94
95 wxPaintDC::wxPaintDC(wxWindow *window)
96 {
97 WindowRef windowref ;
98 wxWindow* rootwindow ;
99
100 window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
101
102 m_macPort = UMAGetWindowPort( windowref ) ;
103 MacSetupPort() ;
104 m_ok = TRUE ;
105 long x , y ,w , h ;
106 window->GetUpdateRegion().GetBox( x , y , w , h ) ;
107 SetClippingRegion( x , y , w , h ) ;
108 SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
109 SetFont(window->GetFont() ) ;
110 }
111
112 wxPaintDC::~wxPaintDC()
113 {
114 }