]> git.saurik.com Git - wxWidgets.git/blame - src/mac/dcclient.cpp
carbon debugging lib added
[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
SC
49{
50 WindowRef windowref ;
e766c8a9 51 wxWindowMac* rootwindow ;
519cb848
SC
52
53 // this time it is really the full window
ffba56ed
SC
54 Rect clipRect ;
55 the_canvas->MacGetPortParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
56 SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ;
40d60178 57 SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
7d9d1fd7 58 OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
c59ceaaa 59 CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
519cb848 60 m_macPort = UMAGetWindowPort( windowref ) ;
2f1ae414
SC
61 m_minY = m_minX = 0;
62 wxSize size = the_canvas->GetSize() ;
63 m_maxX = size.x ;
64 m_maxY = size.y ;
65
519cb848 66 m_ok = TRUE ;
40d60178 67 SetBackground(the_canvas->MacGetBackgroundBrush());
519cb848 68}
e9576ca5 69
2f1ae414 70wxWindowDC::~wxWindowDC()
e9576ca5 71{
519cb848 72}
e9576ca5 73
519cb848
SC
74/*
75 * wxClientDC
76 */
e9576ca5 77
2f1ae414 78wxClientDC::wxClientDC()
e9576ca5 79{
e9576ca5
SC
80}
81
519cb848 82wxClientDC::wxClientDC(wxWindow *window)
e9576ca5 83{
519cb848 84 WindowRef windowref ;
e766c8a9 85 wxWindowMac* rootwindow ;
519cb848 86
ffba56ed 87 Rect clipRect ;
40d60178
SC
88 wxPoint origin = window->GetClientAreaOrigin() ;
89
ffba56ed 90 window->MacGetPortClientParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
40d60178
SC
91 SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ;
92 SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
93 OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
7d9d1fd7 94 OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
c59ceaaa 95 CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
519cb848 96 m_macPort = UMAGetWindowPort( windowref ) ;
2f1ae414
SC
97 m_minY = m_minX = 0;
98 wxSize size = window->GetSize() ;
99 m_maxX = size.x ;
100 m_maxY = size.y ;
519cb848 101 m_ok = TRUE ;
40d60178 102 SetBackground(window->MacGetBackgroundBrush());
7c74e7fe 103 SetFont( window->GetFont() ) ;
e9576ca5
SC
104}
105
2f1ae414 106wxClientDC::~wxClientDC()
e9576ca5 107{
e9576ca5
SC
108}
109
519cb848
SC
110/*
111 * wxPaintDC
112 */
e9576ca5 113
2f1ae414 114wxPaintDC::wxPaintDC()
e9576ca5 115{
e9576ca5
SC
116}
117
519cb848 118wxPaintDC::wxPaintDC(wxWindow *window)
e9576ca5 119{
519cb848 120 WindowRef windowref ;
e766c8a9 121 wxWindowMac* rootwindow ;
519cb848 122
ffba56ed 123 Rect clipRect ;
40d60178
SC
124 wxPoint origin = window->GetClientAreaOrigin() ;
125
ffba56ed 126 window->MacGetPortClientParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
40d60178
SC
127 SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ;
128 SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
129 OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
130 SectRgn( m_macBoundaryClipRgn , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
7d9d1fd7 131 OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
c59ceaaa 132 CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
519cb848 133 m_macPort = UMAGetWindowPort( windowref ) ;
519cb848 134 m_ok = TRUE ;
a8cd4a3a 135 /*
03e11df5 136 wxCoord x , y ,w , h ;
519cb848 137 window->GetUpdateRegion().GetBox( x , y , w , h ) ;
2f1ae414
SC
138 m_minY = m_minX = 0;
139 wxSize size = window->GetSize() ;
140 m_maxX = size.x ;
141 m_maxY = size.y ;
519cb848 142 SetClippingRegion( x , y , w , h ) ;
a8cd4a3a 143 */
40d60178
SC
144 SetBackground(window->MacGetBackgroundBrush());
145 SetFont(window->GetFont() ) ;
e9576ca5
SC
146}
147
519cb848 148wxPaintDC::~wxPaintDC()
e9576ca5 149{
519cb848 150}