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