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