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