]> git.saurik.com Git - wxWidgets.git/blame - src/mac/dcclient.cpp
compilation fix for wxUSE_DYNLOAD
[wxWidgets.git] / src / mac / dcclient.cpp
CommitLineData
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
33IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
34IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
35IMPLEMENT_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 44wxWindowDC::wxWindowDC()
e9576ca5 45{
519cb848 46}
e9576ca5 47
2f1ae414 48wxWindowDC::wxWindowDC(wxWindow *the_canvas)
519cb848 49{
de043984
SC
50 wxTopLevelWindowMac* rootwindow = the_canvas->MacGetTopLevelWindow() ;
51 WindowRef windowref = rootwindow->MacGetWindowRef() ;
519cb848 52
de043984
SC
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 ) ;
7d9d1fd7 59 OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
c59ceaaa 60 CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
519cb848 61 m_macPort = UMAGetWindowPort( windowref ) ;
2f1ae414
SC
62 m_minY = m_minX = 0;
63 wxSize size = the_canvas->GetSize() ;
64 m_maxX = size.x ;
65 m_maxY = size.y ;
66
519cb848 67 m_ok = TRUE ;
40d60178 68 SetBackground(the_canvas->MacGetBackgroundBrush());
519cb848 69}
e9576ca5 70
2f1ae414 71wxWindowDC::~wxWindowDC()
e9576ca5 72{
519cb848 73}
e9576ca5 74
519cb848
SC
75/*
76 * wxClientDC
77 */
e9576ca5 78
2f1ae414 79wxClientDC::wxClientDC()
e9576ca5 80{
e9576ca5
SC
81}
82
519cb848 83wxClientDC::wxClientDC(wxWindow *window)
e9576ca5 84{
de043984
SC
85 wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
86 WindowRef windowref = rootwindow->MacGetWindowRef() ;
40d60178 87 wxPoint origin = window->GetClientAreaOrigin() ;
de043984
SC
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 ) ;
40d60178
SC
96 SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
97 OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
7d9d1fd7 98 OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
c59ceaaa 99 CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
519cb848 100 m_macPort = UMAGetWindowPort( windowref ) ;
2f1ae414 101 m_minY = m_minX = 0;
2f1ae414
SC
102 m_maxX = size.x ;
103 m_maxY = size.y ;
519cb848 104 m_ok = TRUE ;
40d60178 105 SetBackground(window->MacGetBackgroundBrush());
7c74e7fe 106 SetFont( window->GetFont() ) ;
e9576ca5
SC
107}
108
2f1ae414 109wxClientDC::~wxClientDC()
e9576ca5 110{
e9576ca5
SC
111}
112
519cb848
SC
113/*
114 * wxPaintDC
115 */
e9576ca5 116
2f1ae414 117wxPaintDC::wxPaintDC()
e9576ca5 118{
e9576ca5
SC
119}
120
519cb848 121wxPaintDC::wxPaintDC(wxWindow *window)
e9576ca5 122{
de043984
SC
123 wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
124 WindowRef windowref = rootwindow->MacGetWindowRef() ;
40d60178 125 wxPoint origin = window->GetClientAreaOrigin() ;
de043984
SC
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 ) ;
40d60178
SC
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 ) ;
7d9d1fd7 137 OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
c59ceaaa 138 CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
519cb848 139 m_macPort = UMAGetWindowPort( windowref ) ;
2f1ae414 140 m_minY = m_minX = 0;
2f1ae414
SC
141 m_maxX = size.x ;
142 m_maxY = size.y ;
de043984 143 m_ok = TRUE ;
40d60178 144 SetBackground(window->MacGetBackgroundBrush());
de043984 145 SetFont( window->GetFont() ) ;
e9576ca5
SC
146}
147
519cb848 148wxPaintDC::~wxPaintDC()
e9576ca5 149{
519cb848 150}