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