]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/dcclient.cpp
ANSI 'C' fix (decs in "for" clauses no longer have any scope outside clause itself)
[wxWidgets.git] / src / mac / carbon / 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 <math.h>
20
21 //-----------------------------------------------------------------------------
22 // constants
23 //-----------------------------------------------------------------------------
24
25 #define RAD2DEG 57.2957795131
26
27 //-----------------------------------------------------------------------------
28 // wxPaintDC
29 //-----------------------------------------------------------------------------
30
31 #if !USE_SHARED_LIBRARY
32 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
33 IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
34 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
35 #endif
36
37 /*
38 * wxWindowDC
39 */
40
41 #include <wx/mac/uma.h>
42
43 wxWindowDC::wxWindowDC()
44 {
45 }
46
47 wxWindowDC::wxWindowDC(wxWindow *the_canvas)
48 {
49 WindowRef windowref ;
50 wxWindow* rootwindow ;
51
52 // this time it is really the full window
53
54 the_canvas->MacGetPortParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
55 m_macPort = UMAGetWindowPort( windowref ) ;
56 m_minY = m_minX = 0;
57 wxSize size = the_canvas->GetSize() ;
58 m_maxX = size.x ;
59 m_maxY = size.y ;
60
61 MacSetupPort() ;
62 m_ok = TRUE ;
63 }
64
65 wxWindowDC::~wxWindowDC()
66 {
67 }
68
69 /*
70 * wxClientDC
71 */
72
73 wxClientDC::wxClientDC()
74 {
75 }
76
77 wxClientDC::wxClientDC(wxWindow *window)
78 {
79 WindowRef windowref ;
80 wxWindow* rootwindow ;
81
82 window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
83 m_macPort = UMAGetWindowPort( windowref ) ;
84 MacSetupPort() ;
85 m_minY = m_minX = 0;
86 wxSize size = window->GetSize() ;
87 m_maxX = size.x ;
88 m_maxY = size.y ;
89 m_ok = TRUE ;
90 SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
91 SetFont( window->GetFont() ) ;
92 }
93
94 wxClientDC::~wxClientDC()
95 {
96 }
97
98 /*
99 * wxPaintDC
100 */
101
102 wxPaintDC::wxPaintDC()
103 {
104 }
105
106 wxPaintDC::wxPaintDC(wxWindow *window)
107 {
108 WindowRef windowref ;
109 wxWindow* rootwindow ;
110
111 window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
112
113 m_macPort = UMAGetWindowPort( windowref ) ;
114 MacSetupPort() ;
115 m_ok = TRUE ;
116 long x , y ,w , h ;
117 window->GetUpdateRegion().GetBox( x , y , w , h ) ;
118 m_minY = m_minX = 0;
119 wxSize size = window->GetSize() ;
120 m_maxX = size.x ;
121 m_maxY = size.y ;
122 SetClippingRegion( x , y , w , h ) ;
123 SetBackground(wxBrush(window->GetBackgroundColour(), wxSOLID));
124 SetFont(window->GetFont() ) ;
125 }
126
127 wxPaintDC::~wxPaintDC()
128 {
129 }