]>
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 | ||
519cb848 SC |
42 | #include <wx/mac/uma.h> |
43 | ||
2f1ae414 | 44 | wxWindowDC::wxWindowDC() |
e9576ca5 | 45 | { |
519cb848 | 46 | } |
e9576ca5 | 47 | |
2f1ae414 | 48 | wxWindowDC::wxWindowDC(wxWindow *the_canvas) |
519cb848 SC |
49 | { |
50 | WindowRef windowref ; | |
51 | wxWindow* rootwindow ; | |
52 | ||
53 | // this time it is really the full window | |
54 | ||
55 | the_canvas->MacGetPortParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow ); | |
56 | m_macPort = UMAGetWindowPort( windowref ) ; | |
2f1ae414 SC |
57 | m_minY = m_minX = 0; |
58 | wxSize size = the_canvas->GetSize() ; | |
59 | m_maxX = size.x ; | |
60 | m_maxY = size.y ; | |
61 | ||
519cb848 SC |
62 | MacSetupPort() ; |
63 | m_ok = TRUE ; | |
0a67a93b | 64 | SetBackground(wxBrush(the_canvas->GetBackgroundColour(), wxSOLID)); |
519cb848 | 65 | } |
e9576ca5 | 66 | |
2f1ae414 | 67 | wxWindowDC::~wxWindowDC() |
e9576ca5 | 68 | { |
519cb848 | 69 | } |
e9576ca5 | 70 | |
519cb848 SC |
71 | /* |
72 | * wxClientDC | |
73 | */ | |
e9576ca5 | 74 | |
2f1ae414 | 75 | wxClientDC::wxClientDC() |
e9576ca5 | 76 | { |
e9576ca5 SC |
77 | } |
78 | ||
519cb848 | 79 | wxClientDC::wxClientDC(wxWindow *window) |
e9576ca5 | 80 | { |
519cb848 SC |
81 | WindowRef windowref ; |
82 | wxWindow* rootwindow ; | |
83 | ||
84 | window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow ); | |
85 | m_macPort = UMAGetWindowPort( windowref ) ; | |
86 | MacSetupPort() ; | |
2f1ae414 SC |
87 | m_minY = m_minX = 0; |
88 | wxSize size = window->GetSize() ; | |
89 | m_maxX = size.x ; | |
90 | m_maxY = size.y ; | |
519cb848 | 91 | m_ok = TRUE ; |
7c74e7fe SC |
92 | SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID)); |
93 | SetFont( window->GetFont() ) ; | |
e9576ca5 SC |
94 | } |
95 | ||
2f1ae414 | 96 | wxClientDC::~wxClientDC() |
e9576ca5 | 97 | { |
e9576ca5 SC |
98 | } |
99 | ||
519cb848 SC |
100 | /* |
101 | * wxPaintDC | |
102 | */ | |
e9576ca5 | 103 | |
2f1ae414 | 104 | wxPaintDC::wxPaintDC() |
e9576ca5 | 105 | { |
e9576ca5 SC |
106 | } |
107 | ||
519cb848 | 108 | wxPaintDC::wxPaintDC(wxWindow *window) |
e9576ca5 | 109 | { |
519cb848 SC |
110 | WindowRef windowref ; |
111 | wxWindow* rootwindow ; | |
112 | ||
113 | window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow ); | |
e9576ca5 | 114 | |
519cb848 SC |
115 | m_macPort = UMAGetWindowPort( windowref ) ; |
116 | MacSetupPort() ; | |
117 | m_ok = TRUE ; | |
03e11df5 | 118 | wxCoord x , y ,w , h ; |
519cb848 | 119 | window->GetUpdateRegion().GetBox( x , y , w , h ) ; |
2f1ae414 SC |
120 | m_minY = m_minX = 0; |
121 | wxSize size = window->GetSize() ; | |
122 | m_maxX = size.x ; | |
123 | m_maxY = size.y ; | |
519cb848 SC |
124 | SetClippingRegion( x , y , w , h ) ; |
125 | SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID)); | |
7c74e7fe | 126 | SetFont(window->GetFont() ) ; |
e9576ca5 SC |
127 | } |
128 | ||
519cb848 | 129 | wxPaintDC::~wxPaintDC() |
e9576ca5 | 130 | { |
519cb848 | 131 | } |