]>
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 ) ; | |
c59ceaaa | 57 | CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ; |
519cb848 | 58 | m_macPort = UMAGetWindowPort( windowref ) ; |
2f1ae414 SC |
59 | m_minY = m_minX = 0; |
60 | wxSize size = the_canvas->GetSize() ; | |
61 | m_maxX = size.x ; | |
62 | m_maxY = size.y ; | |
63 | ||
519cb848 | 64 | m_ok = TRUE ; |
0a67a93b | 65 | SetBackground(wxBrush(the_canvas->GetBackgroundColour(), wxSOLID)); |
519cb848 | 66 | } |
e9576ca5 | 67 | |
2f1ae414 | 68 | wxWindowDC::~wxWindowDC() |
e9576ca5 | 69 | { |
519cb848 | 70 | } |
e9576ca5 | 71 | |
519cb848 SC |
72 | /* |
73 | * wxClientDC | |
74 | */ | |
e9576ca5 | 75 | |
2f1ae414 | 76 | wxClientDC::wxClientDC() |
e9576ca5 | 77 | { |
e9576ca5 SC |
78 | } |
79 | ||
519cb848 | 80 | wxClientDC::wxClientDC(wxWindow *window) |
e9576ca5 | 81 | { |
519cb848 | 82 | WindowRef windowref ; |
e766c8a9 | 83 | wxWindowMac* rootwindow ; |
519cb848 | 84 | |
ffba56ed SC |
85 | Rect clipRect ; |
86 | window->MacGetPortClientParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow ); | |
87 | SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ; | |
c59ceaaa | 88 | CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ; |
519cb848 | 89 | m_macPort = UMAGetWindowPort( windowref ) ; |
2f1ae414 SC |
90 | m_minY = m_minX = 0; |
91 | wxSize size = window->GetSize() ; | |
92 | m_maxX = size.x ; | |
93 | m_maxY = size.y ; | |
519cb848 | 94 | m_ok = TRUE ; |
7c74e7fe SC |
95 | SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID)); |
96 | SetFont( window->GetFont() ) ; | |
e9576ca5 SC |
97 | } |
98 | ||
2f1ae414 | 99 | wxClientDC::~wxClientDC() |
e9576ca5 | 100 | { |
e9576ca5 SC |
101 | } |
102 | ||
519cb848 SC |
103 | /* |
104 | * wxPaintDC | |
105 | */ | |
e9576ca5 | 106 | |
2f1ae414 | 107 | wxPaintDC::wxPaintDC() |
e9576ca5 | 108 | { |
e9576ca5 SC |
109 | } |
110 | ||
519cb848 | 111 | wxPaintDC::wxPaintDC(wxWindow *window) |
e9576ca5 | 112 | { |
519cb848 | 113 | WindowRef windowref ; |
e766c8a9 | 114 | wxWindowMac* rootwindow ; |
519cb848 | 115 | |
ffba56ed SC |
116 | Rect clipRect ; |
117 | window->MacGetPortClientParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow ); | |
118 | CopyRgn( window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ; | |
c59ceaaa | 119 | CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ; |
519cb848 | 120 | m_macPort = UMAGetWindowPort( windowref ) ; |
519cb848 | 121 | m_ok = TRUE ; |
a8cd4a3a | 122 | /* |
03e11df5 | 123 | wxCoord x , y ,w , h ; |
519cb848 | 124 | window->GetUpdateRegion().GetBox( x , y , w , h ) ; |
2f1ae414 SC |
125 | m_minY = m_minX = 0; |
126 | wxSize size = window->GetSize() ; | |
127 | m_maxX = size.x ; | |
128 | m_maxY = size.y ; | |
519cb848 | 129 | SetClippingRegion( x , y , w , h ) ; |
a8cd4a3a | 130 | */ |
519cb848 | 131 | SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID)); |
7c74e7fe | 132 | SetFont(window->GetFont() ) ; |
e9576ca5 SC |
133 | } |
134 | ||
519cb848 | 135 | wxPaintDC::~wxPaintDC() |
e9576ca5 | 136 | { |
519cb848 | 137 | } |