]> git.saurik.com Git - wxWidgets.git/blob - src/mac/dcclient.cpp
Removed unneeded assert
[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 "wx/toplevel.h"
21 #include <math.h>
22 #include "wx/mac/private.h"
23
24 //-----------------------------------------------------------------------------
25 // constants
26 //-----------------------------------------------------------------------------
27
28 #define RAD2DEG 57.2957795131
29
30 //-----------------------------------------------------------------------------
31 // wxPaintDC
32 //-----------------------------------------------------------------------------
33
34 #if !USE_SHARED_LIBRARY
35 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
36 IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
37 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
38 #endif
39
40 /*
41 * wxWindowDC
42 */
43
44 #include "wx/mac/uma.h"
45
46 wxWindowDC::wxWindowDC()
47 {
48 }
49
50 wxWindowDC::wxWindowDC(wxWindow *the_canvas)
51 {
52 wxTopLevelWindowMac* rootwindow = the_canvas->MacGetTopLevelWindow() ;
53 WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
54
55 int x , y ;
56 x = y = 0 ;
57 the_canvas->MacWindowToRootWindow( &x , &y ) ;
58 m_macLocalOrigin.x = x ;
59 m_macLocalOrigin.y = y ;
60 CopyRgn( (RgnHandle) the_canvas->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
61 OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
62 CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
63 m_macPort = UMAGetWindowPort( windowref ) ;
64 m_minY = m_minX = 0;
65 wxSize size = the_canvas->GetSize() ;
66 m_maxX = size.x ;
67 m_maxY = size.y ;
68
69 m_ok = TRUE ;
70 SetBackground(the_canvas->MacGetBackgroundBrush());
71 }
72
73 wxWindowDC::~wxWindowDC()
74 {
75 }
76
77 /*
78 * wxClientDC
79 */
80
81 wxClientDC::wxClientDC()
82 {
83 }
84
85 wxClientDC::wxClientDC(wxWindow *window)
86 {
87 wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
88 WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
89 wxPoint origin = window->GetClientAreaOrigin() ;
90 wxSize size = window->GetClientSize() ;
91 int x , y ;
92 x = origin.x ;
93 y = origin.y ;
94 window->MacWindowToRootWindow( &x , &y ) ;
95 m_macLocalOrigin.x = x ;
96 m_macLocalOrigin.y = y ;
97 SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
98 SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
99 OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
100 OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
101 CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle) m_macCurrentClipRgn ) ;
102 m_macPort = UMAGetWindowPort( windowref ) ;
103 m_minY = m_minX = 0;
104 m_maxX = size.x ;
105 m_maxY = size.y ;
106 m_ok = TRUE ;
107 SetBackground(window->MacGetBackgroundBrush());
108 SetFont( window->GetFont() ) ;
109 }
110
111 wxClientDC::~wxClientDC()
112 {
113 }
114
115 /*
116 * wxPaintDC
117 */
118
119 wxPaintDC::wxPaintDC()
120 {
121 }
122
123 wxPaintDC::wxPaintDC(wxWindow *window)
124 {
125 wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
126 WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
127 wxPoint origin = window->GetClientAreaOrigin() ;
128 wxSize size = window->GetClientSize() ;
129 int x , y ;
130 x = origin.x ;
131 y = origin.y ;
132 window->MacWindowToRootWindow( &x , &y ) ;
133 m_macLocalOrigin.x = x ;
134 m_macLocalOrigin.y = y ;
135 SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
136 SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
137 OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
138 SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->GetUpdateRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
139 OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
140 CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
141 m_macPort = UMAGetWindowPort( windowref ) ;
142 m_minY = m_minX = 0;
143 m_maxX = size.x ;
144 m_maxY = size.y ;
145 m_ok = TRUE ;
146 SetBackground(window->MacGetBackgroundBrush());
147 SetFont( window->GetFont() ) ;
148 }
149
150 wxPaintDC::~wxPaintDC()
151 {
152 }