]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_dc.i
updated Joystick demo, is now wxDesigner-less
[wxWidgets.git] / wxPython / src / _dc.i
CommitLineData
d14a1e28
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: _dc.i
3// Purpose: SWIG interface defs for wxDC and releated classes
4//
5// Author: Robin Dunn
6//
7// Created: 7-July-1997
8// RCS-ID: $Id$
9// Copyright: (c) 2003 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15
4942342c 16
d14a1e28
RD
17//---------------------------------------------------------------------------
18
19%{
20#include "wx/wxPython/pydrawxxx.h"
21%}
22
23// TODO: 1. wrappers for wxDrawObject and wxDC::DrawObject
24
25
26//---------------------------------------------------------------------------
27
28%typemap(in) (int points, wxPoint* points_array ) {
29 $2 = wxPoint_LIST_helper($input, &$1);
30 if ($2 == NULL) SWIG_fail;
31}
32%typemap(freearg) (int points, wxPoint* points_array ) {
33 if ($2) delete [] $2;
34}
35
36
37//---------------------------------------------------------------------------
38%newgroup;
39
40
41// wxDC is the device context - object on which any drawing is done
42class wxDC : public wxObject {
43public:
44// wxDC(); **** abstract base class, can't instantiate.
45 ~wxDC();
46
47
48 virtual void BeginDrawing();
49 virtual void EndDrawing();
50
51
52// virtual void DrawObject(wxDrawObject* drawobject);
53
54
55
4942342c 56#if defined(wxUSE_DC_OLD_METHODS)
d14a1e28
RD
57
58 bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
59 //bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const;
60 %extend {
61 wxColour GetPixel(wxCoord x, wxCoord y) {
62 wxColour col;
63 self->GetPixel(x, y, &col);
64 return col;
65 }
66 }
67 void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
68 void CrossHair(wxCoord x, wxCoord y);
69 void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
70 void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
71 void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea);
72 void DrawPoint(wxCoord x, wxCoord y);
73 void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
74 %name(DrawRectangleRect)void DrawRectangle(const wxRect& rect);
75 void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius);
76 void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
77 void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
78 void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
dd9f7fea 79 void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = False);
d14a1e28
RD
80 void DrawText(const wxString& text, wxCoord x, wxCoord y);
81 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
82 bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
83 wxDC *source, wxCoord xsrc, wxCoord ysrc,
dd9f7fea 84 int rop = wxCOPY, bool useMask = False,
d14a1e28
RD
85 wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
86
87
88
89#else // The new way
4942342c 90
d14a1e28
RD
91 %name(FloodFillXY) bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
92 bool FloodFill(const wxPoint& pt, const wxColour& col, int style = wxFLOOD_SURFACE);
93
94 //%name(GetPixelXY) bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const;
95 //bool GetPixel(const wxPoint& pt, wxColour *col) const;
96 %extend {
97 wxColour GetPixelXY(wxCoord x, wxCoord y) {
98 wxColour col;
99 self->GetPixel(x, y, &col);
100 return col;
101 }
102 wxColour GetPixel(const wxPoint& pt) {
103 wxColour col;
104 self->GetPixel(pt, &col);
105 return col;
106 }
107 }
108 %name(DrawLineXY) void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
109 void DrawLine(const wxPoint& pt1, const wxPoint& pt2);
110
111 %name(CrossHairXY) void CrossHair(wxCoord x, wxCoord y);
112 void CrossHair(const wxPoint& pt);
113
114 %name(DrawArcXY) void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
115 void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre);
116
117 %name(DrawCheckMarkXY) void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
118 void DrawCheckMark(const wxRect& rect);
119
120 %name(DrawEllipticArcXY) void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea);
121 void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, double sa, double ea);
122
123 %name(DrawPointXY) void DrawPoint(wxCoord x, wxCoord y);
124 void DrawPoint(const wxPoint& pt);
125
126 %name(DrawRectangleXY) void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
127 void DrawRectangle(const wxPoint& pt, const wxSize& sz);
128 %name(DrawRectangleRect) void DrawRectangle(const wxRect& rect);
129
130 %name(DrawRoundedRectangleXY) void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius);
131 void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius);
132 %name(DrawRoundedRectangleRect) void DrawRoundedRectangle(const wxRect& r, double radius);
133
134 %name(DrawCircleXY) void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
135 void DrawCircle(const wxPoint& pt, wxCoord radius);
136
137 %name(DrawEllipseXY) void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
138 void DrawEllipse(const wxPoint& pt, const wxSize& sz);
139 %name(DrawEllipseRect) void DrawEllipse(const wxRect& rect);
140
141 %name(DrawIconXY) void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
142 void DrawIcon(const wxIcon& icon, const wxPoint& pt);
143
dd9f7fea
RD
144 %name(DrawBitmapXY) void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = False);
145 void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, bool useMask = False);
d14a1e28
RD
146
147 %name(DrawTextXY) void DrawText(const wxString& text, wxCoord x, wxCoord y);
148 void DrawText(const wxString& text, const wxPoint& pt);
149
150 %name(DrawRotatedTextXY) void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
151 void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle);
152
4942342c 153
d14a1e28
RD
154 %name(BlitXY) bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
155 wxDC *source, wxCoord xsrc, wxCoord ysrc,
dd9f7fea 156 int rop = wxCOPY, bool useMask = False,
d14a1e28 157 wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
4942342c 158 bool Blit(const wxPoint& destPt, const wxSize& sz,
d14a1e28 159 wxDC *source, const wxPoint& srcPt,
dd9f7fea 160 int rop = wxCOPY, bool useMask = False,
d14a1e28
RD
161 const wxPoint& srcPtMask = wxDefaultPosition);
162
163#endif
4942342c 164
d14a1e28
RD
165 void DrawLines(int points, wxPoint* points_array, wxCoord xoffset = 0, wxCoord yoffset = 0);
166
167 void DrawPolygon(int points, wxPoint* points_array,
168 wxCoord xoffset = 0, wxCoord yoffset = 0,
169 int fillStyle = wxODDEVEN_RULE);
170
171
172 // this version puts both optional bitmap and the text into the given
173 // rectangle and aligns is as specified by alignment parameter; it also
174 // will emphasize the character with the given index if it is != -1 and
175 // return the bounding rectangle if required
176 void DrawLabel(const wxString& text, const wxRect& rect,
177 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
178 int indexAccel = -1);
179 %extend {
180 wxRect DrawImageLabel(const wxString& text,
181 const wxBitmap& image,
182 const wxRect& rect,
183 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
184 int indexAccel = -1) {
185 wxRect rv;
186 self->DrawLabel(text, image, rect, alignment, indexAccel, &rv);
187 return rv;
188 }
189 }
190
191
192
193 void DrawSpline(int points, wxPoint* points_array);
194
195
4942342c 196
d14a1e28
RD
197 // global DC operations
198 // --------------------
199
200 virtual void Clear();
201
202 virtual bool StartDoc(const wxString& message);
203 virtual void EndDoc();
204
205 virtual void StartPage();
206 virtual void EndPage();
207
4942342c 208
d14a1e28
RD
209 // set objects to use for drawing
210 // ------------------------------
211
212 virtual void SetFont(const wxFont& font);
213 virtual void SetPen(const wxPen& pen);
214 virtual void SetBrush(const wxBrush& brush);
215 virtual void SetBackground(const wxBrush& brush);
216 virtual void SetBackgroundMode(int mode);
217 virtual void SetPalette(const wxPalette& palette);
218
4942342c 219
d14a1e28
RD
220 // clipping region
221 // ---------------
222
4da6d35e
RD
223 %name(SetClippingRegionXY)void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
224 void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
d14a1e28
RD
225 %name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
226 %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
227
228 virtual void DestroyClippingRegion();
229
322913ce
RD
230 DocDeclA(
231 void, GetClippingBox(wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT) const,
232 "GetClippingBox() -> (x, y, width, height)");
4942342c 233
d14a1e28
RD
234 %extend {
235 wxRect GetClippingRect() {
236 wxRect rect;
237 self->GetClippingBox(rect);
238 return rect;
239 }
240 }
d14a1e28 241
4942342c
RD
242
243
d14a1e28
RD
244 // text extent
245 // -----------
246
247 virtual wxCoord GetCharHeight() const;
248 virtual wxCoord GetCharWidth() const;
249
d14a1e28 250
322913ce
RD
251 DocDeclAStr(
252 void, GetTextExtent(const wxString& string, wxCoord *OUTPUT, wxCoord *OUTPUT),
253 "GetTextExtent(wxString string) -> (width, height)",
254 "Get the width and height of the text using the current font.\n"
255 "Only works for single line strings.");
256 DocDeclAStrName(
257 void, GetTextExtent(const wxString& string,
4942342c 258 wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord* OUTPUT,
322913ce
RD
259 wxFont* font = NULL),
260 "GetFullTextExtent(wxString string, Font font=None) ->\n (width, height, descent, externalLeading)",
261 "Get the width, height, decent and leading of the text using the current or specified font.\n"
262 "Only works for single line strings.",
263 GetFullTextExtent);
264
4942342c 265
322913ce
RD
266 // works for single as well as multi-line strings
267 DocDeclAStr(
268 void, GetMultiLineTextExtent(const wxString& text,
269 wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT,
270 wxFont *font = NULL),
271 "GetMultiLineTextExtent(wxString string, Font font=None) ->\n (width, height, descent, externalLeading)",
272 "Get the width, height, decent and leading of the text using the current or specified font.\n"
273 "Works for single as well as multi-line strings.");
274
d14a1e28
RD
275
276 // size and resolution
277 // -------------------
278
322913ce 279 DocStr(GetSize, "Get the DC size in device units.");
d14a1e28 280 wxSize GetSize();
322913ce
RD
281 DocDeclAName(
282 void, GetSize( int *OUTPUT, int *OUTPUT ),
283 "GetSizeTuple() -> (width, height)",
284 GetSizeTuple);
4942342c 285
d14a1e28 286
322913ce 287 DocStr(GetSizeMM, "Get the DC size in milimeters.");
d14a1e28 288 wxSize GetSizeMM() const;
322913ce
RD
289 DocDeclAName(
290 void, GetSizeMM( int *OUTPUT, int *OUTPUT ) const,
291 "GetSizeMMTuple() -> (width, height)",
292 GetSizeMMTuple);
4942342c
RD
293
294
d14a1e28
RD
295
296 // coordinates conversions
297 // -----------------------
298
299 // This group of functions does actual conversion of the input, as you'd
300 // expect.
301 wxCoord DeviceToLogicalX(wxCoord x) const;
302 wxCoord DeviceToLogicalY(wxCoord y) const;
303 wxCoord DeviceToLogicalXRel(wxCoord x) const;
304 wxCoord DeviceToLogicalYRel(wxCoord y) const;
305 wxCoord LogicalToDeviceX(wxCoord x) const;
306 wxCoord LogicalToDeviceY(wxCoord y) const;
307 wxCoord LogicalToDeviceXRel(wxCoord x) const;
308 wxCoord LogicalToDeviceYRel(wxCoord y) const;
309
310 // query DC capabilities
311 // ---------------------
312
313 virtual bool CanDrawBitmap() const;
314 virtual bool CanGetTextExtent() const;
315
316 // colour depth
317 virtual int GetDepth() const;
318
319 // Resolution in Pixels per inch
320 virtual wxSize GetPPI() const;
321
322 virtual bool Ok() const;
323
4942342c 324
d14a1e28
RD
325
326 int GetBackgroundMode() const;
327 const wxBrush& GetBackground() const;
328 const wxBrush& GetBrush() const;
329 const wxFont& GetFont() const;
330 const wxPen& GetPen() const;
331 const wxColour& GetTextBackground() const;
332 const wxColour& GetTextForeground() const;
333
334 virtual void SetTextForeground(const wxColour& colour);
335 virtual void SetTextBackground(const wxColour& colour);
336
337 int GetMapMode() const;
338 virtual void SetMapMode(int mode);
339
4942342c 340
322913ce
RD
341 DocDeclA(
342 virtual void, GetUserScale(double *OUTPUT, double *OUTPUT) const,
343 "GetUserScale() -> (xScale, yScale)");
4942342c 344
d14a1e28
RD
345 virtual void SetUserScale(double x, double y);
346
4942342c 347
322913ce
RD
348 DocDeclA(
349 virtual void, GetLogicalScale(double *OUTPUT, double *OUTPUT),
350 "GetLogicalScale() -> (xScale, yScale)");
351
d14a1e28
RD
352 virtual void SetLogicalScale(double x, double y);
353
322913ce 354
d14a1e28 355 wxPoint GetLogicalOrigin() const;
322913ce
RD
356 DocDeclAName(
357 void, GetLogicalOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const,
358 "GetLogicalOriginTuple() -> (x,y)",
359 GetLogicalOriginTuple);
4942342c 360
d14a1e28
RD
361 virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
362
4942342c 363
d14a1e28 364 wxPoint GetDeviceOrigin() const;
322913ce
RD
365 DocDeclAName(
366 void, GetDeviceOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const,
367 "GetDeviceOriginTuple() -> (x,y)",
368 GetDeviceOriginTuple);
4942342c 369
d14a1e28
RD
370 virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
371
372 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
373
374 int GetLogicalFunction() const;
375 virtual void SetLogicalFunction(int function);
376
377 virtual void SetOptimization(bool opt);
378 virtual bool GetOptimization();
4942342c 379
d14a1e28
RD
380
381 // bounding box
382 // ------------
383
384 virtual void CalcBoundingBox(wxCoord x, wxCoord y);
385 void ResetBoundingBox();
386
387 // Get the final bounding box of the PostScript or Metafile picture.
388 wxCoord MinX() const;
389 wxCoord MaxX() const;
390 wxCoord MinY() const;
391 wxCoord MaxY() const;
392
393
322913ce
RD
394 DocA(GetBoundingBox,
395 "GetBoundingBox() -> (x1,y1, x2,y2)");
d14a1e28
RD
396 %extend {
397 void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
398 // See below for implementation
4942342c 399 }
d14a1e28
RD
400 %pythoncode { def __nonzero__(self): return self.Ok() };
401
402
403
404 %extend { // See drawlist.cpp for impplementaion of these...
405 PyObject* _DrawPointList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
406 {
407 return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes);
408 }
409
410 PyObject* _DrawLineList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
411 {
412 return wxPyDrawXXXList(*self, wxPyDrawXXXLine, pyCoords, pyPens, pyBrushes);
413 }
414
415 PyObject* _DrawRectangleList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
416 {
417 return wxPyDrawXXXList(*self, wxPyDrawXXXRectangle, pyCoords, pyPens, pyBrushes);
418 }
419
420 PyObject* _DrawEllipseList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
421 {
422 return wxPyDrawXXXList(*self, wxPyDrawXXXEllipse, pyCoords, pyPens, pyBrushes);
423 }
424
425 PyObject* _DrawPolygonList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
426 {
427 return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);
428 }
429
430 PyObject* _DrawTextList(PyObject* textList, PyObject* pyPoints,
431 PyObject* foregroundList, PyObject* backgroundList) {
432 return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);
433 }
434 }
435
436 %pythoncode {
437 def DrawPointList(self, points, pens=None):
438 if pens is None:
439 pens = []
440 elif isinstance(pens, wx.Pen):
441 pens = [pens]
442 elif len(pens) != len(points):
443 raise ValueError('points and pens must have same length')
444 return self._DrawPointList(points, pens, [])
445
446
447 def DrawLineList(self, lines, pens=None):
448 if pens is None:
449 pens = []
450 elif isinstance(pens, wx.Pen):
451 pens = [pens]
452 elif len(pens) != len(lines):
453 raise ValueError('lines and pens must have same length')
454 return self._DrawLineList(lines, pens, [])
455
456
457 def DrawRectangleList(self, rectangles, pens=None, brushes=None):
458 if pens is None:
459 pens = []
460 elif isinstance(pens, wx.Pen):
461 pens = [pens]
462 elif len(pens) != len(rectangles):
463 raise ValueError('rectangles and pens must have same length')
464 if brushes is None:
465 brushes = []
466 elif isinstance(brushes, wx.Brush):
467 brushes = [brushes]
468 elif len(brushes) != len(rectangles):
469 raise ValueError('rectangles and brushes must have same length')
470 return self._DrawRectangleList(rectangles, pens, brushes)
471
472
473 def DrawEllipseList(self, ellipses, pens=None, brushes=None):
474 if pens is None:
475 pens = []
476 elif isinstance(pens, wx.Pen):
477 pens = [pens]
478 elif len(pens) != len(ellipses):
479 raise ValueError('ellipses and pens must have same length')
480 if brushes is None:
481 brushes = []
482 elif isinstance(brushes, wx.Brush):
483 brushes = [brushes]
484 elif len(brushes) != len(ellipses):
485 raise ValueError('ellipses and brushes must have same length')
486 return self._DrawEllipseList(ellipses, pens, brushes)
487
488
489 def DrawPolygonList(self, polygons, pens=None, brushes=None):
4942342c
RD
490 %## Note: This does not currently support fill style or offset
491 %## you can always use the non-List version if need be.
d14a1e28
RD
492 if pens is None:
493 pens = []
494 elif isinstance(pens, wx.Pen):
495 pens = [pens]
496 elif len(pens) != len(polygons):
497 raise ValueError('polygons and pens must have same length')
498 if brushes is None:
499 brushes = []
500 elif isinstance(brushes, wx.Brush):
501 brushes = [brushes]
502 elif len(brushes) != len(polygons):
503 raise ValueError('polygons and brushes must have same length')
504 return self._DrawPolygonList(polygons, pens, brushes)
505
506
507 def DrawTextList(self, textList, coords, foregrounds = None, backgrounds = None, fonts = None):
4942342c
RD
508 %## NOTE: this does not currently support changing the font
509 %## Make sure you set Background mode to wxSolid (DC.SetBackgroundMode)
510 %## If you want backgounds to do anything.
d14a1e28
RD
511 if type(textList) == type(''):
512 textList = [textList]
513 elif len(textList) != len(coords):
514 raise ValueError('textlist and coords must have same length')
515 if foregrounds is None:
516 foregrounds = []
fd3f2efe 517 elif isinstance(foregrounds, wx.Colour):
d14a1e28
RD
518 foregrounds = [foregrounds]
519 elif len(foregrounds) != len(coords):
520 raise ValueError('foregrounds and coords must have same length')
521 if backgrounds is None:
522 backgrounds = []
fd3f2efe 523 elif isinstance(backgrounds, wx.Colour):
d14a1e28
RD
524 backgrounds = [backgrounds]
525 elif len(backgrounds) != len(coords):
526 raise ValueError('backgrounds and coords must have same length')
527 return self._DrawTextList(textList, coords, foregrounds, backgrounds)
528 }
529
530};
531
532
533
534%{
535static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
536 *x1 = dc->MinX();
537 *y1 = dc->MinY();
538 *x2 = dc->MaxX();
539 *y2 = dc->MaxY();
540}
541%}
542
543
544//---------------------------------------------------------------------------
545%newgroup
546
547class wxMemoryDC : public wxDC {
548public:
549 wxMemoryDC();
550 %name(MemoryDCFromDC) wxMemoryDC(wxDC* oldDC);
4942342c 551
d14a1e28
RD
552 void SelectObject(const wxBitmap& bitmap);
553};
554
555//---------------------------------------------------------------------------
556%newgroup
557
558class wxBufferedDC : public wxMemoryDC
559{
560public:
4942342c 561 %addtofunc wxBufferedDC( wxDC *dc, const wxBitmap &buffer )
d14a1e28 562 "self._dc = args[0] # save a ref so the other dc will not be deleted before self";
4942342c 563 %addtofunc wxBufferedDC( wxDC *dc, const wxSize &area )
d14a1e28
RD
564 "val._dc = args[0] # save a ref so the other dc will not be deleted before self";
565
566 // Construct a wxBufferedDC using a user supplied buffer.
567 wxBufferedDC( wxDC *dc, const wxBitmap &buffer );
568
569 // Construct a wxBufferedDC with an internal buffer of 'area'
570 // (where area is usually something like the size of the window
571 // being buffered)
572 %name(BufferedDCInternalBuffer) wxBufferedDC( wxDC *dc, const wxSize &area );
573
574 // Blits the buffer to the dc, and detaches the dc from
575 // the buffer. Usually called in the dtor or by the dtor
576 // of derived classes if the BufferedDC must blit before
577 // the derived class (which may own the dc it's blitting
578 // to) is destroyed.
579 void UnMask();
580};
581
582
583class wxBufferedPaintDC : public wxBufferedDC
584{
585public:
586 wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap );
587};
588
589
590//---------------------------------------------------------------------------
591%newgroup
592
593class wxScreenDC : public wxDC {
594public:
595 wxScreenDC();
596
597 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
598 bool StartDrawingOnTop(wxRect* rect = NULL);
599 bool EndDrawingOnTop();
600};
601
602//---------------------------------------------------------------------------
603%newgroup
604
605class wxClientDC : public wxDC {
606public:
607 wxClientDC(wxWindow* win);
608};
609
610//---------------------------------------------------------------------------
611%newgroup
612
613class wxPaintDC : public wxDC {
614public:
615 wxPaintDC(wxWindow* win);
616};
617
618//---------------------------------------------------------------------------
619%newgroup
620
621class wxWindowDC : public wxDC {
622public:
623 wxWindowDC(wxWindow* win);
624};
625
626//---------------------------------------------------------------------------
627%newgroup
628
629class wxMirrorDC : public wxDC
630{
631public:
632 // constructs a mirror DC associated with the given real DC
633 //
dd9f7fea 634 // if mirror parameter is True, all vertical and horizontal coordinates are
d14a1e28
RD
635 // exchanged, otherwise this class behaves in exactly the same way as a
636 // plain DC
637 //
638 wxMirrorDC(wxDC& dc, bool mirror);
639};
640
641//---------------------------------------------------------------------------
642%newgroup
643
644%{
645#include <wx/dcps.h>
646%}
647
648class wxPostScriptDC : public wxDC {
649public:
650 wxPostScriptDC(const wxPrintData& printData);
651// %name(PostScriptDC2)wxPostScriptDC(const wxString& output,
dd9f7fea 652// bool interactive = True,
d14a1e28
RD
653// wxWindow* parent = NULL);
654
655 wxPrintData& GetPrintData();
656 void SetPrintData(const wxPrintData& data);
657
658 static void SetResolution(int ppi);
659 static int GetResolution();
660};
661
662//---------------------------------------------------------------------------
663%newgroup
664
665
666#ifdef __WXMSW__
667
668%{
669#include <wx/metafile.h>
670%}
671
672class wxMetaFile : public wxObject {
673public:
674 wxMetaFile(const wxString& filename = wxPyEmptyString);
675 ~wxMetaFile();
676
677 bool Ok();
678 bool SetClipboard(int width = 0, int height = 0);
679
680 wxSize GetSize();
681 int GetWidth();
682 int GetHeight();
683
684 const wxString& GetFileName() const;
685
686 %pythoncode { def __nonzero__(self): return self.Ok() }
687};
688
689// bool wxMakeMetaFilePlaceable(const wxString& filename,
690// int minX, int minY, int maxX, int maxY, float scale=1.0);
691
692
693class wxMetaFileDC : public wxDC {
694public:
695 wxMetaFileDC(const wxString& filename = wxPyEmptyString,
696 int width = 0, int height = 0,
697 const wxString& description = wxPyEmptyString);
698 wxMetaFile* Close();
699};
700
701
702
703#else // Make some dummies for the other platforms
704
705%{
706class wxMetaFile : public wxObject {
707public:
708 wxMetaFile(const wxString&)
81cfe5e1 709 { wxPyRaiseNotImplemented(); }
d14a1e28
RD
710};
711
712class wxMetaFileDC : public wxClientDC {
713public:
714 wxMetaFileDC(const wxString&, int, int, const wxString&)
81cfe5e1 715 { wxPyRaiseNotImplemented(); }
d14a1e28
RD
716};
717
718%}
719
720class wxMetaFile : public wxObject {
721public:
722 wxMetaFile(const wxString& filename = wxPyEmptyString);
723};
724
725class wxMetaFileDC : public wxDC {
726public:
727 wxMetaFileDC(const wxString& filename = wxPyEmptyString,
728 int width = 0, int height = 0,
729 const wxString& description = wxPyEmptyString);
730};
731
732
733#endif
734
735
736//---------------------------------------------------------------------------
737
738#if defined(__WXMSW__) || defined(__WXMAC__)
739
740class wxPrinterDC : public wxDC {
741public:
742 wxPrinterDC(const wxPrintData& printData);
743// %name(PrinterDC2) wxPrinterDC(const wxString& driver,
744// const wxString& device,
745// const wxString& output,
dd9f7fea 746// bool interactive = True,
d14a1e28
RD
747// int orientation = wxPORTRAIT);
748};
749
750#else
751%{
752class wxPrinterDC : public wxClientDC {
753public:
754 wxPrinterDC(const wxPrintData&)
81cfe5e1 755 { wxPyRaiseNotImplemented(); }
4942342c 756
d14a1e28 757// wxPrinterDC(const wxString&, const wxString&, const wxString&, bool, int)
81cfe5e1 758// { wxPyRaiseNotImplemented(); }
d14a1e28
RD
759};
760%}
4942342c 761
d14a1e28
RD
762class wxPrinterDC : public wxDC {
763public:
764 wxPrinterDC(const wxPrintData& printData);
765// %name(PrinterDC2) wxPrinterDC(const wxString& driver,
766// const wxString& device,
767// const wxString& output,
dd9f7fea 768// bool interactive = True,
d14a1e28
RD
769// int orientation = wxPORTRAIT);
770};
771#endif
772
4942342c
RD
773//---------------------------------------------------------------------------
774//---------------------------------------------------------------------------
775
776// Now define some Python classes that rename the Draw methods to be
777// compatible with the DC Draw methods in 2.4. See also wxPython/_wx.py.
778
779
780%define MAKE_OLD_DC_CLASS(classname)
781 %pythoncode {
782 class classname##_old(classname):
783 """DC class that has methods with 2.4 compatible parameters."""
784 FloodFill = classname.FloodFillXY
785 GetPixel = classname.GetPixelXY
786 DrawLine = classname.DrawLineXY
787 CrossHair = classname.CrossHairXY
788 DrawArc = classname.DrawArcXY
789 DrawCheckMark = classname.DrawCheckMarkXY
790 DrawEllipticArc = classname.DrawEllipticArcXY
791 DrawPoint = classname.DrawPointXY
792 DrawRectangle = classname.DrawRectangleXY
793 DrawRoundedRectangle = classname.DrawRoundedRectangleXY
794 DrawCircle = classname.DrawCircleXY
795 DrawEllipse = classname.DrawEllipseXY
796 DrawIcon = classname.DrawIconXY
797 DrawBitmap = classname.DrawBitmapXY
798 DrawText = classname.DrawTextXY
799 DrawRotatedText = classname.DrawRotatedTextXY
800 Blit = classname.BlitXY
801 }
802%enddef
803
804MAKE_OLD_DC_CLASS(DC);
805MAKE_OLD_DC_CLASS(MemoryDC);
806MAKE_OLD_DC_CLASS(BufferedDC);
807MAKE_OLD_DC_CLASS(BufferedPaintDC);
808MAKE_OLD_DC_CLASS(ScreenDC);
809MAKE_OLD_DC_CLASS(ClientDC);
810MAKE_OLD_DC_CLASS(PaintDC);
811MAKE_OLD_DC_CLASS(WindowDC);
812MAKE_OLD_DC_CLASS(MirrorDC);
813MAKE_OLD_DC_CLASS(PostScriptDC);
814MAKE_OLD_DC_CLASS(MetaFileDC);
815MAKE_OLD_DC_CLASS(PrinterDC);
816
817
d14a1e28 818//---------------------------------------------------------------------------