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