]> git.saurik.com Git - wxWidgets.git/blob - src/mac/dcclient.cpp
wxFont can now raelly use the native fonts
[wxWidgets.git] / src / mac / 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 "wx/window.h"
20 #include <math.h>
21
22 //-----------------------------------------------------------------------------
23 // constants
24 //-----------------------------------------------------------------------------
25
26 #define RAD2DEG 57.2957795131
27
28 //-----------------------------------------------------------------------------
29 // wxPaintDC
30 //-----------------------------------------------------------------------------
31
32 #if !USE_SHARED_LIBRARY
33 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
34 IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
35 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
36 #endif
37
38 /*
39 * wxWindowDC
40 */
41
42 #include "wx/mac/uma.h"
43
44 wxWindowDC::wxWindowDC()
45 {
46 }
47
48 wxWindowDC::wxWindowDC(wxWindow *the_canvas)
49 {
50 WindowRef windowref ;
51 wxWindowMac* rootwindow ;
52
53 // this time it is really the full window
54 Rect clipRect ;
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 ) ;
59 m_minY = m_minX = 0;
60 wxSize size = the_canvas->GetSize() ;
61 m_maxX = size.x ;
62 m_maxY = size.y ;
63
64 m_ok = TRUE ;
65 SetBackground(wxBrush(the_canvas->GetBackgroundColour(), wxSOLID));
66 }
67
68 wxWindowDC::~wxWindowDC()
69 {
70 }
71
72 /*
73 * wxClientDC
74 */
75
76 wxClientDC::wxClientDC()
77 {
78 }
79
80 wxClientDC::wxClientDC(wxWindow *window)
81 {
82 WindowRef windowref ;
83 wxWindowMac* rootwindow ;
84
85 Rect clipRect ;
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 ) ;
90 m_minY = m_minX = 0;
91 wxSize size = window->GetSize() ;
92 m_maxX = size.x ;
93 m_maxY = size.y ;
94 m_ok = TRUE ;
95 SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
96 SetFont( window->GetFont() ) ;
97 }
98
99 wxClientDC::~wxClientDC()
100 {
101 }
102
103 /*
104 * wxPaintDC
105 */
106
107 wxPaintDC::wxPaintDC()
108 {
109 }
110
111 wxPaintDC::wxPaintDC(wxWindow *window)
112 {
113 WindowRef windowref ;
114 wxWindowMac* rootwindow ;
115
116 Rect clipRect ;
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 ) ;
121 m_ok = TRUE ;
122 /*
123 wxCoord x , y ,w , h ;
124 window->GetUpdateRegion().GetBox( x , y , w , h ) ;
125 m_minY = m_minX = 0;
126 wxSize size = window->GetSize() ;
127 m_maxX = size.x ;
128 m_maxY = size.y ;
129 SetClippingRegion( x , y , w , h ) ;
130 */
131 SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
132 SetFont(window->GetFont() ) ;
133 }
134
135 wxPaintDC::~wxPaintDC()
136 {
137 }