]> git.saurik.com Git - wxWidgets.git/blob - src/mac/dcclient.cpp
compile fix for bitmap.cpp under Mac
[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 SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
58 OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
59 CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
60 m_macPort = UMAGetWindowPort( windowref ) ;
61 m_minY = m_minX = 0;
62 wxSize size = the_canvas->GetSize() ;
63 m_maxX = size.x ;
64 m_maxY = size.y ;
65
66 m_ok = TRUE ;
67 SetBackground(the_canvas->MacGetBackgroundBrush());
68 }
69
70 wxWindowDC::~wxWindowDC()
71 {
72 }
73
74 /*
75 * wxClientDC
76 */
77
78 wxClientDC::wxClientDC()
79 {
80 }
81
82 wxClientDC::wxClientDC(wxWindow *window)
83 {
84 WindowRef windowref ;
85 wxWindowMac* rootwindow ;
86
87 Rect clipRect ;
88 wxPoint origin = window->GetClientAreaOrigin() ;
89
90 window->MacGetPortClientParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
91 SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ;
92 SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
93 OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
94 OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
95 CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
96 m_macPort = UMAGetWindowPort( windowref ) ;
97 m_minY = m_minX = 0;
98 wxSize size = window->GetSize() ;
99 m_maxX = size.x ;
100 m_maxY = size.y ;
101 m_ok = TRUE ;
102 SetBackground(window->MacGetBackgroundBrush());
103 SetFont( window->GetFont() ) ;
104 }
105
106 wxClientDC::~wxClientDC()
107 {
108 }
109
110 /*
111 * wxPaintDC
112 */
113
114 wxPaintDC::wxPaintDC()
115 {
116 }
117
118 wxPaintDC::wxPaintDC(wxWindow *window)
119 {
120 WindowRef windowref ;
121 wxWindowMac* rootwindow ;
122
123 Rect clipRect ;
124 wxPoint origin = window->GetClientAreaOrigin() ;
125
126 window->MacGetPortClientParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
127 SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ;
128 SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
129 OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
130 SectRgn( m_macBoundaryClipRgn , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
131 OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
132 CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
133 m_macPort = UMAGetWindowPort( windowref ) ;
134 m_ok = TRUE ;
135 /*
136 wxCoord x , y ,w , h ;
137 window->GetUpdateRegion().GetBox( x , y , w , h ) ;
138 m_minY = m_minX = 0;
139 wxSize size = window->GetSize() ;
140 m_maxX = size.x ;
141 m_maxY = size.y ;
142 SetClippingRegion( x , y , w , h ) ;
143 */
144 SetBackground(window->MacGetBackgroundBrush());
145 SetFont(window->GetFont() ) ;
146 }
147
148 wxPaintDC::~wxPaintDC()
149 {
150 }