]>
Commit | Line | Data |
---|---|---|
e9576ca5 SC |
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" | |
03e11df5 | 19 | #include "wx/window.h" |
e9576ca5 SC |
20 | #include <math.h> |
21 | ||
22 | //----------------------------------------------------------------------------- | |
23 | // constants | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
26 | #define RAD2DEG 57.2957795131 | |
27 | ||
28 | //----------------------------------------------------------------------------- | |
29 | // wxPaintDC | |
30 | //----------------------------------------------------------------------------- | |
31 | ||
2f1ae414 | 32 | #if !USE_SHARED_LIBRARY |
e9576ca5 SC |
33 | IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC) |
34 | IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC) | |
35 | IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC) | |
2f1ae414 | 36 | #endif |
e9576ca5 SC |
37 | |
38 | /* | |
39 | * wxWindowDC | |
40 | */ | |
41 | ||
d497dca4 | 42 | #include "wx/mac/uma.h" |
519cb848 | 43 | |
2f1ae414 | 44 | wxWindowDC::wxWindowDC() |
e9576ca5 | 45 | { |
519cb848 | 46 | } |
e9576ca5 | 47 | |
2f1ae414 | 48 | wxWindowDC::wxWindowDC(wxWindow *the_canvas) |
519cb848 SC |
49 | { |
50 | WindowRef windowref ; | |
e766c8a9 | 51 | wxWindowMac* rootwindow ; |
519cb848 SC |
52 | |
53 | // this time it is really the full window | |
ffba56ed SC |
54 | Rect clipRect ; |
55 | the_canvas->MacGetPortParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow ); | |
56 | SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ; | |
40d60178 | 57 | SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ; |
c59ceaaa | 58 | CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ; |
519cb848 | 59 | m_macPort = UMAGetWindowPort( windowref ) ; |
2f1ae414 SC |
60 | m_minY = m_minX = 0; |
61 | wxSize size = the_canvas->GetSize() ; | |
62 | m_maxX = size.x ; | |
63 | m_maxY = size.y ; | |
64 | ||
519cb848 | 65 | m_ok = TRUE ; |
40d60178 | 66 | SetBackground(the_canvas->MacGetBackgroundBrush()); |
519cb848 | 67 | } |
e9576ca5 | 68 | |
2f1ae414 | 69 | wxWindowDC::~wxWindowDC() |
e9576ca5 | 70 | { |
519cb848 | 71 | } |
e9576ca5 | 72 | |
519cb848 SC |
73 | /* |
74 | * wxClientDC | |
75 | */ | |
e9576ca5 | 76 | |
2f1ae414 | 77 | wxClientDC::wxClientDC() |
e9576ca5 | 78 | { |
e9576ca5 SC |
79 | } |
80 | ||
519cb848 | 81 | wxClientDC::wxClientDC(wxWindow *window) |
e9576ca5 | 82 | { |
519cb848 | 83 | WindowRef windowref ; |
e766c8a9 | 84 | wxWindowMac* rootwindow ; |
519cb848 | 85 | |
ffba56ed | 86 | Rect clipRect ; |
40d60178 SC |
87 | wxPoint origin = window->GetClientAreaOrigin() ; |
88 | ||
ffba56ed | 89 | window->MacGetPortClientParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow ); |
40d60178 SC |
90 | SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ; |
91 | SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ; | |
92 | OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ; | |
c59ceaaa | 93 | CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ; |
519cb848 | 94 | m_macPort = UMAGetWindowPort( windowref ) ; |
2f1ae414 SC |
95 | m_minY = m_minX = 0; |
96 | wxSize size = window->GetSize() ; | |
97 | m_maxX = size.x ; | |
98 | m_maxY = size.y ; | |
519cb848 | 99 | m_ok = TRUE ; |
40d60178 | 100 | SetBackground(window->MacGetBackgroundBrush()); |
7c74e7fe | 101 | SetFont( window->GetFont() ) ; |
e9576ca5 SC |
102 | } |
103 | ||
2f1ae414 | 104 | wxClientDC::~wxClientDC() |
e9576ca5 | 105 | { |
e9576ca5 SC |
106 | } |
107 | ||
519cb848 SC |
108 | /* |
109 | * wxPaintDC | |
110 | */ | |
e9576ca5 | 111 | |
2f1ae414 | 112 | wxPaintDC::wxPaintDC() |
e9576ca5 | 113 | { |
e9576ca5 SC |
114 | } |
115 | ||
519cb848 | 116 | wxPaintDC::wxPaintDC(wxWindow *window) |
e9576ca5 | 117 | { |
519cb848 | 118 | WindowRef windowref ; |
e766c8a9 | 119 | wxWindowMac* rootwindow ; |
519cb848 | 120 | |
ffba56ed | 121 | Rect clipRect ; |
40d60178 SC |
122 | wxPoint origin = window->GetClientAreaOrigin() ; |
123 | ||
ffba56ed | 124 | window->MacGetPortClientParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow ); |
40d60178 SC |
125 | SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ; |
126 | SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ; | |
127 | OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ; | |
128 | SectRgn( m_macBoundaryClipRgn , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ; | |
c59ceaaa | 129 | CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ; |
519cb848 | 130 | m_macPort = UMAGetWindowPort( windowref ) ; |
519cb848 | 131 | m_ok = TRUE ; |
a8cd4a3a | 132 | /* |
03e11df5 | 133 | wxCoord x , y ,w , h ; |
519cb848 | 134 | window->GetUpdateRegion().GetBox( x , y , w , h ) ; |
2f1ae414 SC |
135 | m_minY = m_minX = 0; |
136 | wxSize size = window->GetSize() ; | |
137 | m_maxX = size.x ; | |
138 | m_maxY = size.y ; | |
519cb848 | 139 | SetClippingRegion( x , y , w , h ) ; |
a8cd4a3a | 140 | */ |
40d60178 SC |
141 | SetBackground(window->MacGetBackgroundBrush()); |
142 | SetFont(window->GetFont() ) ; | |
e9576ca5 SC |
143 | } |
144 | ||
519cb848 | 145 | wxPaintDC::~wxPaintDC() |
e9576ca5 | 146 | { |
519cb848 | 147 | } |