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);
111 // Declarations of some alternate "constructors"
112 %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
113 %new wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings);
114 %new wxBitmap* wxBitmapFromIcon(const wxIcon& icon);
115 %new wxBitmap* wxBitmapFromBits(PyObject* bits, int width, int height, int depth = 1 );
118 // %new wxBitmap* wxBitmapFromData(PyObject* data, long type,
119 // int width, int height, int depth = 1);
124 %{ // Implementations of some alternate "constructors"
126 wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
127 return new wxBitmap(width, height, depth);
130 static char** ConvertListOfStrings(PyObject* listOfStrings) {
131 char** cArray = NULL;
134 if (!PyList_Check(listOfStrings)) {
135 PyErr_SetString(PyExc_TypeError, "Expected a list of strings.");
138 count = PyList_Size(listOfStrings);
139 cArray = new char*[count];
141 for(int x=0; x<count; x++) {
142 // TODO: Need some validation and error checking here
143 cArray[x] = PyString_AsString(PyList_GET_ITEM(listOfStrings, x));
149 wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings) {
150 char** cArray = NULL;
153 cArray = ConvertListOfStrings(listOfStrings);
156 bmp = new wxBitmap(cArray);
162 wxBitmap* wxBitmapFromIcon(const wxIcon& icon) {
163 return new wxBitmap(icon);
167 wxBitmap* wxBitmapFromBits(PyObject* bits, int width, int height, int depth = 1 ) {
170 PyString_AsStringAndSize(bits, &buf, &length);
171 return new wxBitmap(buf, width, height, depth);
176 // wxBitmap* wxBitmapFromData(PyObject* data, long type,
177 // int width, int height, int depth = 1) {
178 // if (! PyString_Check(data)) {
179 // PyErr_SetString(PyExc_TypeError, "Expected string object");
182 // return new wxBitmap((void*)PyString_AsString(data), type, width, height, depth);
187 //---------------------------------------------------------------------------
189 class wxMask : public wxObject {
191 wxMask(const wxBitmap& bitmap);
194 %addmethods { void Destroy() { delete self; } }
197 %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
199 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
200 return new wxMask(bitmap, colour);
205 //---------------------------------------------------------------------------
208 class wxIcon : public wxGDIObject
211 wxIcon(const wxString& name, long flags,
212 int desiredWidth = -1, int desiredHeight = -1);
216 bool LoadFile(const wxString& name, long flags);
219 // wxGDIImage methods
222 void SetHandle(long handle);
228 void SetWidth(int w);
229 void SetHeight(int h);
230 void SetDepth(int d);
232 void SetSize(const wxSize& size);
234 void CopyFromBitmap(const wxBitmap& bmp);
239 // Declarations of some alternate "constructors"
240 %new wxIcon* wxEmptyIcon();
241 %new wxIcon* wxIconFromXPMData(PyObject* listOfStrings);
242 %new wxIcon* wxIconFromBitmap(const wxBitmap& bmp);
244 %{ // Implementations of some alternate "constructors"
245 wxIcon* wxEmptyIcon() {
249 wxIcon* wxIconFromXPMData(PyObject* listOfStrings) {
250 char** cArray = NULL;
253 cArray = ConvertListOfStrings(listOfStrings);
256 icon = new wxIcon(cArray);
261 wxIcon* wxIconFromBitmap(const wxBitmap& bmp) {
262 wxIcon* icon = new wxIcon();
263 icon->CopyFromBitmap(bmp);
268 //---------------------------------------------------------------------------
273 // default constructor
276 // initializes the bundle with the icon(s) found in the file
277 %name(wxIconBundleFromFile) wxIconBundle( const wxString& file, long type );
279 // initializes the bundle with a single icon
280 %name(wxIconBundleFromIcon)wxIconBundle( const wxIcon& icon );
284 // adds the icon to the collection, if the collection already
285 // contains an icon with the same width and height, it is
287 void AddIcon( const wxIcon& icon );
289 // adds all the icons contained in the file to the collection,
290 // if the collection already contains icons with the same
291 // width and height, they are replaced
292 %name(AddIconFromFile)void AddIcon( const wxString& file, long type );
294 // returns the icon with the given size; if no such icon exists,
295 // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists,
296 // returns the first icon in the bundle
297 const wxIcon& GetIcon( const wxSize& size ) const;
300 //---------------------------------------------------------------------------
302 class wxCursor : public wxGDIObject
306 wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
310 // wxGDIImage methods
313 void SetHandle(long handle);
320 void SetWidth(int w);
321 void SetHeight(int h);
322 void SetDepth(int d);
323 void SetSize(const wxSize& size);
327 %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
328 %{ // Alternate 'constructor'
329 wxCursor* wxPyStockCursor(int id) {
330 return new wxCursor(id);
334 %new wxCursor* wxCursorFromImage(const wxImage& image);
336 wxCursor* wxCursorFromImage(const wxImage& image) {
338 return new wxCursor(image);
345 //----------------------------------------------------------------------
347 class wxColour : public wxObject {
349 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
352 unsigned char Green();
353 unsigned char Blue();
355 void Set(unsigned char red, unsigned char green, unsigned char blue);
358 PyObject* rv = PyTuple_New(3);
364 green = self->Green();
367 PyTuple_SetItem(rv, 0, PyInt_FromLong(red));
368 PyTuple_SetItem(rv, 1, PyInt_FromLong(green));
369 PyTuple_SetItem(rv, 2, PyInt_FromLong(blue));
372 bool __eq__(PyObject* obj) {
374 wxColour* ptr = &tmp;
375 if (obj == Py_None) return FALSE;
376 wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
377 if (! success) return FALSE;
378 return *self == *ptr;
380 bool __ne__(PyObject* obj) {
382 wxColour* ptr = &tmp;
383 if (obj == Py_None) return TRUE;
384 wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
385 if (! success) return TRUE;
386 return *self != *ptr;
390 %pragma(python) addtoclass = "asTuple = Get
391 def __str__(self): return str(self.asTuple())
392 def __repr__(self): return 'wxColour:' + str(self.asTuple())
393 def __nonzero__(self): return self.Ok()
394 def __getinitargs__(self): return ()
395 def __getstate__(self): return self.asTuple()
396 def __setstate__(self, state): self.Set(*state)
401 %new wxColour* wxNamedColour(const wxString& colorName);
403 %{ // Alternate 'constructor'
404 wxColour* wxNamedColour(const wxString& colorName) {
405 return new wxColour(colorName);
411 class wxColourDatabase : public wxObject {
414 wxColour *FindColour(const wxString& colour);
415 wxString FindName(const wxColour& colour) const;
418 void Append(const wxString& name, int red, int green, int blue) {
419 // first see if the name is already there
420 wxString cName = name;
422 wxString cName2 = cName;
423 if ( !cName2.Replace(wxT("GRAY"), wxT("GREY")) )
426 wxNode *node = self->GetFirst();
428 const wxChar *key = node->GetKeyString();
429 if ( cName == key || cName2 == key ) {
430 wxColour* c = (wxColour *)node->GetData();
431 c->Set(red, green, blue);
434 node = node->GetNext();
437 // otherwise append the new colour
438 self->Append(name.c_str(), new wxColour(red, green, blue));
444 //----------------------------------------------------------------------
446 class wxPen : public wxGDIObject {
448 wxPen(wxColour& colour, int width=1, int style=wxSOLID);
452 wxColour GetColour();
458 void SetCap(int cap_style);
459 void SetColour(wxColour& colour);
460 void SetJoin(int join_style);
461 void SetStyle(int style);
462 void SetWidth(int width);
465 void SetDashes(int LCOUNT, wxDash* choices);
466 //int GetDashes(wxDash **dashes);
468 PyObject* GetDashes() {
470 int count = self->GetDashes(&dashes);
471 wxPyBeginBlockThreads();
472 PyObject* retval = PyList_New(0);
473 for (int x=0; x<count; x++)
474 PyList_Append(retval, PyInt_FromLong(dashes[x]));
475 wxPyEndBlockThreads();
481 wxBitmap* GetStipple();
482 void SetStipple(wxBitmap& stipple);
489 // The list of ints for the dashes needs to exist for the life of the pen
490 // so we make it part of the class to save it. wxPyPen is aliased to wxPen
494 class wxPyPen : public wxPen {
496 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID)
497 : wxPen(colour, width, style)
504 void SetDashes(int nb_dashes, const wxDash *dash) {
507 m_dash = new wxDash[nb_dashes];
508 for (int i=0; i<nb_dashes; i++) {
511 wxPen::SetDashes(nb_dashes, m_dash);
520 class wxPyPen : public wxPen {
522 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID);
525 void SetDashes(int LCOUNT, wxDash* choices);
531 class wxPenList : public wxObject {
534 void AddPen(wxPen* pen);
535 wxPen* FindOrCreatePen(const wxColour& colour, int width, int style);
536 void RemovePen(wxPen* pen);
543 //----------------------------------------------------------------------
545 class wxBrush : public wxGDIObject {
547 wxBrush(const wxColour& colour, int style=wxSOLID);
550 wxColour GetColour();
551 wxBitmap * GetStipple();
554 void SetColour(wxColour &colour);
555 void SetStipple(wxBitmap& bitmap);
556 void SetStyle(int style);
560 class wxBrushList : public wxObject {
563 void AddBrush(wxBrush *brush);
564 wxBrush * FindOrCreateBrush(const wxColour& colour, int style);
565 void RemoveBrush(wxBrush *brush);
570 //----------------------------------------------------------------------
573 class wxDC : public wxObject {
575 // wxDC(); **** abstract base class, can't instantiate.
581 bool Blit(wxCoord xdest, wxCoord ydest,
582 wxCoord width, wxCoord height,
583 wxDC *source, wxCoord xsrc, wxCoord ysrc,
584 int logicalFunc = wxCOPY, int useMask = FALSE);
585 // bool Blit(const wxPoint& destPt, const wxSize& sz,
586 // wxDC *source, const wxPoint& srcPt,
587 // int logicalFunc = wxCOPY, int useMask = FALSE);
590 void CrossHair(wxCoord x, wxCoord y);
591 void DestroyClippingRegion();
592 wxCoord DeviceToLogicalX(wxCoord x);
593 wxCoord DeviceToLogicalXRel(wxCoord x);
594 wxCoord DeviceToLogicalY(wxCoord y);
595 wxCoord DeviceToLogicalYRel(wxCoord y);
596 void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
597 void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
598 void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
599 void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxCoord start, wxCoord end);
600 void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
602 void DrawLabel(const wxString& text, const wxRect& rect,
603 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
604 int indexAccel = -1);
607 wxRect DrawImageLabel(const wxString& text,
608 const wxBitmap& image,
610 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
611 int indexAccel = -1) {
613 self->DrawLabel(text, image, rect, alignment, indexAccel, &rv);
618 void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
619 void DrawLines(int PCOUNT, wxPoint* points, wxCoord xoffset=0, wxCoord yoffset=0);
620 void DrawPolygon(int PCOUNT, wxPoint* points, wxCoord xoffset=0, wxCoord yoffset=0,
621 int fill_style=wxODDEVEN_RULE);
622 void DrawPoint(wxCoord x, wxCoord y);
623 void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
624 %name(DrawRectangleRect)void DrawRectangle(const wxRect& rect);
625 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
626 void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxCoord radius=20);
627 void DrawSpline(int PCOUNT, wxPoint* points);
628 void DrawText(const wxString& text, wxCoord x, wxCoord y);
632 bool FloodFill(wxCoord x, wxCoord y, const wxColour& colour, int style=wxFLOOD_SURFACE);
633 wxBrush GetBackground();
635 wxCoord GetCharHeight();
636 wxCoord GetCharWidth();
637 void GetClippingBox(wxCoord *OUTPUT, wxCoord *OUTPUT,
638 wxCoord *OUTPUT, wxCoord *OUTPUT);
640 int GetLogicalFunction();
641 void GetLogicalScale(double *OUTPUT, double *OUTPUT);
643 bool GetOptimization();
646 %new wxColour* GetPixel(wxCoord x, wxCoord y) {
647 wxColour* wc = new wxColour();
648 self->GetPixel(x, y, wc);
652 %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
655 wxColour GetTextBackground();
656 void GetTextExtent(const wxString& string, wxCoord *OUTPUT, wxCoord *OUTPUT);
657 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
658 wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord* OUTPUT,
659 const wxFont* font = NULL);
660 void GetMultiLineTextExtent(const wxString& text, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT,
661 wxFont *font = NULL);
662 wxColour GetTextForeground();
663 void GetUserScale(double *OUTPUT, double *OUTPUT);
664 wxCoord LogicalToDeviceX(wxCoord x);
665 wxCoord LogicalToDeviceXRel(wxCoord x);
666 wxCoord LogicalToDeviceY(wxCoord y);
667 wxCoord LogicalToDeviceYRel(wxCoord y);
673 void SetDeviceOrigin(wxCoord x, wxCoord y);
674 void SetBackground(const wxBrush& brush);
675 void SetBackgroundMode(int mode);
676 void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
677 %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
678 %name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
679 void SetPalette(const wxPalette& colourMap);
680 void SetBrush(const wxBrush& brush);
681 void SetFont(const wxFont& font);
682 void SetLogicalFunction(int function);
683 void SetLogicalScale(double x, double y);
684 void SetMapMode(int mode);
685 void SetOptimization(bool optimize);
686 void SetPen(const wxPen& pen);
687 void SetTextBackground(const wxColour& colour);
688 void SetTextForeground(const wxColour& colour);
689 void SetUserScale(double x_scale, double y_scale);
690 bool StartDoc(const wxString& message);
695 void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y,
696 int useMask = FALSE);
698 bool CanDrawBitmap();
699 bool CanGetTextExtent();
703 void GetLogicalOrigin(int *OUTPUT, int *OUTPUT);
704 void SetLogicalOrigin(int x, int y);
705 void GetDeviceOrigin(int *OUTPUT, int *OUTPUT);
706 void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
708 void CalcBoundingBox(int x, int y);
709 void ResetBoundingBox();
712 void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
713 // See below for implementation
721 %addmethods { // See drawlist.cpp for impplementaion of these...
723 PyObject* _DrawPointList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
725 return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes);
728 PyObject* _DrawLineList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
730 return wxPyDrawXXXList(*self, wxPyDrawXXXLine, pyCoords, pyPens, pyBrushes);
733 PyObject* _DrawRectangleList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
735 return wxPyDrawXXXList(*self, wxPyDrawXXXRectangle, pyCoords, pyPens, pyBrushes);
738 PyObject* _DrawEllipseList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
740 return wxPyDrawXXXList(*self, wxPyDrawXXXEllipse, pyCoords, pyPens, pyBrushes);
743 PyObject* _DrawPolygonList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
745 return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);
748 PyObject* _DrawTextList(PyObject* textList, PyObject* pyPoints,
749 PyObject* foregroundList, PyObject* backgroundList) {
750 return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);
754 %pragma(python) addtoclass = "
755 def DrawPointList(self, points, pens=None):
758 elif isinstance(pens, wxPenPtr):
760 elif len(pens) != len(points):
761 raise ValueError('points and pens must have same length')
762 return self._DrawPointList(points, pens, [])
765 def DrawLineList(self, lines, pens=None):
768 elif isinstance(pens, wxPenPtr):
770 elif len(pens) != len(lines):
771 raise ValueError('lines and pens must have same length')
772 return self._DrawLineList(lines, pens, [])
775 def DrawRectangleList(self, rectangles, pens=None, brushes=None):
778 elif isinstance(pens, wxPenPtr):
780 elif len(pens) != len(rectangles):
781 raise ValueError('rectangles and pens must have same length')
784 elif isinstance(brushes, wxBrushPtr):
786 elif len(brushes) != len(rectangles):
787 raise ValueError('rectangles and brushes must have same length')
788 return self._DrawRectangleList(rectangles, pens, brushes)
791 def DrawEllipseList(self, ellipses, pens=None, brushes=None):
794 elif isinstance(pens, wxPenPtr):
796 elif len(pens) != len(ellipses):
797 raise ValueError('ellipses and pens must have same length')
800 elif isinstance(brushes, wxBrushPtr):
802 elif len(brushes) != len(ellipses):
803 raise ValueError('ellipses and brushes must have same length')
804 return self._DrawEllipseList(ellipses, pens, brushes)
807 def DrawPolygonList(self, polygons, pens=None, brushes=None):
808 ## Note: This does not currently support fill style or offset
809 ## you can always use the non-List version if need be.
810 ## I really would like to support fill-style, however,
811 ## but wxODDEVEN_RULE does not appear to be defined at the Python level
812 ## [It's in wx.py... --Robin]
815 elif isinstance(pens, wxPenPtr):
817 elif len(pens) != len(polygons):
818 raise ValueError('polygons and pens must have same length')
821 elif isinstance(brushes, wxBrushPtr):
823 elif len(brushes) != len(polygons):
824 raise ValueError('polygons and brushes must have same length')
825 return self._DrawPolygonList(polygons, pens, brushes)
828 def DrawTextList(self, textList, coords, foregrounds = None, backgrounds = None, fonts = None):
829 ## NOTE: this does not currently support changing the font
830 ## Make sure you set Background mode to wxSolid (DC.SetBackgroundMode)
831 ## If you want backgounds to do anything.
832 if type(textList) == type(''):
833 textList = [textList]
834 elif len(textList) != len(coords):
835 raise ValueError('textlist and coords must have same length')
836 if foregrounds is None:
838 elif isinstance(foregrounds, wxColourPtr):
839 foregrounds = [foregrounds]
840 elif len(foregrounds) != len(coords):
841 raise ValueError('foregrounds and coords must have same length')
842 if backgrounds is None:
844 elif isinstance(backgrounds, wxColourPtr):
845 backgrounds = [backgrounds]
846 elif len(backgrounds) != len(coords):
847 raise ValueError('backgrounds and coords must have same length')
848 return self._DrawTextList(textList, coords, foregrounds, backgrounds)
857 static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
865 //----------------------------------------------------------------------
867 class wxMemoryDC : public wxDC {
871 void SelectObject(const wxBitmap& bitmap);
874 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
875 %{ // Alternate 'constructor'
876 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
877 return new wxMemoryDC(oldDC);
882 //---------------------------------------------------------------------------
884 class wxBufferedDC : public wxMemoryDC {
886 // Construct a wxBufferedDC using a user supplied buffer.
887 wxBufferedDC( wxDC *dc, const wxBitmap &buffer );
889 // Construct a wxBufferedDC with an internal buffer of 'area'
890 // (where area is usually something like the size of the window
892 %name(wxBufferedDCInternalBuffer)wxBufferedDC( wxDC *dc, const wxSize &area );
894 // Blits the buffer to the dc, and detaches the dc from
895 // the buffer. Usually called in the dtor or by the dtor
896 // of derived classes if the BufferedDC must blit before
897 // the derived class (which may own the dc it's blitting
902 %pragma(python) addtomethod =
903 "__init__:self._dc = _args[0] # save a ref so the other dc won't be deleted before self"
904 %pragma(python) addtomethod =
905 "wxBufferedDCInternalBuffer:val._dc = _args[0] # save a ref so the other dc won't be deleted before self"
909 class wxBufferedPaintDC : public wxBufferedDC
912 wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap );
915 //---------------------------------------------------------------------------
917 class wxScreenDC : public wxDC {
921 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
922 bool StartDrawingOnTop(wxRect* rect = NULL);
923 bool EndDrawingOnTop();
926 //---------------------------------------------------------------------------
928 class wxClientDC : public wxDC {
930 wxClientDC(wxWindow* win);
933 //---------------------------------------------------------------------------
935 class wxPaintDC : public wxDC {
937 wxPaintDC(wxWindow* win);
940 //---------------------------------------------------------------------------
942 class wxWindowDC : public wxDC {
944 wxWindowDC(wxWindow* win);
947 //---------------------------------------------------------------------------
953 #include <wx/metafile.h>
956 class wxMetaFile : public wxObject {
958 wxMetaFile(const wxString& filename = wxPyEmptyString);
962 bool SetClipboard(int width = 0, int height = 0);
968 const wxString& GetFileName() const { return m_filename; }
972 // bool wxMakeMetaFilePlaceable(const wxString& filename,
973 // int minX, int minY, int maxX, int maxY, float scale=1.0);
976 class wxMetaFileDC : public wxDC {
978 wxMetaFileDC(const wxString& filename = wxPyEmptyString,
979 int width = 0, int height = 0,
980 const wxString& description = wxPyEmptyString);
986 //---------------------------------------------------------------------------
988 class wxPalette : public wxGDIObject {
990 wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices);
993 int GetPixel(byte red, byte green, byte blue);
994 bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
998 //---------------------------------------------------------------------------
1001 wxIMAGELIST_DRAW_NORMAL ,
1002 wxIMAGELIST_DRAW_TRANSPARENT,
1003 wxIMAGELIST_DRAW_SELECTED,
1004 wxIMAGELIST_DRAW_FOCUSED,
1005 wxIMAGE_LIST_NORMAL,
1010 class wxImageList : public wxObject {
1012 wxImageList(int width, int height, int mask=TRUE, int initialCount=1);
1015 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
1016 %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour);
1017 %name(AddIcon)int Add(const wxIcon& icon);
1019 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
1021 // %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon);
1022 // int Add(const wxBitmap& bitmap);
1023 bool Replace(int index, const wxBitmap& bitmap);
1026 bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL,
1027 const bool solidBackground = FALSE);
1029 int GetImageCount();
1030 bool Remove(int index);
1032 void GetSize(int index, int& OUTPUT, int& OUTPUT);
1036 //---------------------------------------------------------------------------
1039 enum wxRegionContain {
1040 wxOutRegion, wxPartRegion, wxInRegion
1044 class wxRegion : public wxGDIObject {
1046 wxRegion(wxCoord x=0, wxCoord y=0, wxCoord width=0, wxCoord height=0);
1048 %name(wxRegionFromPoints)wxRegion(int PCOUNT, wxPoint* points, int fillStyle = wxWINDING_RULE);
1050 %name(wxRegionFromBitmap)wxRegion(const wxBitmap& bmp,
1051 const wxColour& transColour = wxNullColour,
1058 bool Offset(wxCoord x, wxCoord y);
1061 wxRegionContain Contains(wxCoord x, wxCoord y);
1062 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
1063 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
1064 %name(ContainsRectDim)wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
1068 bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
1069 %name(IntersectRect)bool Intersect(const wxRect& rect);
1070 %name(IntersectRegion)bool Intersect(const wxRegion& region);
1074 bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
1075 %name(UnionRect)bool Union(const wxRect& rect);
1076 %name(UnionRegion)bool Union(const wxRegion& region);
1078 bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
1079 %name(SubtractRect)bool Subtract(const wxRect& rect);
1080 %name(SubtractRegion)bool Subtract(const wxRegion& region);
1082 bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
1083 %name(XorRect)bool Xor(const wxRect& rect);
1084 %name(XorRegion)bool Xor(const wxRegion& region);
1086 // Convert the region to a B&W bitmap with the black pixels being inside
1088 wxBitmap ConvertToBitmap();
1090 // Use the non-transparent pixels of a wxBitmap for the region to combine
1091 // with this region. If the bitmap has a mask then it will be used,
1092 // otherwise the colour to be treated as transparent may be specified,
1093 // along with an optional tolerance value.
1094 %name(UnionBitmap)bool Union(const wxBitmap& bmp,
1095 const wxColour& transColour = wxNullColour,
1101 class wxRegionIterator : public wxObject {
1103 wxRegionIterator(const wxRegion& region);
1104 ~wxRegionIterator();
1111 wxCoord GetHeight();
1124 //---------------------------------------------------------------------------
1132 extern wxFont *wxNORMAL_FONT;
1133 extern wxFont *wxSMALL_FONT;
1134 extern wxFont *wxITALIC_FONT;
1135 extern wxFont *wxSWISS_FONT;
1137 extern wxPen *wxRED_PEN;
1138 extern wxPen *wxCYAN_PEN;
1139 extern wxPen *wxGREEN_PEN;
1140 extern wxPen *wxBLACK_PEN;
1141 extern wxPen *wxWHITE_PEN;
1142 extern wxPen *wxTRANSPARENT_PEN;
1143 extern wxPen *wxBLACK_DASHED_PEN;
1144 extern wxPen *wxGREY_PEN;
1145 extern wxPen *wxMEDIUM_GREY_PEN;
1146 extern wxPen *wxLIGHT_GREY_PEN;
1148 extern wxBrush *wxBLUE_BRUSH;
1149 extern wxBrush *wxGREEN_BRUSH;
1150 extern wxBrush *wxWHITE_BRUSH;
1151 extern wxBrush *wxBLACK_BRUSH;
1152 extern wxBrush *wxTRANSPARENT_BRUSH;
1153 extern wxBrush *wxCYAN_BRUSH;
1154 extern wxBrush *wxRED_BRUSH;
1155 extern wxBrush *wxGREY_BRUSH;
1156 extern wxBrush *wxMEDIUM_GREY_BRUSH;
1157 extern wxBrush *wxLIGHT_GREY_BRUSH;
1159 extern wxColour *wxBLACK;
1160 extern wxColour *wxWHITE;
1161 extern wxColour *wxRED;
1162 extern wxColour *wxBLUE;
1163 extern wxColour *wxGREEN;
1164 extern wxColour *wxCYAN;
1165 extern wxColour *wxLIGHT_GREY;
1167 extern wxCursor *wxSTANDARD_CURSOR;
1168 extern wxCursor *wxHOURGLASS_CURSOR;
1169 extern wxCursor *wxCROSS_CURSOR;
1172 extern wxBitmap wxNullBitmap;
1173 extern wxIcon wxNullIcon;
1174 extern wxCursor wxNullCursor;
1175 extern wxPen wxNullPen;
1176 extern wxBrush wxNullBrush;
1177 extern wxPalette wxNullPalette;
1178 extern wxFont wxNullFont;
1179 extern wxColour wxNullColour;
1182 extern wxFontList* wxTheFontList;
1183 extern wxPenList* wxThePenList;
1184 extern wxBrushList* wxTheBrushList;
1185 extern wxColourDatabase* wxTheColourDatabase;
1193 //---------------------------------------------------------------------------
1194 //---------------------------------------------------------------------------