]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mac/dcclient.cpp
compilation fix for wxUSE_DYNLOAD
[wxWidgets.git] / src / mac / dcclient.cpp
... / ...
CommitLineData
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
33IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
34IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
35IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
36#endif
37
38/*
39 * wxWindowDC
40 */
41
42#include "wx/mac/uma.h"
43
44wxWindowDC::wxWindowDC()
45{
46}
47
48wxWindowDC::wxWindowDC(wxWindow *the_canvas)
49{
50 wxTopLevelWindowMac* rootwindow = the_canvas->MacGetTopLevelWindow() ;
51 WindowRef windowref = rootwindow->MacGetWindowRef() ;
52
53 int x , y ;
54 x = y = 0 ;
55 the_canvas->MacWindowToRootWindow( &x , &y ) ;
56 m_macLocalOrigin.h = x ;
57 m_macLocalOrigin.v = y ;
58 CopyRgn( the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
59 OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
60 CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
61 m_macPort = UMAGetWindowPort( windowref ) ;
62 m_minY = m_minX = 0;
63 wxSize size = the_canvas->GetSize() ;
64 m_maxX = size.x ;
65 m_maxY = size.y ;
66
67 m_ok = TRUE ;
68 SetBackground(the_canvas->MacGetBackgroundBrush());
69}
70
71wxWindowDC::~wxWindowDC()
72{
73}
74
75/*
76 * wxClientDC
77 */
78
79wxClientDC::wxClientDC()
80{
81}
82
83wxClientDC::wxClientDC(wxWindow *window)
84{
85 wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
86 WindowRef windowref = rootwindow->MacGetWindowRef() ;
87 wxPoint origin = window->GetClientAreaOrigin() ;
88 wxSize size = window->GetClientSize() ;
89 int x , y ;
90 x = origin.x ;
91 y = origin.y ;
92 window->MacWindowToRootWindow( &x , &y ) ;
93 m_macLocalOrigin.h = x ;
94 m_macLocalOrigin.v = y ;
95 SetRectRgn( m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
96 SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
97 OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
98 OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
99 CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
100 m_macPort = UMAGetWindowPort( windowref ) ;
101 m_minY = m_minX = 0;
102 m_maxX = size.x ;
103 m_maxY = size.y ;
104 m_ok = TRUE ;
105 SetBackground(window->MacGetBackgroundBrush());
106 SetFont( window->GetFont() ) ;
107}
108
109wxClientDC::~wxClientDC()
110{
111}
112
113/*
114 * wxPaintDC
115 */
116
117wxPaintDC::wxPaintDC()
118{
119}
120
121wxPaintDC::wxPaintDC(wxWindow *window)
122{
123 wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
124 WindowRef windowref = rootwindow->MacGetWindowRef() ;
125 wxPoint origin = window->GetClientAreaOrigin() ;
126 wxSize size = window->GetClientSize() ;
127 int x , y ;
128 x = origin.x ;
129 y = origin.y ;
130 window->MacWindowToRootWindow( &x , &y ) ;
131 m_macLocalOrigin.h = x ;
132 m_macLocalOrigin.v = y ;
133 SetRectRgn( m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
134 SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
135 OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
136 SectRgn( m_macBoundaryClipRgn , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
137 OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
138 CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
139 m_macPort = UMAGetWindowPort( windowref ) ;
140 m_minY = m_minX = 0;
141 m_maxX = size.x ;
142 m_maxY = size.y ;
143 m_ok = TRUE ;
144 SetBackground(window->MacGetBackgroundBrush());
145 SetFont( window->GetFont() ) ;
146}
147
148wxPaintDC::~wxPaintDC()
149{
150}