]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/dc.cpp
Applied patch [ 694561 ] FL Release build DLL include path
[wxWidgets.git] / src / cocoa / dc.cpp
CommitLineData
a24aff65
DE
1/////////////////////////////////////////////////////////////////////////////
2// Name: dc.cpp
3// Purpose: wxDC 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 "dc.h"
14#endif
15
16#include "wx/dc.h"
17#include "wx/bitmap.h"
18#include "wx/log.h"
19
20#if !USE_SHARED_LIBRARY
21IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
22#endif
23
24//-----------------------------------------------------------------------------
25// constants
26//-----------------------------------------------------------------------------
27
28#define mm2inches 0.0393700787402
29#define inches2mm 25.4
30#define mm2twips 56.6929133859
31#define twips2mm 0.0176388888889
32#define mm2pt 2.83464566929
33#define pt2mm 0.352777777778
34
35//-----------------------------------------------------------------------------
36// wxDC
37//-----------------------------------------------------------------------------
38
39wxDC::wxDC(void)
40{
41 m_ok = FALSE;
42 m_colour = TRUE;
43 m_clipping = FALSE;
44
45 m_logicalOriginX = 0;
46 m_logicalOriginY = 0;
47 m_deviceOriginX = 0;
48 m_deviceOriginY = 0;
49
50 m_logicalScaleX = 1.0;
51 m_logicalScaleY = 1.0;
52 m_userScaleX = 1.0;
53 m_userScaleY = 1.0;
54 m_scaleX = 1.0;
55 m_scaleY = 1.0;
56
57 m_mappingMode = wxMM_TEXT;
58
59 m_signX = 1; // default x-axis left to right
60 m_signY = 1; // default y-axis top down
61
62 m_maxX = m_maxY = -100000;
63 m_minY = m_minY = 100000;
64
65 m_logicalFunction = wxCOPY;
66// m_textAlignment = wxALIGN_TOP_LEFT;
67 m_backgroundMode = wxTRANSPARENT;
68
69 m_textForegroundColour = *wxBLACK;
70 m_textBackgroundColour = *wxWHITE;
71 m_pen = *wxBLACK_PEN;
72 m_font = *wxNORMAL_FONT;
73 m_brush = *wxTRANSPARENT_BRUSH;
74 m_backgroundBrush = *wxWHITE_BRUSH;
75
76// m_palette = wxAPP_COLOURMAP;
77};
78
79wxDC::~wxDC(void)
80{
81};
82
83void wxDC::DoDrawIcon( const wxIcon &WXUNUSED(icon), int WXUNUSED(x), int WXUNUSED(y) )
84{
85};
86
87void wxDC::DoDrawPoint( int x, int y )
88{
89};
90
91void wxDC::DoDrawPolygon( int, wxPoint *, int, int, int)
92{
93};
94
95void wxDC::DoDrawLines( int, wxPoint *, int, int )
96{
97}
98
99void wxDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
100{
101}
102
103int wxDC::GetDepth() const
104{
105 return 0;
106}
107
108wxSize wxDC::GetPPI() const
109{
110 return wxSize(0,0);
111}
112
113bool wxDC::CanGetTextExtent() const
114{
115 return false;
116}
117
118void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, wxCoord *descent, wxCoord *externalLeading, wxFont *theFont) const
119{
120 wxLogDebug("wxDC::DoGetTextExtent(%s)",string.c_str());
121 if(x)
122 *x=0;
123 if(y)
124 *y=0;
125 if(descent)
126 *descent=0;
127 if(externalLeading)
128 *externalLeading=0;
129}
130
131wxCoord wxDC::GetCharHeight() const
132{
133 return 0;
134}
135
136wxCoord wxDC::GetCharWidth() const
137{
138 return 0;
139}
140
141bool wxDC::CanDrawBitmap() const
142{
143 return false;
144}
145
146bool wxDC::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const
147{
148 return false;
149}
150
151void wxDC::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc)
152{
153}
154
155void wxDC::SetPen(const wxPen& pen)
156{
157}
158
159void wxDC::SetBrush(const wxBrush& brush)
160{
161}
162
163void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region)
164{
165}
166
167void wxDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
168{
169}
170
171void wxDC::DestroyClippingRegion()
172{
173}
174
175void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
176{
177}
178
179void wxDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle)
180{
181}
182
183void wxDC::DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea)
184{
185}
186
187void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
188{
189}
190
191void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
192{
193}
194
195void wxDC::DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask)
196{
197}
198
199bool wxDC::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, int style)
200{
201 return false;
202}
203
204void wxDC::DoCrossHair(wxCoord x, wxCoord y)
205{
206}
207
208void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
209{
210}
211
212
213bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop, bool useMask , wxCoord xsrcMask, wxCoord ysrcMask)
214{
215 return false;
216}
217
218void wxDC::DoGetSize( int* width, int* height ) const
219{
220 *width = m_maxX-m_minX;
221 *height = m_maxY-m_minY;
222};
223
224void wxDC::DoGetSizeMM( int* width, int* height ) const
225{
226 int w = 0;
227 int h = 0;
228 GetSize( &w, &h );
229};
230
231void wxDC::SetTextForeground( const wxColour &col )
232{
233 if (!Ok()) return;
234 m_textForegroundColour = col;
235};
236
237void wxDC::SetTextBackground( const wxColour &col )
238{
239 if (!Ok()) return;
240 m_textBackgroundColour = col;
241};
242
243void wxDC::Clear()
244{
245}
246
247void wxDC::SetBackground(const wxBrush&)
248{
249}
250
251void wxDC::SetPalette(const wxPalette&)
252{
253}
254
255void wxDC::SetLogicalFunction(int)
256{
257}
258
259
260void wxDC::SetMapMode( int mode )
261{
262 switch (mode)
263 {
264 case wxMM_TWIPS:
265 break;
266 case wxMM_POINTS:
267 break;
268 case wxMM_METRIC:
269 break;
270 case wxMM_LOMETRIC:
271 break;
272 default:
273 case wxMM_TEXT:
274 SetLogicalScale( 1.0, 1.0 );
275 break;
276 };
277 if (mode != wxMM_TEXT)
278 {
279 };
280};
281
282void wxDC::SetUserScale( double x, double y )
283{
284 // allow negative ? -> no
285 m_userScaleX = x;
286 m_userScaleY = y;
287 ComputeScaleAndOrigin();
288};
289
290void wxDC::SetLogicalScale( double x, double y )
291{
292 // allow negative ?
293 m_logicalScaleX = x;
294 m_logicalScaleY = y;
295 ComputeScaleAndOrigin();
296};
297
298void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y )
299{
300 m_logicalOriginX = x * m_signX; // is this still correct ?
301 m_logicalOriginY = y * m_signY;
302 ComputeScaleAndOrigin();
303};
304
305void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
306{
307 ComputeScaleAndOrigin();
308};
309
310void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
311{
312 m_signX = (xLeftRight ? 1 : -1);
313 m_signY = (yBottomUp ? -1 : 1);
314 ComputeScaleAndOrigin();
315};
316
317void wxDC::ComputeScaleAndOrigin(void)
318{
319 // CMB: copy scale to see if it changes
320 double origScaleX = m_scaleX;
321 double origScaleY = m_scaleY;
322
323 m_scaleX = m_logicalScaleX * m_userScaleX;
324 m_scaleY = m_logicalScaleY * m_userScaleY;
325
326 // CMB: if scale has changed call SetPen to recalulate the line width
327 if (m_scaleX != origScaleX || m_scaleY != origScaleY)
328 {
329 // this is a bit artificial, but we need to force wxDC to think
330 // the pen has changed
331 wxPen* pen = & GetPen();
332 wxPen tempPen;
333 m_pen = tempPen;
334 SetPen(* pen);
335 }
336};
337
338int wxDCBase::DeviceToLogicalX(int x) const
339{
340 return x;
341}
342
343int wxDCBase::DeviceToLogicalY(int y) const
344{
345 return y;
346}
347
348// vim:sts=4:sw=4:et