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