1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface file for wxDC, wxBrush, wxPen, etc.
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
18 #include <wx/imaglist.h>
19 #include <wx/fontmap.h>
20 #include <wx/fontenc.h>
21 #include <wx/fontmap.h>
22 #include <wx/fontutil.h>
23 #include <wx/dcbuffer.h>
24 #include <wx/iconbndl.h>
27 //----------------------------------------------------------------------
30 %include my_typemaps.i
32 // Import some definitions of other classes, etc.
37 %pragma(python) code = "import wx"
39 //---------------------------------------------------------------------------
41 // Put some wx default wxChar* values into wxStrings.
42 static const wxString wxPyEmptyString(wxT(""));
44 //---------------------------------------------------------------------------
46 class wxGDIObject : public wxObject {
52 void SetVisible( bool visible );
58 //---------------------------------------------------------------------------
61 // TODO: When the API stabalizes and is available on other platforms, add
62 // wrappers for the new wxBitmap, wxRawBitmap, wxDIB stuff...
64 class wxBitmap : public wxGDIObject
67 wxBitmap(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_ANY);
70 wxPalette* GetPalette();
72 bool LoadFile(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_ANY);
73 bool SaveFile(const wxString& name, wxBitmapType type, wxPalette* palette = NULL);
74 void SetMask(wxMask* mask);
75 %pragma(python) addtoclass = "
76 def SetMaskColour(self, colour):
77 mask = wxMaskColour(self, colour)
81 void SetPalette(wxPalette& palette);
87 void SetHandle(long handle);
94 void SetHeight(int h);
97 void SetSize(const wxSize& size);
100 wxBitmap GetSubBitmap( const wxRect& rect );
101 bool CopyFromIcon(const wxIcon& icon);
103 bool CopyFromCursor(const wxCursor& cursor);
105 void SetQuality(int q);
108 %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
112 // Declarations of some alternate "constructors"
113 %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
114 %new wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings);
115 %new wxBitmap* wxBitmapFromIcon(const wxIcon& icon);
116 %new wxBitmap* wxBitmapFromBits(PyObject* bits, int width, int height, int depth = 1 );
119 // %new wxBitmap* wxBitmapFromData(PyObject* data, long type,
120 // int width, int height, int depth = 1);
125 %{ // Implementations of some alternate "constructors"
127 wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
128 return new wxBitmap(width, height, depth);
131 static char** ConvertListOfStrings(PyObject* listOfStrings) {
132 char** cArray = NULL;
135 if (!PyList_Check(listOfStrings)) {
136 PyErr_SetString(PyExc_TypeError, "Expected a list of strings.");
139 count = PyList_Size(listOfStrings);
140 cArray = new char*[count];
142 for(int x=0; x<count; x++) {
143 // TODO: Need some validation and error checking here
144 cArray[x] = PyString_AsString(PyList_GET_ITEM(listOfStrings, x));
150 wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings) {
151 char** cArray = NULL;
154 cArray = ConvertListOfStrings(listOfStrings);
157 bmp = new wxBitmap(cArray);
163 wxBitmap* wxBitmapFromIcon(const wxIcon& icon) {
164 return new wxBitmap(icon);
168 wxBitmap* wxBitmapFromBits(PyObject* bits, int width, int height, int depth = 1 ) {
171 PyString_AsStringAndSize(bits, &buf, &length);
172 return new wxBitmap(buf, width, height, depth);
177 // wxBitmap* wxBitmapFromData(PyObject* data, long type,
178 // int width, int height, int depth = 1) {
179 // if (! PyString_Check(data)) {
180 // PyErr_SetString(PyExc_TypeError, "Expected string object");
183 // return new wxBitmap((void*)PyString_AsString(data), type, width, height, depth);
188 //---------------------------------------------------------------------------
190 class wxMask : public wxObject {
192 wxMask(const wxBitmap& bitmap);
195 %addmethods { void Destroy() { delete self; } }
198 %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
200 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
201 return new wxMask(bitmap, colour);
206 //---------------------------------------------------------------------------
209 class wxIcon : public wxGDIObject
212 wxIcon(const wxString& name, long flags,
213 int desiredWidth = -1, int desiredHeight = -1);
217 bool LoadFile(const wxString& name, long flags);
220 // wxGDIImage methods
223 void SetHandle(long handle);
229 void SetWidth(int w);
230 void SetHeight(int h);
231 void SetDepth(int d);
233 void SetSize(const wxSize& size);
235 void CopyFromBitmap(const wxBitmap& bmp);
237 %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
241 // Declarations of some alternate "constructors"
242 %new wxIcon* wxEmptyIcon();
243 %new wxIcon* wxIconFromXPMData(PyObject* listOfStrings);
244 %new wxIcon* wxIconFromBitmap(const wxBitmap& bmp);
246 %{ // Implementations of some alternate "constructors"
247 wxIcon* wxEmptyIcon() {
251 wxIcon* wxIconFromXPMData(PyObject* listOfStrings) {
252 char** cArray = NULL;
255 cArray = ConvertListOfStrings(listOfStrings);
258 icon = new wxIcon(cArray);
263 wxIcon* wxIconFromBitmap(const wxBitmap& bmp) {
264 wxIcon* icon = new wxIcon();
265 icon->CopyFromBitmap(bmp);
270 //---------------------------------------------------------------------------
275 // default constructor
278 // initializes the bundle with the icon(s) found in the file
279 %name(wxIconBundleFromFile) wxIconBundle( const wxString& file, long type );
281 // initializes the bundle with a single icon
282 %name(wxIconBundleFromIcon)wxIconBundle( const wxIcon& icon );
286 // adds the icon to the collection, if the collection already
287 // contains an icon with the same width and height, it is
289 void AddIcon( const wxIcon& icon );
291 // adds all the icons contained in the file to the collection,
292 // if the collection already contains icons with the same
293 // width and height, they are replaced
294 %name(AddIconFromFile)void AddIcon( const wxString& file, long type );
296 // returns the icon with the given size; if no such icon exists,
297 // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists,
298 // returns the first icon in the bundle
299 const wxIcon& GetIcon( const wxSize& size ) const;
302 //---------------------------------------------------------------------------
304 class wxCursor : public wxGDIObject
308 wxCursor(const wxString* cursorName, long flags, int hotSpotX=0, int hotSpotY=0) {
310 wxCHECK_MSG(FALSE, NULL,
311 wxT("wxCursor constructor not implemented for wxGTK, use wxStockCursor, wxCursorFromImage, or wxCursorFromBits instead."));
313 return new wxCursor(*cursorName, flags, hotSpotX, hotSpotY);
320 // wxGDIImage methods
323 void SetHandle(long handle);
330 void SetWidth(int w);
331 void SetHeight(int h);
332 void SetDepth(int d);
333 void SetSize(const wxSize& size);
335 %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
338 %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
339 %new wxCursor* wxCursorFromImage(const wxImage& image);
340 %new wxCursor* wxCursorFromBits(PyObject* bits, int width, int height,
341 int hotSpotX=-1, int hotSpotY=-1,
342 PyObject* maskBits=0);
345 wxCursor* wxPyStockCursor(int id) {
346 return new wxCursor(id);
349 wxCursor* wxCursorFromImage(const wxImage& image) {
350 return new wxCursor(image);
353 wxCursor* wxCursorFromBits(PyObject* bits, int width, int height,
354 int hotSpotX=-1, int hotSpotY=-1,
355 PyObject* maskBits=0) {
357 char* maskbuf = NULL;
359 PyString_AsStringAndSize(bits, &bitsbuf, &length);
361 PyString_AsStringAndSize(maskBits, &maskbuf, &length);
362 return new wxCursor(bitsbuf, width, height, hotSpotX, hotSpotY, maskbuf);
366 //----------------------------------------------------------------------
368 class wxColour : public wxObject {
370 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
373 unsigned char Green();
374 unsigned char Blue();
376 void Set(unsigned char red, unsigned char green, unsigned char blue);
379 PyObject* rv = PyTuple_New(3);
385 green = self->Green();
388 PyTuple_SetItem(rv, 0, PyInt_FromLong(red));
389 PyTuple_SetItem(rv, 1, PyInt_FromLong(green));
390 PyTuple_SetItem(rv, 2, PyInt_FromLong(blue));
393 bool __eq__(PyObject* obj) {
395 wxColour* ptr = &tmp;
396 if (obj == Py_None) return FALSE;
397 wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
398 if (! success) return FALSE;
399 return *self == *ptr;
401 bool __ne__(PyObject* obj) {
403 wxColour* ptr = &tmp;
404 if (obj == Py_None) return TRUE;
405 wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
406 if (! success) return TRUE;
407 return *self != *ptr;
411 %pragma(python) addtoclass = "asTuple = Get
412 def __str__(self): return str(self.asTuple())
413 def __repr__(self): return 'wxColour:' + str(self.asTuple())
414 def __nonzero__(self): return self.Ok()
415 def __getinitargs__(self): return ()
416 def __getstate__(self): return self.asTuple()
417 def __setstate__(self, state): self.Set(*state)
422 %new wxColour* wxNamedColour(const wxString& colorName);
424 %{ // Alternate 'constructor'
425 wxColour* wxNamedColour(const wxString& colorName) {
426 return new wxColour(colorName);
432 class wxColourDatabase : public wxObject {
435 wxColour *FindColour(const wxString& colour);
436 wxString FindName(const wxColour& colour) const;
439 void Append(const wxString& name, int red, int green, int blue) {
440 // first see if the name is already there
441 wxString cName = name;
443 wxString cName2 = cName;
444 if ( !cName2.Replace(wxT("GRAY"), wxT("GREY")) )
447 wxNode *node = self->GetFirst();
449 const wxChar *key = node->GetKeyString();
450 if ( cName == key || cName2 == key ) {
451 wxColour* c = (wxColour *)node->GetData();
452 c->Set(red, green, blue);
455 node = node->GetNext();
458 // otherwise append the new colour
459 self->Append(name.c_str(), new wxColour(red, green, blue));
465 //----------------------------------------------------------------------
467 class wxPen : public wxGDIObject {
469 wxPen(wxColour& colour, int width=1, int style=wxSOLID);
473 wxColour GetColour();
479 void SetCap(int cap_style);
480 void SetColour(wxColour& colour);
481 void SetJoin(int join_style);
482 void SetStyle(int style);
483 void SetWidth(int width);
486 void SetDashes(int LCOUNT, wxDash* choices);
487 //int GetDashes(wxDash **dashes);
489 PyObject* GetDashes() {
491 int count = self->GetDashes(&dashes);
492 wxPyBeginBlockThreads();
493 PyObject* retval = PyList_New(0);
494 for (int x=0; x<count; x++)
495 PyList_Append(retval, PyInt_FromLong(dashes[x]));
496 wxPyEndBlockThreads();
502 wxBitmap* GetStipple();
503 void SetStipple(wxBitmap& stipple);
506 %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
512 // The list of ints for the dashes needs to exist for the life of the pen
513 // so we make it part of the class to save it. wxPyPen is aliased to wxPen
517 class wxPyPen : public wxPen {
519 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID)
520 : wxPen(colour, width, style)
527 void SetDashes(int nb_dashes, const wxDash *dash) {
530 m_dash = new wxDash[nb_dashes];
531 for (int i=0; i<nb_dashes; i++) {
534 wxPen::SetDashes(nb_dashes, m_dash);
543 class wxPyPen : public wxPen {
545 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID);
548 void SetDashes(int LCOUNT, wxDash* choices);
554 class wxPenList : public wxObject {
557 void AddPen(wxPen* pen);
558 wxPen* FindOrCreatePen(const wxColour& colour, int width, int style);
559 void RemovePen(wxPen* pen);
566 //----------------------------------------------------------------------
568 class wxBrush : public wxGDIObject {
570 wxBrush(const wxColour& colour, int style=wxSOLID);
573 wxColour GetColour();
574 wxBitmap * GetStipple();
577 void SetColour(wxColour &colour);
578 void SetStipple(wxBitmap& bitmap);
579 void SetStyle(int style);
583 void SetMacTheme(short macThemeBrush);
586 %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
590 class wxBrushList : public wxObject {
593 void AddBrush(wxBrush *brush);
594 wxBrush * FindOrCreateBrush(const wxColour& colour, int style);
595 void RemoveBrush(wxBrush *brush);
600 //----------------------------------------------------------------------
603 class wxDC : public wxObject {
605 // wxDC(); **** abstract base class, can't instantiate.
611 bool Blit(wxCoord xdest, wxCoord ydest,
612 wxCoord width, wxCoord height,
613 wxDC *source, wxCoord xsrc, wxCoord ysrc,
614 int logicalFunc = wxCOPY, int useMask = FALSE);
615 // bool Blit(const wxPoint& destPt, const wxSize& sz,
616 // wxDC *source, const wxPoint& srcPt,
617 // int logicalFunc = wxCOPY, int useMask = FALSE);
620 void CrossHair(wxCoord x, wxCoord y);
621 void DestroyClippingRegion();
622 wxCoord DeviceToLogicalX(wxCoord x);
623 wxCoord DeviceToLogicalXRel(wxCoord x);
624 wxCoord DeviceToLogicalY(wxCoord y);
625 wxCoord DeviceToLogicalYRel(wxCoord y);
626 void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
627 void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
628 void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
629 void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxCoord start, wxCoord end);
630 void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
632 void DrawLabel(const wxString& text, const wxRect& rect,
633 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
634 int indexAccel = -1);
637 wxRect DrawImageLabel(const wxString& text,
638 const wxBitmap& image,
640 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
641 int indexAccel = -1) {
643 self->DrawLabel(text, image, rect, alignment, indexAccel, &rv);
648 void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
649 void DrawLines(int PCOUNT, wxPoint* points, wxCoord xoffset=0, wxCoord yoffset=0);
650 void DrawPolygon(int PCOUNT, wxPoint* points, wxCoord xoffset=0, wxCoord yoffset=0,
651 int fill_style=wxODDEVEN_RULE);
652 void DrawPoint(wxCoord x, wxCoord y);
653 void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
654 %name(DrawRectangleRect)void DrawRectangle(const wxRect& rect);
655 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
656 void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxCoord radius=20);
657 void DrawSpline(int PCOUNT, wxPoint* points);
658 void DrawText(const wxString& text, wxCoord x, wxCoord y);
662 bool FloodFill(wxCoord x, wxCoord y, const wxColour& colour, int style=wxFLOOD_SURFACE);
663 wxBrush GetBackground();
665 wxCoord GetCharHeight();
666 wxCoord GetCharWidth();
667 void GetClippingBox(wxCoord *OUTPUT, wxCoord *OUTPUT,
668 wxCoord *OUTPUT, wxCoord *OUTPUT);
670 int GetLogicalFunction();
671 void GetLogicalScale(double *OUTPUT, double *OUTPUT);
673 bool GetOptimization();
676 %new wxColour* GetPixel(wxCoord x, wxCoord y) {
677 wxColour* wc = new wxColour();
678 self->GetPixel(x, y, wc);
682 %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
685 wxColour GetTextBackground();
686 void GetTextExtent(const wxString& string, wxCoord *OUTPUT, wxCoord *OUTPUT);
687 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
688 wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord* OUTPUT,
689 const wxFont* font = NULL);
690 void GetMultiLineTextExtent(const wxString& text, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT,
691 wxFont *font = NULL);
692 wxColour GetTextForeground();
693 void GetUserScale(double *OUTPUT, double *OUTPUT);
694 wxCoord LogicalToDeviceX(wxCoord x);
695 wxCoord LogicalToDeviceXRel(wxCoord x);
696 wxCoord LogicalToDeviceY(wxCoord y);
697 wxCoord LogicalToDeviceYRel(wxCoord y);
703 void SetDeviceOrigin(wxCoord x, wxCoord y);
704 void SetBackground(const wxBrush& brush);
705 void SetBackgroundMode(int mode);
706 void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
707 %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
708 %name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
709 void SetPalette(const wxPalette& colourMap);
710 void SetBrush(const wxBrush& brush);
711 void SetFont(const wxFont& font);
712 void SetLogicalFunction(int function);
713 void SetLogicalScale(double x, double y);
714 void SetMapMode(int mode);
715 void SetOptimization(bool optimize);
716 void SetPen(const wxPen& pen);
717 void SetTextBackground(const wxColour& colour);
718 void SetTextForeground(const wxColour& colour);
719 void SetUserScale(double x_scale, double y_scale);
720 bool StartDoc(const wxString& message);
725 void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y,
726 int useMask = FALSE);
728 bool CanDrawBitmap();
729 bool CanGetTextExtent();
733 void GetLogicalOrigin(int *OUTPUT, int *OUTPUT);
734 void SetLogicalOrigin(int x, int y);
735 void GetDeviceOrigin(int *OUTPUT, int *OUTPUT);
736 void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
738 void CalcBoundingBox(int x, int y);
739 void ResetBoundingBox();
742 void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
743 // See below for implementation
746 %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
753 %addmethods { // See drawlist.cpp for impplementaion of these...
755 PyObject* _DrawPointList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
757 return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes);
760 PyObject* _DrawLineList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
762 return wxPyDrawXXXList(*self, wxPyDrawXXXLine, pyCoords, pyPens, pyBrushes);
765 PyObject* _DrawRectangleList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
767 return wxPyDrawXXXList(*self, wxPyDrawXXXRectangle, pyCoords, pyPens, pyBrushes);
770 PyObject* _DrawEllipseList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
772 return wxPyDrawXXXList(*self, wxPyDrawXXXEllipse, pyCoords, pyPens, pyBrushes);
775 PyObject* _DrawPolygonList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
777 return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);
780 PyObject* _DrawTextList(PyObject* textList, PyObject* pyPoints,
781 PyObject* foregroundList, PyObject* backgroundList) {
782 return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);
786 %pragma(python) addtoclass = "
787 def DrawPointList(self, points, pens=None):
790 elif isinstance(pens, wxPenPtr):
792 elif len(pens) != len(points):
793 raise ValueError('points and pens must have same length')
794 return self._DrawPointList(points, pens, [])
797 def DrawLineList(self, lines, pens=None):
800 elif isinstance(pens, wxPenPtr):
802 elif len(pens) != len(lines):
803 raise ValueError('lines and pens must have same length')
804 return self._DrawLineList(lines, pens, [])
807 def DrawRectangleList(self, rectangles, pens=None, brushes=None):
810 elif isinstance(pens, wxPenPtr):
812 elif len(pens) != len(rectangles):
813 raise ValueError('rectangles and pens must have same length')
816 elif isinstance(brushes, wxBrushPtr):
818 elif len(brushes) != len(rectangles):
819 raise ValueError('rectangles and brushes must have same length')
820 return self._DrawRectangleList(rectangles, pens, brushes)
823 def DrawEllipseList(self, ellipses, pens=None, brushes=None):
826 elif isinstance(pens, wxPenPtr):
828 elif len(pens) != len(ellipses):
829 raise ValueError('ellipses and pens must have same length')
832 elif isinstance(brushes, wxBrushPtr):
834 elif len(brushes) != len(ellipses):
835 raise ValueError('ellipses and brushes must have same length')
836 return self._DrawEllipseList(ellipses, pens, brushes)
839 def DrawPolygonList(self, polygons, pens=None, brushes=None):
840 ## Note: This does not currently support fill style or offset
841 ## you can always use the non-List version if need be.
842 ## I really would like to support fill-style, however,
843 ## but wxODDEVEN_RULE does not appear to be defined at the Python level
844 ## [It's in wx.py... --Robin]
847 elif isinstance(pens, wxPenPtr):
849 elif len(pens) != len(polygons):
850 raise ValueError('polygons and pens must have same length')
853 elif isinstance(brushes, wxBrushPtr):
855 elif len(brushes) != len(polygons):
856 raise ValueError('polygons and brushes must have same length')
857 return self._DrawPolygonList(polygons, pens, brushes)
860 def DrawTextList(self, textList, coords, foregrounds = None, backgrounds = None, fonts = None):
861 ## NOTE: this does not currently support changing the font
862 ## Make sure you set Background mode to wxSolid (DC.SetBackgroundMode)
863 ## If you want backgounds to do anything.
864 if type(textList) == type(''):
865 textList = [textList]
866 elif len(textList) != len(coords):
867 raise ValueError('textlist and coords must have same length')
868 if foregrounds is None:
870 elif isinstance(foregrounds, wxColourPtr):
871 foregrounds = [foregrounds]
872 elif len(foregrounds) != len(coords):
873 raise ValueError('foregrounds and coords must have same length')
874 if backgrounds is None:
876 elif isinstance(backgrounds, wxColourPtr):
877 backgrounds = [backgrounds]
878 elif len(backgrounds) != len(coords):
879 raise ValueError('backgrounds and coords must have same length')
880 return self._DrawTextList(textList, coords, foregrounds, backgrounds)
889 static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
897 //----------------------------------------------------------------------
899 class wxMemoryDC : public wxDC {
903 void SelectObject(const wxBitmap& bitmap);
906 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
907 %{ // Alternate 'constructor'
908 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
909 return new wxMemoryDC(oldDC);
914 //---------------------------------------------------------------------------
916 class wxBufferedDC : public wxMemoryDC {
918 // Construct a wxBufferedDC using a user supplied buffer.
919 wxBufferedDC( wxDC *dc, const wxBitmap &buffer );
921 // Construct a wxBufferedDC with an internal buffer of 'area'
922 // (where area is usually something like the size of the window
924 %name(wxBufferedDCInternalBuffer)wxBufferedDC( wxDC *dc, const wxSize &area );
926 // Blits the buffer to the dc, and detaches the dc from
927 // the buffer. Usually called in the dtor or by the dtor
928 // of derived classes if the BufferedDC must blit before
929 // the derived class (which may own the dc it's blitting
934 %pragma(python) addtomethod =
935 "__init__:self._dc = _args[0] # save a ref so the other dc won't be deleted before self"
936 %pragma(python) addtomethod =
937 "wxBufferedDCInternalBuffer:val._dc = _args[0] # save a ref so the other dc won't be deleted before self"
941 class wxBufferedPaintDC : public wxBufferedDC
944 wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap );
947 //---------------------------------------------------------------------------
949 class wxScreenDC : public wxDC {
953 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
954 bool StartDrawingOnTop(wxRect* rect = NULL);
955 bool EndDrawingOnTop();
958 //---------------------------------------------------------------------------
960 class wxClientDC : public wxDC {
962 wxClientDC(wxWindow* win);
965 //---------------------------------------------------------------------------
967 class wxPaintDC : public wxDC {
969 wxPaintDC(wxWindow* win);
972 //---------------------------------------------------------------------------
974 class wxWindowDC : public wxDC {
976 wxWindowDC(wxWindow* win);
979 //---------------------------------------------------------------------------
985 #include <wx/metafile.h>
988 class wxMetaFile : public wxObject {
990 wxMetaFile(const wxString& filename = wxPyEmptyString);
994 bool SetClipboard(int width = 0, int height = 0);
1000 const wxString& GetFileName() const { return m_filename; }
1002 %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
1005 // bool wxMakeMetaFilePlaceable(const wxString& filename,
1006 // int minX, int minY, int maxX, int maxY, float scale=1.0);
1009 class wxMetaFileDC : public wxDC {
1011 wxMetaFileDC(const wxString& filename = wxPyEmptyString,
1012 int width = 0, int height = 0,
1013 const wxString& description = wxPyEmptyString);
1014 wxMetaFile* Close();
1019 //---------------------------------------------------------------------------
1021 class wxPalette : public wxGDIObject {
1023 wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices);
1026 int GetPixel(byte red, byte green, byte blue);
1027 bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
1030 %pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
1033 //---------------------------------------------------------------------------
1036 wxIMAGELIST_DRAW_NORMAL ,
1037 wxIMAGELIST_DRAW_TRANSPARENT,
1038 wxIMAGELIST_DRAW_SELECTED,
1039 wxIMAGELIST_DRAW_FOCUSED,
1040 wxIMAGE_LIST_NORMAL,
1045 class wxImageList : public wxObject {
1047 wxImageList(int width, int height, int mask=TRUE, int initialCount=1);
1050 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
1051 %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour);
1052 %name(AddIcon)int Add(const wxIcon& icon);
1054 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
1056 // %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon);
1057 // int Add(const wxBitmap& bitmap);
1058 bool Replace(int index, const wxBitmap& bitmap);
1061 bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL,
1062 const bool solidBackground = FALSE);
1064 int GetImageCount();
1065 bool Remove(int index);
1067 void GetSize(int index, int& OUTPUT, int& OUTPUT);
1071 //---------------------------------------------------------------------------
1074 enum wxRegionContain {
1075 wxOutRegion, wxPartRegion, wxInRegion
1079 class wxRegion : public wxGDIObject {
1081 wxRegion(wxCoord x=0, wxCoord y=0, wxCoord width=0, wxCoord height=0);
1083 %name(wxRegionFromPoints)wxRegion(int PCOUNT, wxPoint* points, int fillStyle = wxWINDING_RULE);
1085 %name(wxRegionFromBitmap)wxRegion(const wxBitmap& bmp,
1086 const wxColour& transColour = wxNullColour,
1093 bool Offset(wxCoord x, wxCoord y);
1096 wxRegionContain Contains(wxCoord x, wxCoord y);
1097 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
1098 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
1099 %name(ContainsRectDim)wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
1103 bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
1104 %name(IntersectRect)bool Intersect(const wxRect& rect);
1105 %name(IntersectRegion)bool Intersect(const wxRegion& region);
1109 bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
1110 %name(UnionRect)bool Union(const wxRect& rect);
1111 %name(UnionRegion)bool Union(const wxRegion& region);
1113 bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
1114 %name(SubtractRect)bool Subtract(const wxRect& rect);
1115 %name(SubtractRegion)bool Subtract(const wxRegion& region);
1117 bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
1118 %name(XorRect)bool Xor(const wxRect& rect);
1119 %name(XorRegion)bool Xor(const wxRegion& region);
1121 // Convert the region to a B&W bitmap with the white pixels being inside
1123 wxBitmap ConvertToBitmap();
1125 // Use the non-transparent pixels of a wxBitmap for the region to combine
1126 // with this region. If the bitmap has a mask then it will be used,
1127 // otherwise the colour to be treated as transparent may be specified,
1128 // along with an optional tolerance value.
1129 %name(UnionBitmap)bool Union(const wxBitmap& bmp,
1130 const wxColour& transColour = wxNullColour,
1136 class wxRegionIterator : public wxObject {
1138 wxRegionIterator(const wxRegion& region);
1139 ~wxRegionIterator();
1146 wxCoord GetHeight();
1159 //---------------------------------------------------------------------------
1167 extern wxFont *wxNORMAL_FONT;
1168 extern wxFont *wxSMALL_FONT;
1169 extern wxFont *wxITALIC_FONT;
1170 extern wxFont *wxSWISS_FONT;
1172 extern wxPen *wxRED_PEN;
1173 extern wxPen *wxCYAN_PEN;
1174 extern wxPen *wxGREEN_PEN;
1175 extern wxPen *wxBLACK_PEN;
1176 extern wxPen *wxWHITE_PEN;
1177 extern wxPen *wxTRANSPARENT_PEN;
1178 extern wxPen *wxBLACK_DASHED_PEN;
1179 extern wxPen *wxGREY_PEN;
1180 extern wxPen *wxMEDIUM_GREY_PEN;
1181 extern wxPen *wxLIGHT_GREY_PEN;
1183 extern wxBrush *wxBLUE_BRUSH;
1184 extern wxBrush *wxGREEN_BRUSH;
1185 extern wxBrush *wxWHITE_BRUSH;
1186 extern wxBrush *wxBLACK_BRUSH;
1187 extern wxBrush *wxTRANSPARENT_BRUSH;
1188 extern wxBrush *wxCYAN_BRUSH;
1189 extern wxBrush *wxRED_BRUSH;
1190 extern wxBrush *wxGREY_BRUSH;
1191 extern wxBrush *wxMEDIUM_GREY_BRUSH;
1192 extern wxBrush *wxLIGHT_GREY_BRUSH;
1194 extern wxColour *wxBLACK;
1195 extern wxColour *wxWHITE;
1196 extern wxColour *wxRED;
1197 extern wxColour *wxBLUE;
1198 extern wxColour *wxGREEN;
1199 extern wxColour *wxCYAN;
1200 extern wxColour *wxLIGHT_GREY;
1202 extern wxCursor *wxSTANDARD_CURSOR;
1203 extern wxCursor *wxHOURGLASS_CURSOR;
1204 extern wxCursor *wxCROSS_CURSOR;
1207 extern wxBitmap wxNullBitmap;
1208 extern wxIcon wxNullIcon;
1209 extern wxCursor wxNullCursor;
1210 extern wxPen wxNullPen;
1211 extern wxBrush wxNullBrush;
1212 extern wxPalette wxNullPalette;
1213 extern wxFont wxNullFont;
1214 extern wxColour wxNullColour;
1217 extern wxFontList* wxTheFontList;
1218 extern wxPenList* wxThePenList;
1219 extern wxBrushList* wxTheBrushList;
1220 extern wxColourDatabase* wxTheColourDatabase;
1228 //---------------------------------------------------------------------------
1229 //---------------------------------------------------------------------------