1//---------------------------------------------------------------------------
2// This file is generated by wxPython's SIP generator.  Do not edit by hand.
3//
4// Copyright: (c) 2018 by Total Control Software
5// License:   wxWindows License
6//
7// This file will be included by _core.sip
8//
9//---------------------------------------------------------------------------
10
11//---------------------------------------------------------------------------
12
13enum wxRasterOperationMode
14{
15    wxCLEAR,
16    wxXOR,
17    wxINVERT,
18    wxOR_REVERSE,
19    wxAND_REVERSE,
20    wxCOPY,
21    wxAND,
22    wxAND_INVERT,
23    wxNO_OP,
24    wxNOR,
25    wxEQUIV,
26    wxSRC_INVERT,
27    wxOR_INVERT,
28    wxNAND,
29    wxOR,
30    wxSET
31};
32
33enum wxFloodFillStyle
34{
35    wxFLOOD_SURFACE,
36    wxFLOOD_BORDER
37};
38
39enum wxMappingMode
40{
41    wxMM_TEXT,
42    wxMM_METRIC,
43    wxMM_LOMETRIC,
44    wxMM_TWIPS,
45    wxMM_POINTS
46};
47
48struct wxFontMetrics
49{
50    %Docstring
51        FontMetrics()
52
53        Simple collection of various font metrics.
54    %End
55    %TypeHeaderCode
56        #include <wx/dc.h>
57    %End
58
59    wxFontMetrics();
60
61    int height;
62
63    int ascent;
64
65    int descent;
66
67    int internalLeading;
68
69    int externalLeading;
70
71    int averageWidth;
72
73};  // end of class wxFontMetrics
74
75
76class wxDC : wxObject
77{
78    %Docstring
79        A wxDC is a "device context" onto which graphics and text can be
80        drawn.
81    %End
82    %TypeHeaderCode
83        #include <wx/dc.h>
84    %End
85
86    %TypeCode
87        //--------------------------------------------------------------------------
88        // Name:        src/dc_ex.h
89        // Purpose:     Functions that can quickly draw lists of items on a DC
90        //
91        // Author:      Robin Dunn
92        //
93        // Created:     18-Aug-2012
94        // Copyright:   (c) 2012-2018 by Total Control Software
95        // Licence:     wxWindows license
96        //--------------------------------------------------------------------------
97
98
99        typedef bool (*wxPyDrawListOp_t)(wxDC& dc, PyObject* coords);
100
101        PyObject* wxPyDrawXXXList(wxDC& dc, wxPyDrawListOp_t doDraw,
102                                  PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes);
103
104        bool wxPyDrawXXXPoint(wxDC& dc, PyObject* coords);
105        bool wxPyDrawXXXLine(wxDC& dc, PyObject* coords);
106        bool wxPyDrawXXXRectangle(wxDC& dc, PyObject* coords);
107        bool wxPyDrawXXXEllipse(wxDC& dc, PyObject* coords);
108        bool wxPyDrawXXXPolygon(wxDC& dc, PyObject* coords);
109
110        PyObject* wxPyDrawTextList(wxDC& dc, PyObject* textList, PyObject* pyPoints,
111                                   PyObject* foregroundList, PyObject* backgroundList);
112
113        //--------------------------------------------------------------------------
114
115
116        PyObject* wxPyDrawXXXList(wxDC& dc, wxPyDrawListOp_t doDraw,
117                                  PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
118        {
119            wxPyBlock_t blocked = wxPyBeginBlockThreads();
120
121            bool      isFastSeq  = PyList_Check(pyCoords) || PyTuple_Check(pyCoords);
122            bool      isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
123            bool      isFastBrushes = PyList_Check(pyBrushes) || PyTuple_Check(pyBrushes);
124            int       numObjs = 0;
125            int       numPens = 0;
126            int       numBrushes = 0;
127            wxPen*    pen;
128            wxBrush*  brush;
129            PyObject* obj;
130            PyObject* coords;
131            int       i = 0;
132            PyObject* retval;
133
134            if (!PySequence_Check(pyCoords)) {
135                goto err0;
136            }
137            if (!PySequence_Check(pyPens)) {
138                goto err1;
139            }
140            if (!PySequence_Check(pyBrushes)) {
141                goto err2;
142            }
143            numObjs = PySequence_Length(pyCoords);
144            numPens = PySequence_Length(pyPens);
145            numBrushes = PySequence_Length(pyBrushes);
146            for (i = 0; i < numObjs; i++) {
147                // Use a new pen?
148                if (i < numPens) {
149                    if (isFastPens) {
150                        obj = PySequence_Fast_GET_ITEM(pyPens, i);
151                    }
152                    else {
153                        obj = PySequence_GetItem(pyPens, i);
154                    }
155                    if (! wxPyConvertWrappedPtr(obj, (void **) &pen, "wxPen")) {
156                        if (!isFastPens)
157                            Py_DECREF(obj);
158                        goto err1;
159                    }
160
161                    dc.SetPen(*pen);
162                    if (!isFastPens)
163                        Py_DECREF(obj);
164                }
165                // Use a new brush?
166                if (i < numBrushes) {
167                    if (isFastBrushes) {
168                        obj = PySequence_Fast_GET_ITEM(pyBrushes, i);
169                    }
170                    else {
171                        obj = PySequence_GetItem(pyBrushes, i);
172                    }
173                    if (!wxPyConvertWrappedPtr(obj, (void **) &brush, "wxBrush")) {
174                        if (!isFastBrushes)
175                            Py_DECREF(obj);
176                        goto err2;
177                    }
178
179                    dc.SetBrush(*brush);
180                    if (!isFastBrushes)
181                        Py_DECREF(obj);
182                }
183
184                // Get the Coordinates
185                if (isFastSeq) {
186                    coords = PySequence_Fast_GET_ITEM(pyCoords, i);
187                }
188                else {
189                    coords = PySequence_GetItem(pyCoords, i);
190                }
191
192
193                // call the drawOp
194                bool success = doDraw(dc, coords);
195                if (!isFastSeq)
196                    Py_DECREF(coords);
197
198                if (! success) {
199                    retval = NULL;
200                    goto exit;
201                }
202
203            } // end of main for loop
204
205            Py_INCREF(Py_None);
206            retval = Py_None;
207            goto exit;
208
209
210         err0:
211            PyErr_SetString(PyExc_TypeError, "Expected a sequence of coordinates");
212            retval = NULL;
213            goto exit;
214
215         err1:
216            PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
217            retval = NULL;
218            goto exit;
219
220         err2:
221            PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxBrushes");
222            retval = NULL;
223            goto exit;
224
225
226         exit:
227            wxPyEndBlockThreads(blocked);
228            return retval;
229        }
230
231
232
233        bool wxPyDrawXXXPoint(wxDC& dc, PyObject* coords)
234        {
235            int x, y;
236
237            if (! wxPy2int_seq_helper(coords, &x, &y)) {
238                PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y) sequences.");
239                return false;
240            }
241            dc.DrawPoint(x, y);
242            return true;
243        }
244
245        bool wxPyDrawXXXLine(wxDC& dc, PyObject* coords)
246        {
247            int x1, y1, x2, y2;
248
249            if (! wxPy4int_seq_helper(coords, &x1, &y1, &x2, &y2)) {
250                PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x1,y1, x1,y2) sequences.");
251                return false;
252            }
253            dc.DrawLine(x1,y1, x2,y2);
254            return true;
255        }
256
257        bool wxPyDrawXXXRectangle(wxDC& dc, PyObject* coords)
258        {
259            int x, y, w, h;
260
261            if (! wxPy4int_seq_helper(coords, &x, &y, &w, &h)) {
262                PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y, w,h) sequences.");
263                return false;
264            }
265            dc.DrawRectangle(x, y, w, h);
266            return true;
267        }
268
269        bool wxPyDrawXXXEllipse(wxDC& dc, PyObject* coords)
270        {
271            int x, y, w, h;
272
273            if (! wxPy4int_seq_helper(coords, &x, &y, &w, &h)) {
274                PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y, w,h) sequences.");
275                return false;
276            }
277            dc.DrawEllipse(x, y, w, h);
278            return true;
279        }
280
281
282        wxPoint* wxPoint_LIST_helper(PyObject* source, int *count);
283
284        bool wxPyDrawXXXPolygon(wxDC& dc, PyObject* coords)
285        {
286            wxPoint* points;
287            int numPoints;
288
289            points = wxPoint_LIST_helper(coords, &numPoints);
290            if (! points) {
291                PyErr_SetString(PyExc_TypeError, "Expected a sequence of sequences of (x,y) sequences.");
292                return false;
293            }
294            dc.DrawPolygon(numPoints, points);
295            delete [] points;
296            return true;
297        }
298
299
300        //---------------------------------------------------------------------------
301
302
303
304        PyObject* wxPyDrawTextList(wxDC& dc, PyObject* textList, PyObject* pyPoints, PyObject* foregroundList, PyObject* backgroundList)
305        {
306            wxPyBlock_t blocked = wxPyBeginBlockThreads();
307
308            bool      isFastSeq  = PyList_Check(pyPoints) || PyTuple_Check(pyPoints);
309            bool      isFastText = PyList_Check(textList) || PyTuple_Check(textList);
310            bool      isFastForeground = PyList_Check(foregroundList) || PyTuple_Check(foregroundList);
311            bool      isFastBackground = PyList_Check(backgroundList) || PyTuple_Check(backgroundList);
312            int       numText = 0;
313            int       numPoints = 0;
314            int       numForeground = 0;
315            int       numBackground = 0;
316            PyObject* obj;
317            int       x1, y1;
318            int       i = 0;
319            wxColor*    color;
320            PyObject* retval;
321            wxString  string;
322
323            if (!PySequence_Check(pyPoints)) {
324                goto err0;
325            }
326            if (!PySequence_Check(textList)) {
327                goto err1;
328            }
329            if (!PySequence_Check(foregroundList)) {
330                goto err2;
331            }
332            if (!PySequence_Check(backgroundList)) {
333                goto err3;
334            }
335            numPoints = PySequence_Length(pyPoints);
336            numText = PySequence_Length(textList);
337            numForeground = PySequence_Length(foregroundList);
338            numBackground = PySequence_Length(backgroundList);
339
340            for (i = 0; i < numPoints; i++) {
341                // Use a new string ?
342                if (i < numText) {
343                    if ( isFastText ) {
344                        obj = PySequence_Fast_GET_ITEM(textList, i);
345                    }
346                    else {
347                        obj = PySequence_GetItem(textList, i);
348                    }
349                    if (! PyBytes_Check(obj) && !PyUnicode_Check(obj) ) {
350                        Py_DECREF(obj);
351                        goto err1;
352                    }
353                    string = Py2wxString(obj);
354                    if ( !isFastText )
355                        Py_DECREF(obj);
356                }
357
358                if (i < numForeground) {
359                    // Use a new foreground ?
360                    if ( isFastForeground ) {
361                        obj = PySequence_Fast_GET_ITEM(foregroundList, i);
362                    }
363                    else {
364                        obj = PySequence_GetItem(foregroundList, i);
365                    }
366                    if (! wxPyConvertWrappedPtr(obj, (void **) &color, "wxColour")) {
367                        if (!isFastForeground)
368                            Py_DECREF(obj);
369                        goto err2;
370                    }
371                    dc.SetTextForeground(*color);
372                    if ( !isFastForeground )
373                        Py_DECREF(obj);
374                }
375
376                if (i < numBackground) {
377                    // Use a new background ?
378                    if ( isFastBackground ) {
379                        obj = PySequence_Fast_GET_ITEM(backgroundList, i);
380                    }
381                    else {
382                        obj = PySequence_GetItem(backgroundList, i);
383                    }
384                    if (! wxPyConvertWrappedPtr(obj, (void **) &color, "wxColour")) {
385                        if (!isFastBackground)
386                            Py_DECREF(obj);
387                        goto err3;
388                    }
389                    dc.SetTextBackground(*color);
390                    if ( !isFastBackground )
391                        Py_DECREF(obj);
392                }
393
394                // Get the point coordinates
395                if (isFastSeq) {
396                    obj = PySequence_Fast_GET_ITEM(pyPoints, i);
397                }
398                else {
399                    obj = PySequence_GetItem(pyPoints, i);
400                }
401                if (! wxPy2int_seq_helper(obj, &x1, &y1)) {
402                    if (! isFastSeq)
403                        Py_DECREF(obj);
404                    goto err0;
405                }
406                if (!isFastText)
407                    Py_DECREF(obj);
408
409                if (PyErr_Occurred()) {
410                    retval = NULL;
411                    goto exit;
412                }
413
414                // Now draw the text
415                dc.DrawText(string, x1, y1);
416            }
417
418            Py_INCREF(Py_None);
419            retval = Py_None;
420            goto exit;
421
422         err0:
423            PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y) sequences.");
424            retval = NULL;
425            goto exit;
426         err1:
427            PyErr_SetString(PyExc_TypeError, "Expected a sequence of strings");
428            retval = NULL;
429            goto exit;
430
431         err2:
432            PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxColours for foregrounds");
433            retval = NULL;
434            goto exit;
435
436         err3:
437            PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxColours for backgrounds");
438            retval = NULL;
439            goto exit;
440
441         exit:
442            wxPyEndBlockThreads(blocked);
443            return retval;
444        }
445
446        //---------------------------------------------------------------------------
447
448
449        bool wxPointFromObjects(PyObject* o1, PyObject* o2, wxPoint* point)
450        {
451            // get the x value
452            if (wxPyInt_Check(o1))
453                point->x = (int)wxPyInt_AS_LONG(o1);
454            else if (PyFloat_Check(o1))
455                point->x = (int)PyFloat_AS_DOUBLE(o1);
456            else if (PyNumber_Check(o1))
457                point->x = (int)wxPyInt_AsLong(o1);
458            else
459                return false;
460
461            // get the y value
462            if (wxPyInt_Check(o2))
463                point->y = (int)wxPyInt_AS_LONG(o2);
464            else if (PyFloat_Check(o2))
465                point->y = (int)PyFloat_AS_DOUBLE(o2);
466            else if (PyNumber_Check(o2))
467                point->y = (int)wxPyInt_AsLong(o2);
468            else
469                return false;
470
471            return true;
472        }
473
474
475        wxPoint* wxPoint_LIST_helper(PyObject* source, int *count)
476        {
477            int idx;
478            wxPoint* temp;
479            PyObject *o, *o1, *o2;
480            bool isFast = PyList_Check(source) || PyTuple_Check(source);
481
482            if (!PySequence_Check(source)) {
483                goto error0;
484            }
485
486            // The length of the sequence is returned in count.
487            *count = PySequence_Length(source);
488            if (*count < 0) {
489                goto error0;
490            }
491
492            temp = new wxPoint[*count];
493            if (!temp) {
494                PyErr_SetString(PyExc_MemoryError, "Unable to allocate temporary array");
495                return NULL;
496            }
497            for (idx=0; idx<*count; idx++) {
498                // Get an item: try fast way first.
499                if (isFast) {
500                    o = PySequence_Fast_GET_ITEM(source, idx);
501                }
502                else {
503                    o = PySequence_GetItem(source, idx);
504                    if (o == NULL) {
505                        goto error1;
506                    }
507                }
508
509                // Convert o to wxPoint.
510                if ((PyTuple_Check(o) && PyTuple_GET_SIZE(o) == 2) ||
511                    (PyList_Check(o) && PyList_GET_SIZE(o) == 2)) {
512                    o1 = PySequence_Fast_GET_ITEM(o, 0);
513                    o2 = PySequence_Fast_GET_ITEM(o, 1);
514                    if (!wxPointFromObjects(o1, o2, &temp[idx])) {
515                        goto error2;
516                    }
517                }
518                else if (wxPyWrappedPtr_Check(o)) {
519                    wxPoint* pt;
520                    if (! wxPyConvertWrappedPtr(o, (void **)&pt, "wxPoint")) {
521                        goto error2;
522                    }
523                    temp[idx] = *pt;
524                }
525                else if (PySequence_Check(o) && PySequence_Length(o) == 2) {
526                    o1 = PySequence_GetItem(o, 0);
527                    o2 = PySequence_GetItem(o, 1);
528                    if (!wxPointFromObjects(o1, o2, &temp[idx])) {
529                        goto error3;
530                    }
531                    Py_DECREF(o1);
532                    Py_DECREF(o2);
533                }
534                else {
535                    goto error2;
536                }
537                // Clean up.
538                if (!isFast)
539                    Py_DECREF(o);
540            }
541            return temp;
542
543        error3:
544            Py_DECREF(o1);
545            Py_DECREF(o2);
546        error2:
547            if (!isFast)
548                Py_DECREF(o);
549        error1:
550            delete [] temp;
551        error0:
552            PyErr_SetString(PyExc_TypeError, "Expected a sequence of length-2 sequences or wx.Points.");
553            return NULL;
554        }
555    %End
556public:
557    wxCoord DeviceToLogicalX(
558        wxCoord x
559    ) const;
560    %Docstring
561        DeviceToLogicalX(x) -> Coord
562
563        Convert device X coordinate to logical coordinate, using the current
564        mapping mode, user scale factor, device origin and axis orientation.
565    %End
566
567    wxCoord DeviceToLogicalXRel(
568        wxCoord x
569    ) const;
570    %Docstring
571        DeviceToLogicalXRel(x) -> Coord
572
573        Convert device X coordinate to relative logical coordinate, using the
574        current mapping mode and user scale factor but ignoring the axis
575        orientation.
576    %End
577
578    wxCoord DeviceToLogicalY(
579        wxCoord y
580    ) const;
581    %Docstring
582        DeviceToLogicalY(y) -> Coord
583
584        Converts device Y coordinate to logical coordinate, using the current
585        mapping mode, user scale factor, device origin and axis orientation.
586    %End
587
588    wxCoord DeviceToLogicalYRel(
589        wxCoord y
590    ) const;
591    %Docstring
592        DeviceToLogicalYRel(y) -> Coord
593
594        Convert device Y coordinate to relative logical coordinate, using the
595        current mapping mode and user scale factor but ignoring the axis
596        orientation.
597    %End
598
599    wxCoord LogicalToDeviceX(
600        wxCoord x
601    ) const;
602    %Docstring
603        LogicalToDeviceX(x) -> Coord
604
605        Converts logical X coordinate to device coordinate, using the current
606        mapping mode, user scale factor, device origin and axis orientation.
607    %End
608
609    wxCoord LogicalToDeviceXRel(
610        wxCoord x
611    ) const;
612    %Docstring
613        LogicalToDeviceXRel(x) -> Coord
614
615        Converts logical X coordinate to relative device coordinate, using the
616        current mapping mode and user scale factor but ignoring the axis
617        orientation.
618    %End
619
620    wxCoord LogicalToDeviceY(
621        wxCoord y
622    ) const;
623    %Docstring
624        LogicalToDeviceY(y) -> Coord
625
626        Converts logical Y coordinate to device coordinate, using the current
627        mapping mode, user scale factor, device origin and axis orientation.
628    %End
629
630    wxCoord LogicalToDeviceYRel(
631        wxCoord y
632    ) const;
633    %Docstring
634        LogicalToDeviceYRel(y) -> Coord
635
636        Converts logical Y coordinate to relative device coordinate, using the
637        current mapping mode and user scale factor but ignoring the axis
638        orientation.
639    %End
640
641    void Clear();
642    %Docstring
643        Clear()
644
645        Clears the device context using the current background brush.
646    %End
647
648    void DrawArc(
649        wxCoord xStart,
650        wxCoord yStart,
651        wxCoord xEnd,
652        wxCoord yEnd,
653        wxCoord xc,
654        wxCoord yc
655    );
656    %Docstring
657        DrawArc(xStart, yStart, xEnd, yEnd, xc, yc)
658        DrawArc(ptStart, ptEnd, centre)
659
660        Draws an arc from the given start to the given end point.
661    %End
662
663    void DrawArc(
664        const wxPoint & ptStart,
665        const wxPoint & ptEnd,
666        const wxPoint & centre
667    );
668
669    void DrawBitmap(
670        const wxBitmap & bitmap,
671        wxCoord x,
672        wxCoord y,
673        bool useMask = false
674    );
675    %Docstring
676        DrawBitmap(bitmap, x, y, useMask=False)
677        DrawBitmap(bmp, pt, useMask=False)
678
679        Draw a bitmap on the device context at the specified point.
680    %End
681
682    void DrawBitmap(
683        const wxBitmap & bmp,
684        const wxPoint & pt,
685        bool useMask = false
686    );
687
688    void DrawCheckMark(
689        wxCoord x,
690        wxCoord y,
691        wxCoord width,
692        wxCoord height
693    );
694    %Docstring
695        DrawCheckMark(x, y, width, height)
696        DrawCheckMark(rect)
697
698        Draws a check mark inside the given rectangle.
699    %End
700
701    void DrawCheckMark(
702        const wxRect & rect
703    );
704
705    void DrawCircle(
706        wxCoord x,
707        wxCoord y,
708        wxCoord radius
709    );
710    %Docstring
711        DrawCircle(x, y, radius)
712        DrawCircle(pt, radius)
713
714        Draws a circle with the given centre and radius.
715    %End
716
717    void DrawCircle(
718        const wxPoint & pt,
719        wxCoord radius
720    );
721
722    void DrawEllipse(
723        wxCoord x,
724        wxCoord y,
725        wxCoord width,
726        wxCoord height
727    );
728    %Docstring
729        DrawEllipse(x, y, width, height)
730        DrawEllipse(pt, size)
731        DrawEllipse(rect)
732
733        Draws an ellipse contained in the rectangle specified either with the
734        given top left corner and the given size or directly.
735    %End
736
737    void DrawEllipse(
738        const wxPoint & pt,
739        const wxSize & size
740    );
741
742    void DrawEllipse(
743        const wxRect & rect
744    );
745
746    void DrawEllipticArc(
747        wxCoord x,
748        wxCoord y,
749        wxCoord width,
750        wxCoord height,
751        double start,
752        double end
753    );
754    %Docstring
755        DrawEllipticArc(x, y, width, height, start, end)
756        DrawEllipticArc(pt, sz, sa, ea)
757
758        Draws an arc of an ellipse.
759    %End
760
761    void DrawEllipticArc(
762        const wxPoint & pt,
763        const wxSize & sz,
764        double sa,
765        double ea
766    );
767
768    void DrawIcon(
769        const wxIcon & icon,
770        wxCoord x,
771        wxCoord y
772    );
773    %Docstring
774        DrawIcon(icon, x, y)
775        DrawIcon(icon, pt)
776
777        Draw an icon on the display (does nothing if the device context is
778        PostScript).
779    %End
780
781    void DrawIcon(
782        const wxIcon & icon,
783        const wxPoint & pt
784    );
785
786    wxRect* DrawLabel(
787        const wxString & text,
788        const wxBitmap & bitmap,
789        const wxRect & rect,
790        int alignment = wxALIGN_LEFT|wxALIGN_TOP,
791        int indexAccel = -1
792    )   /Factory/;
793    %Docstring
794        DrawLabel(text, bitmap, rect, alignment=ALIGN_LEFT|ALIGN_TOP, indexAccel=-1) -> Rect
795        DrawLabel(text, rect, alignment=ALIGN_LEFT|ALIGN_TOP, indexAccel=-1)
796
797        Draw optional bitmap and the text into the given rectangle and aligns
798        it as specified by alignment parameter; it also will emphasize the
799        character with the given index if it is != -1 and return the bounding
800        rectangle if required.
801    %End
802    %MethodCode
803        PyErr_Clear();
804        Py_BEGIN_ALLOW_THREADS
805        sipRes = _wxDC_DrawLabel(sipCpp, text, bitmap, rect, alignment, indexAccel);
806        Py_END_ALLOW_THREADS
807        if (PyErr_Occurred()) sipIsErr = 1;
808    %End
809    %TypeCode
810    wxRect* _wxDC_DrawLabel(wxDC* self, const wxString *text, const wxBitmap *bitmap, const wxRect *rect, int alignment, int indexAccel)
811    {
812        wxRect rv;
813        self->DrawLabel(*text, *bitmap, *rect, alignment, indexAccel, &rv);
814        return new wxRect(rv);
815    }
816    %End
817
818    void DrawLabel(
819        const wxString & text,
820        const wxRect & rect,
821        int alignment = wxALIGN_LEFT|wxALIGN_TOP,
822        int indexAccel = -1
823    );
824    %Docstring
825        DrawLabel(text, rect, alignment=ALIGN_LEFT|ALIGN_TOP, indexAccel=-1)
826
827        This is an overloaded member function, provided for convenience. It
828        differs from the above function only in what argument(s) it accepts.
829    %End
830
831    void DrawLine(
832        wxCoord x1,
833        wxCoord y1,
834        wxCoord x2,
835        wxCoord y2
836    );
837    %Docstring
838        DrawLine(x1, y1, x2, y2)
839        DrawLine(pt1, pt2)
840
841        Draws a line from the first point to the second.
842    %End
843
844    void DrawLine(
845        const wxPoint & pt1,
846        const wxPoint & pt2
847    );
848
849    void DrawLines(
850        const wxPointList * points,
851        wxCoord xoffset = 0,
852        wxCoord yoffset = 0
853    );
854    %Docstring
855        DrawLines(points, xoffset=0, yoffset=0)
856
857        This method uses a list of wxPoints, adding the optional offset
858        coordinate.
859    %End
860
861    void DrawPoint(
862        wxCoord x,
863        wxCoord y
864    );
865    %Docstring
866        DrawPoint(x, y)
867        DrawPoint(pt)
868
869        Draws a point using the color of the current pen.
870    %End
871
872    void DrawPoint(
873        const wxPoint & pt
874    );
875
876    void DrawPolygon(
877        const wxPointList * points,
878        wxCoord xoffset = 0,
879        wxCoord yoffset = 0,
880        wxPolygonFillMode fill_style = wxODDEVEN_RULE
881    );
882    %Docstring
883        DrawPolygon(points, xoffset=0, yoffset=0, fill_style=ODDEVEN_RULE)
884
885        This method draws a filled polygon using a list of wxPoints, adding
886        the optional offset coordinate.
887    %End
888
889    void DrawRectangle(
890        wxCoord x,
891        wxCoord y,
892        wxCoord width,
893        wxCoord height
894    );
895    %Docstring
896        DrawRectangle(x, y, width, height)
897        DrawRectangle(pt, sz)
898        DrawRectangle(rect)
899
900        Draws a rectangle with the given top left corner, and with the given
901        size.
902    %End
903
904    void DrawRectangle(
905        const wxPoint & pt,
906        const wxSize & sz
907    );
908
909    void DrawRectangle(
910        const wxRect & rect
911    );
912
913    void DrawRotatedText(
914        const wxString & text,
915        wxCoord x,
916        wxCoord y,
917        double angle
918    );
919    %Docstring
920        DrawRotatedText(text, x, y, angle)
921        DrawRotatedText(text, point, angle)
922
923        Draws the text rotated by angle degrees (positive angles are
924        counterclockwise; the full angle is 360 degrees).
925    %End
926
927    void DrawRotatedText(
928        const wxString & text,
929        const wxPoint & point,
930        double angle
931    );
932
933    void DrawRoundedRectangle(
934        wxCoord x,
935        wxCoord y,
936        wxCoord width,
937        wxCoord height,
938        double radius
939    );
940    %Docstring
941        DrawRoundedRectangle(x, y, width, height, radius)
942        DrawRoundedRectangle(pt, sz, radius)
943        DrawRoundedRectangle(rect, radius)
944
945        Draws a rectangle with the given top left corner, and with the given
946        size.
947    %End
948
949    void DrawRoundedRectangle(
950        const wxPoint & pt,
951        const wxSize & sz,
952        double radius
953    );
954
955    void DrawRoundedRectangle(
956        const wxRect & rect,
957        double radius
958    );
959
960    void DrawSpline(
961        const wxPointList * points
962    );
963    %Docstring
964        DrawSpline(points)
965        DrawSpline(x1, y1, x2, y2, x3, y3)
966
967        This is an overloaded member function, provided for convenience. It
968        differs from the above function only in what argument(s) it accepts.
969    %End
970
971    void DrawSpline(
972        wxCoord x1,
973        wxCoord y1,
974        wxCoord x2,
975        wxCoord y2,
976        wxCoord x3,
977        wxCoord y3
978    );
979
980    void DrawText(
981        const wxString & text,
982        wxCoord x,
983        wxCoord y
984    );
985    %Docstring
986        DrawText(text, x, y)
987        DrawText(text, pt)
988
989        Draws a text string at the specified point, using the current text
990        font, and the current text foreground and background colours.
991    %End
992
993    void DrawText(
994        const wxString & text,
995        const wxPoint & pt
996    );
997
998    void GradientFillConcentric(
999        const wxRect & rect,
1000        const wxColour & initialColour,
1001        const wxColour & destColour
1002    );
1003    %Docstring
1004        GradientFillConcentric(rect, initialColour, destColour)
1005        GradientFillConcentric(rect, initialColour, destColour, circleCenter)
1006
1007        Fill the area specified by rect with a radial gradient, starting from
1008        initialColour at the centre of the circle and fading to destColour on
1009        the circle outside.
1010    %End
1011
1012    void GradientFillConcentric(
1013        const wxRect & rect,
1014        const wxColour & initialColour,
1015        const wxColour & destColour,
1016        const wxPoint & circleCenter
1017    );
1018
1019    void GradientFillLinear(
1020        const wxRect & rect,
1021        const wxColour & initialColour,
1022        const wxColour & destColour,
1023        wxDirection nDirection = wxRIGHT
1024    );
1025    %Docstring
1026        GradientFillLinear(rect, initialColour, destColour, nDirection=RIGHT)
1027
1028        Fill the area specified by rect with a linear gradient, starting from
1029        initialColour and eventually fading to destColour.
1030    %End
1031
1032    bool FloodFill(
1033        wxCoord x,
1034        wxCoord y,
1035        const wxColour & colour,
1036        wxFloodFillStyle style = wxFLOOD_SURFACE
1037    );
1038    %Docstring
1039        FloodFill(x, y, colour, style=FLOOD_SURFACE) -> bool
1040        FloodFill(pt, col, style=FLOOD_SURFACE) -> bool
1041
1042        Flood fills the device context starting from the given point, using
1043        the current brush colour, and using a style:
1044    %End
1045
1046    bool FloodFill(
1047        const wxPoint & pt,
1048        const wxColour & col,
1049        wxFloodFillStyle style = wxFLOOD_SURFACE
1050    );
1051
1052    void CrossHair(
1053        wxCoord x,
1054        wxCoord y
1055    );
1056    %Docstring
1057        CrossHair(x, y)
1058        CrossHair(pt)
1059
1060        Displays a cross hair using the current pen.
1061    %End
1062
1063    void CrossHair(
1064        const wxPoint & pt
1065    );
1066
1067    void DestroyClippingRegion();
1068    %Docstring
1069        DestroyClippingRegion()
1070
1071        Destroys the current clipping region so that none of the DC is
1072        clipped.
1073    %End
1074
1075    void GetClippingBox(
1076        wxCoord * x   /Out/,
1077        wxCoord * y   /Out/,
1078        wxCoord * width   /Out/,
1079        wxCoord * height   /Out/
1080    ) const;
1081    %Docstring
1082        GetClippingBox() -> (x, y, width, height)
1083
1084        Gets the rectangle surrounding the current clipping region.
1085    %End
1086
1087    void SetClippingRegion(
1088        wxCoord x,
1089        wxCoord y,
1090        wxCoord width,
1091        wxCoord height
1092    );
1093    %Docstring
1094        SetClippingRegion(x, y, width, height)
1095        SetClippingRegion(pt, sz)
1096        SetClippingRegion(rect)
1097
1098        Sets the clipping region for this device context to the intersection
1099        of the given region described by the parameters of this method and the
1100        previously set clipping region.
1101    %End
1102
1103    void SetClippingRegion(
1104        const wxPoint & pt,
1105        const wxSize & sz
1106    );
1107
1108    void SetClippingRegion(
1109        const wxRect & rect
1110    );
1111
1112    void SetDeviceClippingRegion(
1113        const wxRegion & region
1114    );
1115    %Docstring
1116        SetDeviceClippingRegion(region)
1117
1118        Sets the clipping region for this device context.
1119    %End
1120
1121    wxCoord GetCharHeight() const;
1122    %Docstring
1123        GetCharHeight() -> Coord
1124
1125        Gets the character height of the currently set font.
1126    %End
1127
1128    wxCoord GetCharWidth() const;
1129    %Docstring
1130        GetCharWidth() -> Coord
1131
1132        Gets the average character width of the currently set font.
1133    %End
1134
1135    wxFontMetrics GetFontMetrics() const;
1136    %Docstring
1137        GetFontMetrics() -> FontMetrics
1138
1139        Returns the various font characteristics.
1140    %End
1141
1142    void GetMultiLineTextExtent(
1143        const wxString & string,
1144        wxCoord * w   /Out/,
1145        wxCoord * h   /Out/,
1146        wxCoord * heightLine   /Out/ = NULL,
1147        const wxFont * font = NULL
1148    ) const   /PyName=GetFullMultiLineTextExtent/;
1149    %Docstring
1150        GetFullMultiLineTextExtent(string, font=None) -> (w, h, heightLine)
1151
1152        Gets the dimensions of the string as it would be drawn.
1153    %End
1154
1155    wxArrayInt* GetPartialTextExtents(
1156        const wxString & text
1157    ) const   /Factory/;
1158    %Docstring
1159        GetPartialTextExtents(text) -> ArrayInt
1160
1161        Fills the widths array with the widths from the beginning of text to
1162        the corresponding character of text.
1163    %End
1164    %MethodCode
1165        PyErr_Clear();
1166        Py_BEGIN_ALLOW_THREADS
1167        sipRes = _wxDC_GetPartialTextExtents(sipCpp, text);
1168        Py_END_ALLOW_THREADS
1169        if (PyErr_Occurred()) sipIsErr = 1;
1170    %End
1171    %TypeCode
1172    wxArrayInt* _wxDC_GetPartialTextExtents(const wxDC* self, const wxString *text)
1173    {
1174        wxArrayInt rval;
1175        self->GetPartialTextExtents(*text, rval);
1176        return new wxArrayInt(rval);
1177    }
1178    %End
1179
1180    void GetTextExtent(
1181        const wxString & string,
1182        wxCoord * w   /Out/,
1183        wxCoord * h   /Out/,
1184        wxCoord * descent   /Out/ = NULL,
1185        wxCoord * externalLeading   /Out/ = NULL,
1186        const wxFont * font = NULL
1187    ) const   /PyName=GetFullTextExtent/;
1188    %Docstring
1189        GetFullTextExtent(string, font=None) -> (w, h, descent, externalLeading)
1190
1191        Gets the dimensions of the string as it would be drawn.
1192    %End
1193
1194    int GetBackgroundMode() const;
1195    %Docstring
1196        GetBackgroundMode() -> int
1197
1198        Returns the current background mode: wxSOLID or wxTRANSPARENT.
1199    %End
1200
1201    const wxFont & GetFont() const;
1202    %Docstring
1203        GetFont() -> Font
1204
1205        Gets the current font.
1206    %End
1207
1208    wxLayoutDirection GetLayoutDirection() const;
1209    %Docstring
1210        GetLayoutDirection() -> LayoutDirection
1211
1212        Gets the current layout direction of the device context.
1213    %End
1214
1215    const wxColour & GetTextBackground() const;
1216    %Docstring
1217        GetTextBackground() -> Colour
1218
1219        Gets the current text background colour.
1220    %End
1221
1222    const wxColour & GetTextForeground() const;
1223    %Docstring
1224        GetTextForeground() -> Colour
1225
1226        Gets the current text foreground colour.
1227    %End
1228
1229    void SetBackgroundMode(
1230        int mode
1231    );
1232    %Docstring
1233        SetBackgroundMode(mode)
1234
1235        mode may be one of wxSOLID and wxTRANSPARENT.
1236    %End
1237
1238    void SetFont(
1239        const wxFont & font
1240    );
1241    %Docstring
1242        SetFont(font)
1243
1244        Sets the current font for the DC.
1245    %End
1246
1247    void SetTextBackground(
1248        const wxColour & colour
1249    );
1250    %Docstring
1251        SetTextBackground(colour)
1252
1253        Sets the current text background colour for the DC.
1254    %End
1255
1256    void SetTextForeground(
1257        const wxColour & colour
1258    );
1259    %Docstring
1260        SetTextForeground(colour)
1261
1262        Sets the current text foreground colour for the DC.
1263    %End
1264
1265    void SetLayoutDirection(
1266        wxLayoutDirection dir
1267    );
1268    %Docstring
1269        SetLayoutDirection(dir)
1270
1271        Sets the current layout direction for the device context.
1272    %End
1273
1274    void CalcBoundingBox(
1275        wxCoord x,
1276        wxCoord y
1277    );
1278    %Docstring
1279        CalcBoundingBox(x, y)
1280
1281        Adds the specified point to the bounding box which can be retrieved
1282        with MinX(), MaxX() and MinY(), MaxY() functions.
1283    %End
1284
1285    wxCoord MaxX() const;
1286    %Docstring
1287        MaxX() -> Coord
1288
1289        Gets the maximum horizontal extent used in drawing commands so far.
1290    %End
1291
1292    wxCoord MaxY() const;
1293    %Docstring
1294        MaxY() -> Coord
1295
1296        Gets the maximum vertical extent used in drawing commands so far.
1297    %End
1298
1299    wxCoord MinX() const;
1300    %Docstring
1301        MinX() -> Coord
1302
1303        Gets the minimum horizontal extent used in drawing commands so far.
1304    %End
1305
1306    wxCoord MinY() const;
1307    %Docstring
1308        MinY() -> Coord
1309
1310        Gets the minimum vertical extent used in drawing commands so far.
1311    %End
1312
1313    void ResetBoundingBox();
1314    %Docstring
1315        ResetBoundingBox()
1316
1317        Resets the bounding box: after a call to this function, the bounding
1318        box doesn't contain anything.
1319    %End
1320
1321    bool StartDoc(
1322        const wxString & message
1323    );
1324    %Docstring
1325        StartDoc(message) -> bool
1326
1327        Starts a document (only relevant when outputting to a printer).
1328    %End
1329
1330    void StartPage();
1331    %Docstring
1332        StartPage()
1333
1334        Starts a document page (only relevant when outputting to a printer).
1335    %End
1336
1337    void EndDoc();
1338    %Docstring
1339        EndDoc()
1340
1341        Ends a document (only relevant when outputting to a printer).
1342    %End
1343
1344    void EndPage();
1345    %Docstring
1346        EndPage()
1347
1348        Ends a document page (only relevant when outputting to a printer).
1349    %End
1350
1351    bool Blit(
1352        wxCoord xdest,
1353        wxCoord ydest,
1354        wxCoord width,
1355        wxCoord height,
1356        wxDC * source,
1357        wxCoord xsrc,
1358        wxCoord ysrc,
1359        wxRasterOperationMode logicalFunc = wxCOPY,
1360        bool useMask = false,
1361        wxCoord xsrcMask = wxDefaultCoord,
1362        wxCoord ysrcMask = wxDefaultCoord
1363    );
1364    %Docstring
1365        Blit(xdest, ydest, width, height, source, xsrc, ysrc, logicalFunc=COPY, useMask=False, xsrcMask=DefaultCoord, ysrcMask=DefaultCoord) -> bool
1366
1367        Copy from a source DC to this DC.
1368    %End
1369
1370    bool StretchBlit(
1371        wxCoord xdest,
1372        wxCoord ydest,
1373        wxCoord dstWidth,
1374        wxCoord dstHeight,
1375        wxDC * source,
1376        wxCoord xsrc,
1377        wxCoord ysrc,
1378        wxCoord srcWidth,
1379        wxCoord srcHeight,
1380        wxRasterOperationMode logicalFunc = wxCOPY,
1381        bool useMask = false,
1382        wxCoord xsrcMask = wxDefaultCoord,
1383        wxCoord ysrcMask = wxDefaultCoord
1384    );
1385    %Docstring
1386        StretchBlit(xdest, ydest, dstWidth, dstHeight, source, xsrc, ysrc, srcWidth, srcHeight, logicalFunc=COPY, useMask=False, xsrcMask=DefaultCoord, ysrcMask=DefaultCoord) -> bool
1387
1388        Copy from a source DC to this DC possibly changing the scale.
1389    %End
1390
1391    const wxBrush & GetBackground() const;
1392    %Docstring
1393        GetBackground() -> Brush
1394
1395        Gets the brush used for painting the background.
1396    %End
1397
1398    const wxBrush & GetBrush() const;
1399    %Docstring
1400        GetBrush() -> Brush
1401
1402        Gets the current brush.
1403    %End
1404
1405    const wxPen & GetPen() const;
1406    %Docstring
1407        GetPen() -> Pen
1408
1409        Gets the current pen.
1410    %End
1411
1412    void SetBackground(
1413        const wxBrush & brush
1414    );
1415    %Docstring
1416        SetBackground(brush)
1417
1418        Sets the current background brush for the DC.
1419    %End
1420
1421    void SetBrush(
1422        const wxBrush & brush
1423    );
1424    %Docstring
1425        SetBrush(brush)
1426
1427        Sets the current brush for the DC.
1428    %End
1429
1430    void SetPen(
1431        const wxPen & pen
1432    );
1433    %Docstring
1434        SetPen(pen)
1435
1436        Sets the current pen for the DC.
1437    %End
1438
1439    bool CanUseTransformMatrix() const;
1440    %Docstring
1441        CanUseTransformMatrix() -> bool
1442
1443        Check if the use of transformation matrix is supported by the current
1444        system.
1445    %End
1446
1447    bool SetTransformMatrix(
1448        const wxAffineMatrix2D & matrix
1449    );
1450    %Docstring
1451        SetTransformMatrix(matrix) -> bool
1452
1453        Set the transformation matrix.
1454    %End
1455
1456    wxAffineMatrix2D GetTransformMatrix() const;
1457    %Docstring
1458        GetTransformMatrix() -> AffineMatrix2D
1459
1460        Return the transformation matrix used by this device context.
1461    %End
1462
1463    void ResetTransformMatrix();
1464    %Docstring
1465        ResetTransformMatrix()
1466
1467        Revert the transformation matrix to identity matrix.
1468    %End
1469
1470    bool CanDrawBitmap() const;
1471    %Docstring
1472        CanDrawBitmap() -> bool
1473
1474        Does the DC support drawing bitmaps?
1475    %End
1476
1477    bool CanGetTextExtent() const;
1478    %Docstring
1479        CanGetTextExtent() -> bool
1480
1481        Does the DC support calculating the size required to draw text?
1482    %End
1483
1484    void GetLogicalOrigin(
1485        wxCoord * x   /Out/,
1486        wxCoord * y   /Out/
1487    ) const;
1488    %Docstring
1489        GetLogicalOrigin() -> (x, y)
1490
1491        Return the coordinates of the logical point (0, 0).
1492    %End
1493
1494    void CopyAttributes(
1495        const wxDC & dc
1496    );
1497    %Docstring
1498        CopyAttributes(dc)
1499
1500        Copy attributes from another DC.
1501    %End
1502
1503    int GetDepth() const;
1504    %Docstring
1505        GetDepth() -> int
1506
1507        Returns the depth (number of bits/pixel) of this DC.
1508    %End
1509
1510    wxPoint GetDeviceOrigin() const;
1511    %Docstring
1512        GetDeviceOrigin() -> Point
1513
1514        Returns the current device origin.
1515    %End
1516
1517    wxRasterOperationMode GetLogicalFunction() const;
1518    %Docstring
1519        GetLogicalFunction() -> RasterOperationMode
1520
1521        Gets the current logical function.
1522    %End
1523
1524    wxMappingMode GetMapMode() const;
1525    %Docstring
1526        GetMapMode() -> MappingMode
1527
1528        Gets the current mapping mode for the device context.
1529    %End
1530
1531    wxColour* GetPixel(wxCoord x,  wxCoord y)   /Factory/;
1532    %Docstring
1533        GetPixel(x, y) -> Colour
1534
1535        Gets the colour at the specified location on the DC.
1536    %End
1537    %MethodCode
1538        PyErr_Clear();
1539        Py_BEGIN_ALLOW_THREADS
1540        sipRes = _wxDC_GetPixel(sipCpp, x, y);
1541        Py_END_ALLOW_THREADS
1542        if (PyErr_Occurred()) sipIsErr = 1;
1543    %End
1544    %TypeCode
1545    wxColour* _wxDC_GetPixel(wxDC* self, wxCoord x, wxCoord y)
1546    {
1547        wxColour* col = new wxColour;
1548        self->GetPixel(x, y, col);
1549        return col;
1550    }
1551    %End
1552
1553    wxSize GetPPI() const;
1554    %Docstring
1555        GetPPI() -> Size
1556
1557        Returns the resolution of the device in pixels per inch.
1558    %End
1559
1560    wxSize GetSize() const;
1561    %Docstring
1562        GetSize() -> Size
1563
1564        This is an overloaded member function, provided for convenience. It
1565        differs from the above function only in what argument(s) it accepts.
1566    %End
1567
1568    wxSize GetSizeMM() const;
1569    %Docstring
1570        GetSizeMM() -> Size
1571
1572        This is an overloaded member function, provided for convenience. It
1573        differs from the above function only in what argument(s) it accepts.
1574    %End
1575
1576    void GetUserScale(
1577        double * x   /Out/,
1578        double * y   /Out/
1579    ) const;
1580    %Docstring
1581        GetUserScale() -> (x, y)
1582
1583        Gets the current user scale factor.
1584    %End
1585
1586    bool IsOk() const;
1587    %Docstring
1588        IsOk() -> bool
1589
1590        Returns true if the DC is ok to use.
1591    %End
1592
1593    void SetAxisOrientation(
1594        bool xLeftRight,
1595        bool yBottomUp
1596    );
1597    %Docstring
1598        SetAxisOrientation(xLeftRight, yBottomUp)
1599
1600        Sets the x and y axis orientation (i.e. the direction from lowest to
1601        highest values on the axis).
1602    %End
1603
1604    void SetDeviceOrigin(
1605        wxCoord x,
1606        wxCoord y
1607    );
1608    %Docstring
1609        SetDeviceOrigin(x, y)
1610
1611        Sets the device origin (i.e. the origin in pixels after scaling has
1612        been applied).
1613    %End
1614
1615    void SetLogicalFunction(
1616        wxRasterOperationMode function
1617    );
1618    %Docstring
1619        SetLogicalFunction(function)
1620
1621        Sets the current logical function for the device context.
1622    %End
1623
1624    void SetMapMode(
1625        wxMappingMode mode
1626    );
1627    %Docstring
1628        SetMapMode(mode)
1629
1630        The mapping mode of the device context defines the unit of measurement
1631        used to convert logical units to device units.
1632    %End
1633
1634    void SetPalette(
1635        const wxPalette & palette
1636    );
1637    %Docstring
1638        SetPalette(palette)
1639
1640        If this is a window DC or memory DC, assigns the given palette to the
1641        window or bitmap associated with the DC.
1642    %End
1643
1644    void SetUserScale(
1645        double xScale,
1646        double yScale
1647    );
1648    %Docstring
1649        SetUserScale(xScale, yScale)
1650
1651        Sets the user scaling factor, useful for applications which require
1652        'zooming'.
1653    %End
1654
1655    wxUIntPtr* GetHandle() const;
1656    %Docstring
1657        GetHandle() -> UIntPtr
1658
1659        Returns a value that can be used as a handle to the native drawing
1660        context, if this wxDC has something that could be thought of in that
1661        way.
1662    %End
1663    %MethodCode
1664        PyErr_Clear();
1665        Py_BEGIN_ALLOW_THREADS
1666        sipRes = _wxDC_GetHandle(sipCpp);
1667        Py_END_ALLOW_THREADS
1668        if (PyErr_Occurred()) sipIsErr = 1;
1669    %End
1670    %TypeCode
1671    wxUIntPtr* _wxDC_GetHandle(const wxDC* self)
1672    {
1673        return new wxUIntPtr((wxUIntPtr)self->GetHandle());
1674    }
1675    %End
1676
1677    wxBitmap GetAsBitmap(
1678        const wxRect * subrect = NULL
1679    ) const;
1680    %Docstring
1681        GetAsBitmap(subrect=None) -> Bitmap
1682
1683        If supported by the platform and the type of DC, fetch the contents of
1684        the DC, or a subset of it, as a bitmap.
1685    %End
1686
1687    void SetLogicalScale(
1688        double x,
1689        double y
1690    );
1691    %Docstring
1692        SetLogicalScale(x, y)
1693
1694        Set the scale to use for translating wxDC coordinates to the physical
1695        pixels.
1696    %End
1697
1698    void GetLogicalScale(
1699        double * x   /Out/,
1700        double * y   /Out/
1701    ) const;
1702    %Docstring
1703        GetLogicalScale() -> (x, y)
1704
1705        Return the scale set by the last call to SetLogicalScale().
1706    %End
1707
1708    void SetLogicalOrigin(
1709        wxCoord x,
1710        wxCoord y
1711    );
1712    %Docstring
1713        SetLogicalOrigin(x, y)
1714
1715        Change the offset used for translating wxDC coordinates.
1716    %End
1717
1718    private:
1719        wxDC(const wxDC&);
1720
1721
1722    public:
1723
1724
1725    public:
1726        virtual ~wxDC();
1727
1728
1729    wxSize* GetTextExtent(const wxString& st) const   /Factory/;
1730    %Docstring
1731        GetTextExtent(st) -> Size
1732
1733        Return the dimensions of the given string's text extent using the
1734        currently selected font.
1735
1736        :param st: The string to be measured
1737
1738        .. seealso:: :meth:`~wx.DC.GetFullTextExtent`
1739    %End
1740    %MethodCode
1741        PyErr_Clear();
1742        Py_BEGIN_ALLOW_THREADS
1743        sipRes = _wxDC_GetTextExtent(sipCpp, st);
1744        Py_END_ALLOW_THREADS
1745        if (PyErr_Occurred()) sipIsErr = 1;
1746    %End
1747    %TypeCode
1748    wxSize* _wxDC_GetTextExtent(const wxDC* self, const wxString* st)
1749    {
1750        return new wxSize(self->GetTextExtent(*st));
1751    }
1752    %End
1753
1754    wxSize* GetMultiLineTextExtent(const wxString& st) const   /Factory/;
1755    %Docstring
1756        GetMultiLineTextExtent(st) -> Size
1757
1758        Return the dimensions of the given string's text extent using the
1759        currently selected font, taking into account multiple lines if
1760        present in the string.
1761
1762        :param st: The string to be measured
1763
1764        .. seealso:: :meth:`~wx.DC.GetFullMultiLineTextExtent`
1765    %End
1766    %MethodCode
1767        PyErr_Clear();
1768        Py_BEGIN_ALLOW_THREADS
1769        sipRes = _wxDC_GetMultiLineTextExtent(sipCpp, st);
1770        Py_END_ALLOW_THREADS
1771        if (PyErr_Occurred()) sipIsErr = 1;
1772    %End
1773    %TypeCode
1774    wxSize* _wxDC_GetMultiLineTextExtent(const wxDC* self, const wxString* st)
1775    {
1776        return new wxSize(self->GetMultiLineTextExtent(*st));
1777    }
1778    %End
1779
1780    int __nonzero__();
1781    %Docstring
1782        __nonzero__() -> int
1783    %End
1784    %MethodCode
1785        PyErr_Clear();
1786        Py_BEGIN_ALLOW_THREADS
1787        sipRes = _wxDC___nonzero__(sipCpp);
1788        Py_END_ALLOW_THREADS
1789        if (PyErr_Occurred()) sipIsErr = 1;
1790    %End
1791    %TypeCode
1792    int _wxDC___nonzero__(wxDC* self)
1793    {
1794        return self->IsOk();
1795    }
1796    %End
1797
1798    int __bool__();
1799    %Docstring
1800        __bool__() -> int
1801    %End
1802    %MethodCode
1803        PyErr_Clear();
1804        Py_BEGIN_ALLOW_THREADS
1805        sipRes = _wxDC___bool__(sipCpp);
1806        Py_END_ALLOW_THREADS
1807        if (PyErr_Occurred()) sipIsErr = 1;
1808    %End
1809    %TypeCode
1810    int _wxDC___bool__(wxDC* self)
1811    {
1812        return self->IsOk();
1813    }
1814    %End
1815
1816    long GetHDC();
1817    %Docstring
1818        GetHDC() -> long
1819    %End
1820    %MethodCode
1821        PyErr_Clear();
1822        Py_BEGIN_ALLOW_THREADS
1823        sipRes = _wxDC_GetHDC(sipCpp);
1824        Py_END_ALLOW_THREADS
1825        if (PyErr_Occurred()) sipIsErr = 1;
1826    %End
1827    %TypeCode
1828    long _wxDC_GetHDC(wxDC* self)
1829    {
1830        #ifdef __WXMSW__
1831            return (long)self->GetHandle();
1832        #else
1833            wxPyRaiseNotImplemented();
1834            return 0;
1835        #endif
1836    }
1837    %End
1838
1839    wxUIntPtr* GetCGContext();
1840    %Docstring
1841        GetCGContext() -> UIntPtr
1842    %End
1843    %MethodCode
1844        PyErr_Clear();
1845        Py_BEGIN_ALLOW_THREADS
1846        sipRes = _wxDC_GetCGContext(sipCpp);
1847        Py_END_ALLOW_THREADS
1848        if (PyErr_Occurred()) sipIsErr = 1;
1849    %End
1850    %TypeCode
1851    wxUIntPtr* _wxDC_GetCGContext(wxDC* self)
1852    {
1853        #ifdef __WXMAC__
1854            return new wxUIntPtr((wxUIntPtr)self->GetHandle());
1855        #else
1856            wxPyRaiseNotImplemented();
1857            return NULL;
1858        #endif
1859    }
1860    %End
1861
1862    wxUIntPtr* GetGdkDrawable();
1863    %Docstring
1864        GetGdkDrawable() -> UIntPtr
1865    %End
1866    %MethodCode
1867        PyErr_Clear();
1868        Py_BEGIN_ALLOW_THREADS
1869        sipRes = _wxDC_GetGdkDrawable(sipCpp);
1870        Py_END_ALLOW_THREADS
1871        if (PyErr_Occurred()) sipIsErr = 1;
1872    %End
1873    %TypeCode
1874    wxUIntPtr* _wxDC_GetGdkDrawable(wxDC* self)
1875    {
1876        #ifdef __WXGTK__
1877            return new wxUIntPtr((wxUIntPtr)self->GetHandle());
1878        #else
1879            wxPyRaiseNotImplemented();
1880            return NULL;
1881        #endif
1882    }
1883    %End
1884
1885    PyObject* _DrawPointList(PyObject* pyCoords,  PyObject* pyPens,  PyObject* pyBrushes);
1886    %Docstring
1887        _DrawPointList(pyCoords, pyPens, pyBrushes) -> PyObject
1888    %End
1889    %MethodCode
1890        PyErr_Clear();
1891        Py_BEGIN_ALLOW_THREADS
1892        sipRes = _wxDC__DrawPointList(sipCpp, pyCoords, pyPens, pyBrushes);
1893        Py_END_ALLOW_THREADS
1894        if (PyErr_Occurred()) sipIsErr = 1;
1895    %End
1896    %TypeCode
1897    PyObject* _wxDC__DrawPointList(wxDC* self, PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
1898    {
1899        return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes);
1900    }
1901    %End
1902
1903    PyObject* _DrawLineList(PyObject* pyCoords,  PyObject* pyPens,  PyObject* pyBrushes);
1904    %Docstring
1905        _DrawLineList(pyCoords, pyPens, pyBrushes) -> PyObject
1906    %End
1907    %MethodCode
1908        PyErr_Clear();
1909        Py_BEGIN_ALLOW_THREADS
1910        sipRes = _wxDC__DrawLineList(sipCpp, pyCoords, pyPens, pyBrushes);
1911        Py_END_ALLOW_THREADS
1912        if (PyErr_Occurred()) sipIsErr = 1;
1913    %End
1914    %TypeCode
1915    PyObject* _wxDC__DrawLineList(wxDC* self, PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
1916    {
1917        return wxPyDrawXXXList(*self, wxPyDrawXXXLine, pyCoords, pyPens, pyBrushes);
1918    }
1919    %End
1920
1921    PyObject* _DrawRectangleList(PyObject* pyCoords,  PyObject* pyPens,  PyObject* pyBrushes);
1922    %Docstring
1923        _DrawRectangleList(pyCoords, pyPens, pyBrushes) -> PyObject
1924    %End
1925    %MethodCode
1926        PyErr_Clear();
1927        Py_BEGIN_ALLOW_THREADS
1928        sipRes = _wxDC__DrawRectangleList(sipCpp, pyCoords, pyPens, pyBrushes);
1929        Py_END_ALLOW_THREADS
1930        if (PyErr_Occurred()) sipIsErr = 1;
1931    %End
1932    %TypeCode
1933    PyObject* _wxDC__DrawRectangleList(wxDC* self, PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
1934    {
1935        return wxPyDrawXXXList(*self, wxPyDrawXXXRectangle, pyCoords, pyPens, pyBrushes);
1936    }
1937    %End
1938
1939    PyObject* _DrawEllipseList(PyObject* pyCoords,  PyObject* pyPens,  PyObject* pyBrushes);
1940    %Docstring
1941        _DrawEllipseList(pyCoords, pyPens, pyBrushes) -> PyObject
1942    %End
1943    %MethodCode
1944        PyErr_Clear();
1945        Py_BEGIN_ALLOW_THREADS
1946        sipRes = _wxDC__DrawEllipseList(sipCpp, pyCoords, pyPens, pyBrushes);
1947        Py_END_ALLOW_THREADS
1948        if (PyErr_Occurred()) sipIsErr = 1;
1949    %End
1950    %TypeCode
1951    PyObject* _wxDC__DrawEllipseList(wxDC* self, PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
1952    {
1953        return wxPyDrawXXXList(*self, wxPyDrawXXXEllipse, pyCoords, pyPens, pyBrushes);
1954    }
1955    %End
1956
1957    PyObject* _DrawPolygonList(PyObject* pyCoords,  PyObject* pyPens,  PyObject* pyBrushes);
1958    %Docstring
1959        _DrawPolygonList(pyCoords, pyPens, pyBrushes) -> PyObject
1960    %End
1961    %MethodCode
1962        PyErr_Clear();
1963        Py_BEGIN_ALLOW_THREADS
1964        sipRes = _wxDC__DrawPolygonList(sipCpp, pyCoords, pyPens, pyBrushes);
1965        Py_END_ALLOW_THREADS
1966        if (PyErr_Occurred()) sipIsErr = 1;
1967    %End
1968    %TypeCode
1969    PyObject* _wxDC__DrawPolygonList(wxDC* self, PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
1970    {
1971        return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);
1972    }
1973    %End
1974
1975    PyObject* _DrawTextList(PyObject* textList,  PyObject* pyPoints,  PyObject* foregroundList,  PyObject* backgroundList);
1976    %Docstring
1977        _DrawTextList(textList, pyPoints, foregroundList, backgroundList) -> PyObject
1978    %End
1979    %MethodCode
1980        PyErr_Clear();
1981        Py_BEGIN_ALLOW_THREADS
1982        sipRes = _wxDC__DrawTextList(sipCpp, textList, pyPoints, foregroundList, backgroundList);
1983        Py_END_ALLOW_THREADS
1984        if (PyErr_Occurred()) sipIsErr = 1;
1985    %End
1986    %TypeCode
1987    PyObject* _wxDC__DrawTextList(wxDC* self, PyObject* textList, PyObject* pyPoints, PyObject* foregroundList, PyObject* backgroundList)
1988    {
1989        return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);
1990    }
1991    %End
1992
1993    public:
1994
1995
1996    %Property(name=AsBitmap, get=GetAsBitmap)
1997    %Property(name=Background, get=GetBackground, set=SetBackground)
1998    %Property(name=BackgroundMode, get=GetBackgroundMode, set=SetBackgroundMode)
1999    %Property(name=Brush, get=GetBrush, set=SetBrush)
2000    %Property(name=CGContext, get=GetCGContext)
2001    %Property(name=CharHeight, get=GetCharHeight)
2002    %Property(name=CharWidth, get=GetCharWidth)
2003    %Property(name=Depth, get=GetDepth)
2004    %Property(name=DeviceOrigin, get=GetDeviceOrigin, set=SetDeviceOrigin)
2005    %Property(name=Font, get=GetFont, set=SetFont)
2006    %Property(name=FontMetrics, get=GetFontMetrics)
2007    %Property(name=GdkDrawable, get=GetGdkDrawable)
2008    %Property(name=HDC, get=GetHDC)
2009    %Property(name=Handle, get=GetHandle)
2010    %Property(name=LayoutDirection, get=GetLayoutDirection, set=SetLayoutDirection)
2011    %Property(name=LogicalFunction, get=GetLogicalFunction, set=SetLogicalFunction)
2012    %Property(name=MapMode, get=GetMapMode, set=SetMapMode)
2013    %Property(name=MultiLineTextExtent, get=GetMultiLineTextExtent)
2014    %Property(name=PPI, get=GetPPI)
2015    %Property(name=Pen, get=GetPen, set=SetPen)
2016    %Property(name=Pixel, get=GetPixel)
2017    %Property(name=Size, get=GetSize)
2018    %Property(name=SizeMM, get=GetSizeMM)
2019    %Property(name=TextBackground, get=GetTextBackground, set=SetTextBackground)
2020    %Property(name=TextExtent, get=GetTextExtent)
2021    %Property(name=TextForeground, get=GetTextForeground, set=SetTextForeground)
2022    %Property(name=TransformMatrix, get=GetTransformMatrix, set=SetTransformMatrix)
2023};  // end of class wxDC
2024
2025
2026%Extract(id=pycode_core)
2027def _DC_GetClippingRect(self):
2028    """
2029    Gets the rectangle surrounding the current clipping region
2030    """
2031    return wx.Rect(*self.GetClippingBox())
2032DC.GetClippingRect = _DC_GetClippingRect
2033del _DC_GetClippingRect
2034%End
2035
2036%Extract(id=pycode_core)
2037DC.DrawImageLabel = wx.deprecated(DC.DrawLabel, "Use DrawLabel instead.")
2038
2039%End
2040
2041%Extract(id=pycode_core)
2042def _DC_GetBoundingBox(self):
2043    """
2044    GetBoundingBox() -> (x1,y1, x2,y2)
2045
2046    Returns the min and max points used in drawing commands so far.
2047    """
2048    return (self.MinX(), self.MinY(), self.MaxX(), self.MaxY())
2049DC.GetBoundingBox = _DC_GetBoundingBox
2050del _DC_GetBoundingBox
2051%End
2052
2053%Extract(id=pycode_core)
2054DC.GetHDC = wx.deprecated(DC.GetHDC, "Use GetHandle instead.")
2055
2056%End
2057
2058%Extract(id=pycode_core)
2059DC.GetCGContext = wx.deprecated(DC.GetCGContext, "Use GetHandle instead.")
2060
2061%End
2062
2063%Extract(id=pycode_core)
2064DC.GetGdkDrawable = wx.deprecated(DC.GetGdkDrawable, "Use GetHandle instead.")
2065
2066%End
2067
2068%Extract(id=pycode_core)
2069def _DC___enter__(self):
2070    return self
2071DC.__enter__ = _DC___enter__
2072del _DC___enter__
2073%End
2074
2075%Extract(id=pycode_core)
2076def _DC___exit__(self, exc_type, exc_val, exc_tb):
2077    self.Destroy()
2078DC.__exit__ = _DC___exit__
2079del _DC___exit__
2080%End
2081
2082%Extract(id=pycode_core)
2083def _DC_DrawPointList(self, points, pens=None):
2084    """
2085    Draw a list of points as quickly as possible.
2086
2087    :param points: A sequence of 2-element sequences representing
2088                   each point to draw, (x,y).
2089    :param pens:   If None, then the current pen is used.  If a single
2090                   pen then it will be used for all points.  If a list of
2091                   pens then there should be one for each point in points.
2092    """
2093    if pens is None:
2094        pens = []
2095    elif isinstance(pens, wx.Pen):
2096        pens = [pens]
2097    elif len(pens) != len(points):
2098        raise ValueError('points and pens must have same length')
2099    return self._DrawPointList(points, pens, [])
2100DC.DrawPointList = _DC_DrawPointList
2101del _DC_DrawPointList
2102%End
2103
2104%Extract(id=pycode_core)
2105def _DC_DrawLineList(self, lines, pens=None):
2106    """
2107    Draw a list of lines as quickly as possible.
2108
2109    :param lines: A sequence of 4-element sequences representing
2110                  each line to draw, (x1,y1, x2,y2).
2111    :param pens:  If None, then the current pen is used.  If a
2112                  single pen then it will be used for all lines.  If
2113                  a list of pens then there should be one for each line
2114                  in lines.
2115    """
2116    if pens is None:
2117        pens = []
2118    elif isinstance(pens, wx.Pen):
2119        pens = [pens]
2120    elif len(pens) != len(lines):
2121        raise ValueError('lines and pens must have same length')
2122    return self._DrawLineList(lines, pens, [])
2123DC.DrawLineList = _DC_DrawLineList
2124del _DC_DrawLineList
2125%End
2126
2127%Extract(id=pycode_core)
2128def _DC_DrawRectangleList(self, rectangles, pens=None, brushes=None):
2129    """
2130    Draw a list of rectangles as quickly as possible.
2131
2132    :param rectangles: A sequence of 4-element sequences representing
2133                       each rectangle to draw, (x,y, w,h).
2134    :param pens:       If None, then the current pen is used.  If a
2135                       single pen then it will be used for all rectangles.
2136                       If a list of pens then there should be one for each
2137                       rectangle in rectangles.
2138    :param brushes:    A brush or brushes to be used to fill the rectagles,
2139                       with similar semantics as the pens parameter.
2140    """
2141    if pens is None:
2142        pens = []
2143    elif isinstance(pens, wx.Pen):
2144        pens = [pens]
2145    elif len(pens) != len(rectangles):
2146        raise ValueError('rectangles and pens must have same length')
2147    if brushes is None:
2148        brushes = []
2149    elif isinstance(brushes, wx.Brush):
2150        brushes = [brushes]
2151    elif len(brushes) != len(rectangles):
2152        raise ValueError('rectangles and brushes must have same length')
2153    return self._DrawRectangleList(rectangles, pens, brushes)
2154DC.DrawRectangleList = _DC_DrawRectangleList
2155del _DC_DrawRectangleList
2156%End
2157
2158%Extract(id=pycode_core)
2159def _DC_DrawEllipseList(self, ellipses, pens=None, brushes=None):
2160    """
2161    Draw a list of ellipses as quickly as possible.
2162
2163    :param ellipses: A sequence of 4-element sequences representing
2164                     each ellipse to draw, (x,y, w,h).
2165    :param pens:     If None, then the current pen is used.  If a
2166                     single pen then it will be used for all ellipses.
2167                     If a list of pens then there should be one for each
2168                     ellipse in ellipses.
2169    :param brushes:  A brush or brushes to be used to fill the ellipses,
2170                     with similar semantics as the pens parameter.
2171    """
2172    if pens is None:
2173        pens = []
2174    elif isinstance(pens, wx.Pen):
2175        pens = [pens]
2176    elif len(pens) != len(ellipses):
2177        raise ValueError('ellipses and pens must have same length')
2178    if brushes is None:
2179        brushes = []
2180    elif isinstance(brushes, wx.Brush):
2181        brushes = [brushes]
2182    elif len(brushes) != len(ellipses):
2183        raise ValueError('ellipses and brushes must have same length')
2184    return self._DrawEllipseList(ellipses, pens, brushes)
2185DC.DrawEllipseList = _DC_DrawEllipseList
2186del _DC_DrawEllipseList
2187%End
2188
2189%Extract(id=pycode_core)
2190def _DC_DrawPolygonList(self, polygons, pens=None, brushes=None):
2191    """
2192    Draw a list of polygons, each of which is a list of points.
2193
2194    :param polygons: A sequence of sequences of sequences.
2195                     [[(x1,y1),(x2,y2),(x3,y3)...], [(x1,y1),(x2,y2),(x3,y3)...]]
2196
2197    :param pens:     If None, then the current pen is used.  If a
2198                     single pen then it will be used for all polygons.
2199                     If a list of pens then there should be one for each
2200                     polygon.
2201    :param brushes:  A brush or brushes to be used to fill the polygons,
2202                     with similar semantics as the pens parameter.
2203    """
2204    if pens is None:
2205        pens = []
2206    elif isinstance(pens, wx.Pen):
2207        pens = [pens]
2208    elif len(pens) != len(polygons):
2209        raise ValueError('polygons and pens must have same length')
2210    if brushes is None:
2211        brushes = []
2212    elif isinstance(brushes, wx.Brush):
2213        brushes = [brushes]
2214    elif len(brushes) != len(polygons):
2215        raise ValueError('polygons and brushes must have same length')
2216    return self._DrawPolygonList(polygons, pens, brushes)
2217DC.DrawPolygonList = _DC_DrawPolygonList
2218del _DC_DrawPolygonList
2219%End
2220
2221%Extract(id=pycode_core)
2222def _DC_DrawTextList(self, textList, coords, foregrounds=None, backgrounds=None):
2223    """
2224    Draw a list of strings using a list of coordinants for positioning each string.
2225
2226    :param textList:    A list of strings
2227    :param coords:      A list of (x,y) positions
2228    :param foregrounds: A list of `wx.Colour` objects to use for the
2229                        foregrounds of the strings.
2230    :param backgrounds: A list of `wx.Colour` objects to use for the
2231                        backgrounds of the strings.
2232
2233    NOTE: Make sure you set background mode to wx.Solid (DC.SetBackgroundMode)
2234          If you want backgrounds to do anything.
2235    """
2236    if type(textList) == type(''):
2237        textList = [textList]
2238    elif len(textList) != len(coords):
2239        raise ValueError('textlist and coords must have same length')
2240    if foregrounds is None:
2241        foregrounds = []
2242    elif isinstance(foregrounds, wx.Colour):
2243        foregrounds = [foregrounds]
2244    elif len(foregrounds) != len(coords):
2245        raise ValueError('foregrounds and coords must have same length')
2246    if backgrounds is None:
2247        backgrounds = []
2248    elif isinstance(backgrounds, wx.Colour):
2249        backgrounds = [backgrounds]
2250    elif len(backgrounds) != len(coords):
2251        raise ValueError('backgrounds and coords must have same length')
2252    return  self._DrawTextList(textList, coords, foregrounds, backgrounds)
2253DC.DrawTextList = _DC_DrawTextList
2254del _DC_DrawTextList
2255%End
2256
2257%Extract(id=pycode_core)
2258DC.BoundingBox = property(DC.GetBoundingBox)
2259%End
2260
2261%Extract(id=pycode_core)
2262DC.ClippingRect = property(DC.GetClippingRect)
2263%End
2264
2265class wxDCClipper
2266{
2267    %Docstring
2268        DCClipper(dc, region)
2269        DCClipper(dc, rect)
2270        DCClipper(dc, x, y, w, h)
2271
2272        wxDCClipper is a helper class for setting a clipping region on a wxDC
2273        during its lifetime.
2274    %End
2275    %TypeHeaderCode
2276        #include <wx/dc.h>
2277    %End
2278
2279public:
2280    wxDCClipper(
2281        wxDC & dc,
2282        const wxRegion & region
2283    );
2284
2285    wxDCClipper(
2286        wxDC & dc,
2287        const wxRect & rect
2288    );
2289
2290    wxDCClipper(
2291        wxDC & dc,
2292        wxCoord x,
2293        wxCoord y,
2294        wxCoord w,
2295        wxCoord h
2296    );
2297
2298    ~wxDCClipper();
2299
2300    private:
2301        wxDCClipper(const wxDCClipper&);
2302
2303
2304};  // end of class wxDCClipper
2305
2306
2307%Extract(id=pycode_core)
2308def _DCClipper___enter__(self):
2309    return self
2310DCClipper.__enter__ = _DCClipper___enter__
2311del _DCClipper___enter__
2312%End
2313
2314%Extract(id=pycode_core)
2315def _DCClipper___exit__(self, exc_type, exc_val, exc_tb):
2316    return False
2317DCClipper.__exit__ = _DCClipper___exit__
2318del _DCClipper___exit__
2319%End
2320
2321class wxDCBrushChanger
2322{
2323    %Docstring
2324        DCBrushChanger(dc, brush)
2325
2326        wxDCBrushChanger is a small helper class for setting a brush on a wxDC
2327        and unsetting it automatically in the destructor, restoring the
2328        previous one.
2329    %End
2330    %TypeHeaderCode
2331        #include <wx/dc.h>
2332    %End
2333
2334public:
2335    wxDCBrushChanger(
2336        wxDC & dc,
2337        const wxBrush & brush
2338    );
2339
2340    ~wxDCBrushChanger();
2341
2342    private:
2343        wxDCBrushChanger(const wxDCBrushChanger&);
2344
2345
2346};  // end of class wxDCBrushChanger
2347
2348
2349%Extract(id=pycode_core)
2350def _DCBrushChanger___enter__(self):
2351    return self
2352DCBrushChanger.__enter__ = _DCBrushChanger___enter__
2353del _DCBrushChanger___enter__
2354%End
2355
2356%Extract(id=pycode_core)
2357def _DCBrushChanger___exit__(self, exc_type, exc_val, exc_tb):
2358    return False
2359DCBrushChanger.__exit__ = _DCBrushChanger___exit__
2360del _DCBrushChanger___exit__
2361%End
2362
2363class wxDCPenChanger
2364{
2365    %Docstring
2366        DCPenChanger(dc, pen)
2367
2368        wxDCPenChanger is a small helper class for setting a pen on a wxDC and
2369        unsetting it automatically in the destructor, restoring the previous
2370        one.
2371    %End
2372    %TypeHeaderCode
2373        #include <wx/dc.h>
2374    %End
2375
2376public:
2377    wxDCPenChanger(
2378        wxDC & dc,
2379        const wxPen & pen
2380    );
2381
2382    ~wxDCPenChanger();
2383
2384    private:
2385        wxDCPenChanger(const wxDCPenChanger&);
2386
2387
2388};  // end of class wxDCPenChanger
2389
2390
2391%Extract(id=pycode_core)
2392def _DCPenChanger___enter__(self):
2393    return self
2394DCPenChanger.__enter__ = _DCPenChanger___enter__
2395del _DCPenChanger___enter__
2396%End
2397
2398%Extract(id=pycode_core)
2399def _DCPenChanger___exit__(self, exc_type, exc_val, exc_tb):
2400    return False
2401DCPenChanger.__exit__ = _DCPenChanger___exit__
2402del _DCPenChanger___exit__
2403%End
2404
2405class wxDCTextColourChanger
2406{
2407    %Docstring
2408        DCTextColourChanger(dc)
2409        DCTextColourChanger(dc, col)
2410
2411        wxDCTextColourChanger is a small helper class for setting a foreground
2412        text colour on a wxDC and unsetting it automatically in the
2413        destructor, restoring the previous one.
2414    %End
2415    %TypeHeaderCode
2416        #include <wx/dc.h>
2417    %End
2418
2419public:
2420    wxDCTextColourChanger(
2421        wxDC & dc
2422    );
2423
2424    wxDCTextColourChanger(
2425        wxDC & dc,
2426        const wxColour & col
2427    );
2428
2429    ~wxDCTextColourChanger();
2430
2431    void Set(
2432        const wxColour & col
2433    );
2434    %Docstring
2435        Set(col)
2436
2437        Set the colour to use.
2438    %End
2439
2440    private:
2441        wxDCTextColourChanger(const wxDCTextColourChanger&);
2442
2443
2444};  // end of class wxDCTextColourChanger
2445
2446
2447%Extract(id=pycode_core)
2448def _DCTextColourChanger___enter__(self):
2449    return self
2450DCTextColourChanger.__enter__ = _DCTextColourChanger___enter__
2451del _DCTextColourChanger___enter__
2452%End
2453
2454%Extract(id=pycode_core)
2455def _DCTextColourChanger___exit__(self, exc_type, exc_val, exc_tb):
2456    return False
2457DCTextColourChanger.__exit__ = _DCTextColourChanger___exit__
2458del _DCTextColourChanger___exit__
2459%End
2460
2461class wxDCFontChanger
2462{
2463    %Docstring
2464        DCFontChanger(dc)
2465        DCFontChanger(dc, font)
2466
2467        wxDCFontChanger is a small helper class for setting a font on a wxDC
2468        and unsetting it automatically in the destructor, restoring the
2469        previous one.
2470    %End
2471    %TypeHeaderCode
2472        #include <wx/dc.h>
2473    %End
2474
2475public:
2476    wxDCFontChanger(
2477        wxDC & dc
2478    );
2479
2480    wxDCFontChanger(
2481        wxDC & dc,
2482        const wxFont & font
2483    );
2484
2485    ~wxDCFontChanger();
2486
2487    void Set(
2488        const wxFont & font
2489    );
2490    %Docstring
2491        Set(font)
2492
2493        Set the font to use.
2494    %End
2495
2496    private:
2497        wxDCFontChanger(const wxDCFontChanger&);
2498
2499
2500};  // end of class wxDCFontChanger
2501
2502
2503%Extract(id=pycode_core)
2504def _DCFontChanger___enter__(self):
2505    return self
2506DCFontChanger.__enter__ = _DCFontChanger___enter__
2507del _DCFontChanger___enter__
2508%End
2509
2510%Extract(id=pycode_core)
2511def _DCFontChanger___exit__(self, exc_type, exc_val, exc_tb):
2512    return False
2513DCFontChanger.__exit__ = _DCFontChanger___exit__
2514del _DCFontChanger___exit__
2515%End
2516
2517
2518//---------------------------------------------------------------------------
2519
2520