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 //---------------------------------------------------------------------------
60 class wxBitmap : public wxGDIObject
63 wxBitmap(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_ANY);
66 wxPalette* GetPalette();
68 bool LoadFile(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_ANY);
69 bool SaveFile(const wxString& name, wxBitmapType type, wxPalette* palette = NULL);
70 void SetMask(wxMask* mask);
71 %pragma(python) addtoclass = "
72 def SetMaskColour(self, colour):
73 mask = wxMaskColour(self, colour)
77 void SetPalette(wxPalette& palette);
83 void SetHandle(long handle);
90 void SetHeight(int h);
93 void SetSize(const wxSize& size);
96 wxBitmap GetSubBitmap( const wxRect& rect );
97 bool CopyFromIcon(const wxIcon& icon);
99 bool CopyFromCursor(const wxCursor& cursor);
101 void SetQuality(int q);
107 // Declarations of some alternate "constructors"
108 %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
109 %new wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings);
110 %new wxBitmap* wxBitmapFromIcon(const wxIcon& icon);
111 %new wxBitmap* wxBitmapFromBits(PyObject* bits, int width, int height, int depth = 1 );
114 // %new wxBitmap* wxBitmapFromData(PyObject* data, long type,
115 // int width, int height, int depth = 1);
120 %{ // Implementations of some alternate "constructors"
122 wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
123 return new wxBitmap(width, height, depth);
126 static char** ConvertListOfStrings(PyObject* listOfStrings) {
127 char** cArray = NULL;
130 if (!PyList_Check(listOfStrings)) {
131 PyErr_SetString(PyExc_TypeError, "Expected a list of strings.");
134 count = PyList_Size(listOfStrings);
135 cArray = new char*[count];
137 for(int x=0; x<count; x++) {
138 // TODO: Need some validation and error checking here
139 cArray[x] = PyString_AsString(PyList_GET_ITEM(listOfStrings, x));
145 wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings) {
146 char** cArray = NULL;
149 cArray = ConvertListOfStrings(listOfStrings);
152 bmp = new wxBitmap(cArray);
158 wxBitmap* wxBitmapFromIcon(const wxIcon& icon) {
159 return new wxBitmap(icon);
163 wxBitmap* wxBitmapFromBits(PyObject* bits, int width, int height, int depth = 1 ) {
166 PyString_AsStringAndSize(bits, &buf, &length);
167 return new wxBitmap(buf, width, height, depth);
172 // wxBitmap* wxBitmapFromData(PyObject* data, long type,
173 // int width, int height, int depth = 1) {
174 // if (! PyString_Check(data)) {
175 // PyErr_SetString(PyExc_TypeError, "Expected string object");
178 // return new wxBitmap((void*)PyString_AsString(data), type, width, height, depth);
183 //---------------------------------------------------------------------------
185 class wxMask : public wxObject {
187 wxMask(const wxBitmap& bitmap);
190 %addmethods { void Destroy() { delete self; } }
193 %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
195 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
196 return new wxMask(bitmap, colour);
201 //---------------------------------------------------------------------------
204 class wxIcon : public wxGDIObject
207 wxIcon(const wxString& name, long flags,
208 int desiredWidth = -1, int desiredHeight = -1);
212 bool LoadFile(const wxString& name, long flags);
215 // wxGDIImage methods
218 void SetHandle(long handle);
224 void SetWidth(int w);
225 void SetHeight(int h);
226 void SetDepth(int d);
228 void SetSize(const wxSize& size);
230 void CopyFromBitmap(const wxBitmap& bmp);
235 // Declarations of some alternate "constructors"
236 %new wxIcon* wxEmptyIcon();
237 %new wxIcon* wxIconFromXPMData(PyObject* listOfStrings);
238 %new wxIcon* wxIconFromBitmap(const wxBitmap& bmp);
240 %{ // Implementations of some alternate "constructors"
241 wxIcon* wxEmptyIcon() {
245 wxIcon* wxIconFromXPMData(PyObject* listOfStrings) {
246 char** cArray = NULL;
249 cArray = ConvertListOfStrings(listOfStrings);
252 icon = new wxIcon(cArray);
257 wxIcon* wxIconFromBitmap(const wxBitmap& bmp) {
258 wxIcon* icon = new wxIcon();
259 icon->CopyFromBitmap(bmp);
264 //---------------------------------------------------------------------------
269 // default constructor
272 // initializes the bundle with the icon(s) found in the file
273 %name(wxIconBundleFromFile) wxIconBundle( const wxString& file, long type );
275 // initializes the bundle with a single icon
276 %name(wxIconBundleFromIcon)wxIconBundle( const wxIcon& icon );
280 // adds the icon to the collection, if the collection already
281 // contains an icon with the same width and height, it is
283 void AddIcon( const wxIcon& icon );
285 // adds all the icons contained in the file to the collection,
286 // if the collection already contains icons with the same
287 // width and height, they are replaced
288 %name(AddIconFromFile)void AddIcon( const wxString& file, long type );
290 // returns the icon with the given size; if no such icon exists,
291 // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists,
292 // returns the first icon in the bundle
293 const wxIcon& GetIcon( const wxSize& size ) const;
296 //---------------------------------------------------------------------------
298 class wxCursor : public wxGDIObject
302 wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
306 // wxGDIImage methods
309 void SetHandle(long handle);
316 void SetWidth(int w);
317 void SetHeight(int h);
318 void SetDepth(int d);
319 void SetSize(const wxSize& size);
323 %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
324 %{ // Alternate 'constructor'
325 wxCursor* wxPyStockCursor(int id) {
326 return new wxCursor(id);
330 %new wxCursor* wxCursorFromImage(const wxImage& image);
332 wxCursor* wxCursorFromImage(const wxImage& image) {
334 return new wxCursor(image);
341 //----------------------------------------------------------------------
343 class wxColour : public wxObject {
345 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
348 unsigned char Green();
349 unsigned char Blue();
351 void Set(unsigned char red, unsigned char green, unsigned char blue);
354 PyObject* rv = PyTuple_New(3);
360 green = self->Green();
363 PyTuple_SetItem(rv, 0, PyInt_FromLong(red));
364 PyTuple_SetItem(rv, 1, PyInt_FromLong(green));
365 PyTuple_SetItem(rv, 2, PyInt_FromLong(blue));
368 bool __eq__(PyObject* obj) {
370 wxColour* ptr = &tmp;
371 if (obj == Py_None) return FALSE;
372 wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
373 if (! success) return FALSE;
374 return *self == *ptr;
376 bool __ne__(PyObject* obj) {
378 wxColour* ptr = &tmp;
379 if (obj == Py_None) return TRUE;
380 wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
381 if (! success) return TRUE;
382 return *self != *ptr;
386 %pragma(python) addtoclass = "asTuple = Get
387 def __str__(self): return str(self.asTuple())
388 def __repr__(self): return 'wxColour:' + str(self.asTuple())
389 def __nonzero__(self): return self.Ok()
390 def __getinitargs__(self): return ()
391 def __getstate__(self): return self.asTuple()
392 def __setstate__(self, state): self.Set(*state)
397 %new wxColour* wxNamedColour(const wxString& colorName);
399 %{ // Alternate 'constructor'
400 wxColour* wxNamedColour(const wxString& colorName) {
401 return new wxColour(colorName);
407 class wxColourDatabase : public wxObject {
410 wxColour *FindColour(const wxString& colour);
411 wxString FindName(const wxColour& colour) const;
414 void Append(const wxString& name, int red, int green, int blue) {
415 // first see if the name is already there
416 wxString cName = name;
418 wxString cName2 = cName;
419 if ( !cName2.Replace(wxT("GRAY"), wxT("GREY")) )
422 wxNode *node = self->GetFirst();
424 const wxChar *key = node->GetKeyString();
425 if ( cName == key || cName2 == key ) {
426 wxColour* c = (wxColour *)node->GetData();
427 c->Set(red, green, blue);
430 node = node->GetNext();
433 // otherwise append the new colour
434 self->Append(name.c_str(), new wxColour(red, green, blue));
440 //----------------------------------------------------------------------
442 class wxPen : public wxGDIObject {
444 wxPen(wxColour& colour, int width=1, int style=wxSOLID);
448 wxColour GetColour();
454 void SetCap(int cap_style);
455 void SetColour(wxColour& colour);
456 void SetJoin(int join_style);
457 void SetStyle(int style);
458 void SetWidth(int width);
461 void SetDashes(int LCOUNT, wxDash* choices);
462 //int GetDashes(wxDash **dashes);
464 PyObject* GetDashes() {
466 int count = self->GetDashes(&dashes);
467 wxPyBeginBlockThreads();
468 PyObject* retval = PyList_New(0);
469 for (int x=0; x<count; x++)
470 PyList_Append(retval, PyInt_FromLong(dashes[x]));
471 wxPyEndBlockThreads();
477 wxBitmap* GetStipple();
478 void SetStipple(wxBitmap& stipple);
485 // The list of ints for the dashes needs to exist for the life of the pen
486 // so we make it part of the class to save it. wxPyPen is aliased to wxPen
490 class wxPyPen : public wxPen {
492 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID)
493 : wxPen(colour, width, style)
500 void SetDashes(int nb_dashes, const wxDash *dash) {
503 m_dash = new wxDash[nb_dashes];
504 for (int i=0; i<nb_dashes; i++) {
507 wxPen::SetDashes(nb_dashes, m_dash);
516 class wxPyPen : public wxPen {
518 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID);
521 void SetDashes(int LCOUNT, wxDash* choices);
527 class wxPenList : public wxObject {
530 void AddPen(wxPen* pen);
531 wxPen* FindOrCreatePen(const wxColour& colour, int width, int style);
532 void RemovePen(wxPen* pen);
539 //----------------------------------------------------------------------
541 class wxBrush : public wxGDIObject {
543 wxBrush(const wxColour& colour, int style=wxSOLID);
546 wxColour GetColour();
547 wxBitmap * GetStipple();
550 void SetColour(wxColour &colour);
551 void SetStipple(wxBitmap& bitmap);
552 void SetStyle(int style);
556 class wxBrushList : public wxObject {
559 void AddBrush(wxBrush *brush);
560 wxBrush * FindOrCreateBrush(const wxColour& colour, int style);
561 void RemoveBrush(wxBrush *brush);
566 //----------------------------------------------------------------------
569 class wxDC : public wxObject {
571 // wxDC(); **** abstract base class, can't instantiate.
577 bool Blit(wxCoord xdest, wxCoord ydest,
578 wxCoord width, wxCoord height,
579 wxDC *source, wxCoord xsrc, wxCoord ysrc,
580 int logicalFunc = wxCOPY, int useMask = FALSE);
581 // bool Blit(const wxPoint& destPt, const wxSize& sz,
582 // wxDC *source, const wxPoint& srcPt,
583 // int logicalFunc = wxCOPY, int useMask = FALSE);
586 void CrossHair(wxCoord x, wxCoord y);
587 void DestroyClippingRegion();
588 wxCoord DeviceToLogicalX(wxCoord x);
589 wxCoord DeviceToLogicalXRel(wxCoord x);
590 wxCoord DeviceToLogicalY(wxCoord y);
591 wxCoord DeviceToLogicalYRel(wxCoord y);
592 void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
593 void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
594 void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
595 void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxCoord start, wxCoord end);
596 void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
598 void DrawLabel(const wxString& text, const wxRect& rect,
599 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
600 int indexAccel = -1);
603 wxRect DrawImageLabel(const wxString& text,
604 const wxBitmap& image,
606 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
607 int indexAccel = -1) {
609 self->DrawLabel(text, image, rect, alignment, indexAccel, &rv);
614 void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
615 void DrawLines(int PCOUNT, wxPoint* points, wxCoord xoffset=0, wxCoord yoffset=0);
616 void DrawPolygon(int PCOUNT, wxPoint* points, wxCoord xoffset=0, wxCoord yoffset=0,
617 int fill_style=wxODDEVEN_RULE);
618 void DrawPoint(wxCoord x, wxCoord y);
619 void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
620 %name(DrawRectangleRect)void DrawRectangle(const wxRect& rect);
621 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
622 void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxCoord radius=20);
623 void DrawSpline(int PCOUNT, wxPoint* points);
624 void DrawText(const wxString& text, wxCoord x, wxCoord y);
628 bool FloodFill(wxCoord x, wxCoord y, const wxColour& colour, int style=wxFLOOD_SURFACE);
629 wxBrush GetBackground();
631 wxCoord GetCharHeight();
632 wxCoord GetCharWidth();
633 void GetClippingBox(wxCoord *OUTPUT, wxCoord *OUTPUT,
634 wxCoord *OUTPUT, wxCoord *OUTPUT);
636 int GetLogicalFunction();
637 void GetLogicalScale(double *OUTPUT, double *OUTPUT);
639 bool GetOptimization();
642 %new wxColour* GetPixel(wxCoord x, wxCoord y) {
643 wxColour* wc = new wxColour();
644 self->GetPixel(x, y, wc);
648 %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
651 wxColour GetTextBackground();
652 void GetTextExtent(const wxString& string, wxCoord *OUTPUT, wxCoord *OUTPUT);
653 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
654 wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord* OUTPUT,
655 const wxFont* font = NULL);
656 void GetMultiLineTextExtent(const wxString& text, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT,
657 wxFont *font = NULL);
658 wxColour GetTextForeground();
659 void GetUserScale(double *OUTPUT, double *OUTPUT);
660 wxCoord LogicalToDeviceX(wxCoord x);
661 wxCoord LogicalToDeviceXRel(wxCoord x);
662 wxCoord LogicalToDeviceY(wxCoord y);
663 wxCoord LogicalToDeviceYRel(wxCoord y);
669 void SetDeviceOrigin(wxCoord x, wxCoord y);
670 void SetBackground(const wxBrush& brush);
671 void SetBackgroundMode(int mode);
672 void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
673 %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
674 %name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
675 void SetPalette(const wxPalette& colourMap);
676 void SetBrush(const wxBrush& brush);
677 void SetFont(const wxFont& font);
678 void SetLogicalFunction(int function);
679 void SetLogicalScale(double x, double y);
680 void SetMapMode(int mode);
681 void SetOptimization(bool optimize);
682 void SetPen(const wxPen& pen);
683 void SetTextBackground(const wxColour& colour);
684 void SetTextForeground(const wxColour& colour);
685 void SetUserScale(double x_scale, double y_scale);
686 bool StartDoc(const wxString& message);
691 void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y,
692 int useMask = FALSE);
694 bool CanDrawBitmap();
695 bool CanGetTextExtent();
699 void GetLogicalOrigin(int *OUTPUT, int *OUTPUT);
700 void SetLogicalOrigin(int x, int y);
701 void GetDeviceOrigin(int *OUTPUT, int *OUTPUT);
702 void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
704 void CalcBoundingBox(int x, int y);
705 void ResetBoundingBox();
708 void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
709 // See below for implementation
717 %addmethods { // See drawlist.cpp for impplementaion of these...
719 PyObject* _DrawPointList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
721 return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes);
724 PyObject* _DrawLineList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
726 return wxPyDrawXXXList(*self, wxPyDrawXXXLine, pyCoords, pyPens, pyBrushes);
729 PyObject* _DrawRectangleList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
731 return wxPyDrawXXXList(*self, wxPyDrawXXXRectangle, pyCoords, pyPens, pyBrushes);
734 PyObject* _DrawEllipseList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
736 return wxPyDrawXXXList(*self, wxPyDrawXXXEllipse, pyCoords, pyPens, pyBrushes);
739 PyObject* _DrawPolygonList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
741 return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);
744 PyObject* _DrawTextList(PyObject* textList, PyObject* pyPoints,
745 PyObject* foregroundList, PyObject* backgroundList) {
746 return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);
750 %pragma(python) addtoclass = "
751 def DrawPointList(self, points, pens=None):
754 elif isinstance(pens, wxPenPtr):
756 elif len(pens) != len(points):
757 raise ValueError('points and pens must have same length')
758 return self._DrawPointList(points, pens, [])
761 def DrawLineList(self, lines, pens=None):
764 elif isinstance(pens, wxPenPtr):
766 elif len(pens) != len(lines):
767 raise ValueError('lines and pens must have same length')
768 return self._DrawLineList(lines, pens, [])
771 def DrawRectangleList(self, rectangles, pens=None, brushes=None):
774 elif isinstance(pens, wxPenPtr):
776 elif len(pens) != len(rectangles):
777 raise ValueError('rectangles and pens must have same length')
780 elif isinstance(brushes, wxBrushPtr):
782 elif len(brushes) != len(rectangles):
783 raise ValueError('rectangles and brushes must have same length')
784 return self._DrawRectangleList(rectangles, pens, brushes)
787 def DrawEllipseList(self, ellipses, pens=None, brushes=None):
790 elif isinstance(pens, wxPenPtr):
792 elif len(pens) != len(ellipses):
793 raise ValueError('ellipses and pens must have same length')
796 elif isinstance(brushes, wxBrushPtr):
798 elif len(brushes) != len(ellipses):
799 raise ValueError('ellipses and brushes must have same length')
800 return self._DrawEllipseList(ellipses, pens, brushes)
803 def DrawPolygonList(self, polygons, pens=None, brushes=None):
804 ## Note: This does not currently support fill style or offset
805 ## you can always use the non-List version if need be.
806 ## I really would like to support fill-style, however,
807 ## but wxODDEVEN_RULE does not appear to be defined at the Python level
808 ## [It's in wx.py... --Robin]
811 elif isinstance(pens, wxPenPtr):
813 elif len(pens) != len(polygons):
814 raise ValueError('polygons and pens must have same length')
817 elif isinstance(brushes, wxBrushPtr):
819 elif len(brushes) != len(polygons):
820 raise ValueError('polygons and brushes must have same length')
821 return self._DrawPolygonList(polygons, pens, brushes)
824 def DrawTextList(self, textList, coords, foregrounds = None, backgrounds = None, fonts = None):
825 ## NOTE: this does not currently support changing the font
826 ## Make sure you set Background mode to wxSolid (DC.SetBackgroundMode)
827 ## If you want backgounds to do anything.
828 if type(textList) == type(''):
829 textList = [textList]
830 elif len(textList) != len(coords):
831 raise ValueError('textlist and coords must have same length')
832 if foregrounds is None:
834 elif isinstance(foregrounds, wxColourPtr):
835 foregrounds = [foregrounds]
836 elif len(foregrounds) != len(coords):
837 raise ValueError('foregrounds and coords must have same length')
838 if backgrounds is None:
840 elif isinstance(backgrounds, wxColourPtr):
841 backgrounds = [backgrounds]
842 elif len(backgrounds) != len(coords):
843 raise ValueError('backgrounds and coords must have same length')
844 return self._DrawTextList(textList, coords, foregrounds, backgrounds)
853 static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
861 //----------------------------------------------------------------------
863 class wxMemoryDC : public wxDC {
867 void SelectObject(const wxBitmap& bitmap);
870 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
871 %{ // Alternate 'constructor'
872 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
873 return new wxMemoryDC(oldDC);
878 //---------------------------------------------------------------------------
880 class wxBufferedDC : public wxMemoryDC {
882 // Construct a wxBufferedDC using a user supplied buffer.
883 wxBufferedDC( wxDC *dc, const wxBitmap &buffer );
885 // Construct a wxBufferedDC with an internal buffer of 'area'
886 // (where area is usually something like the size of the window
888 %name(wxBufferedDCInternalBuffer)wxBufferedDC( wxDC *dc, const wxSize &area );
890 // Blits the buffer to the dc, and detaches the dc from
891 // the buffer. Usually called in the dtor or by the dtor
892 // of derived classes if the BufferedDC must blit before
893 // the derived class (which may own the dc it's blitting
898 %pragma(python) addtomethod =
899 "__init__:self._dc = _args[0] # save a ref so the other dc won't be deleted before self"
900 %pragma(python) addtomethod =
901 "wxBufferedDCInternalBuffer:val._dc = _args[0] # save a ref so the other dc won't be deleted before self"
905 class wxBufferedPaintDC : public wxBufferedDC
908 wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap );
911 //---------------------------------------------------------------------------
913 class wxScreenDC : public wxDC {
917 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
918 bool StartDrawingOnTop(wxRect* rect = NULL);
919 bool EndDrawingOnTop();
922 //---------------------------------------------------------------------------
924 class wxClientDC : public wxDC {
926 wxClientDC(wxWindow* win);
929 //---------------------------------------------------------------------------
931 class wxPaintDC : public wxDC {
933 wxPaintDC(wxWindow* win);
936 //---------------------------------------------------------------------------
938 class wxWindowDC : public wxDC {
940 wxWindowDC(wxWindow* win);
943 //---------------------------------------------------------------------------
949 #include <wx/metafile.h>
952 class wxMetaFile : public wxObject {
954 wxMetaFile(const wxString& filename = wxPyEmptyString);
958 bool SetClipboard(int width = 0, int height = 0);
964 const wxString& GetFileName() const { return m_filename; }
968 // bool wxMakeMetaFilePlaceable(const wxString& filename,
969 // int minX, int minY, int maxX, int maxY, float scale=1.0);
972 class wxMetaFileDC : public wxDC {
974 wxMetaFileDC(const wxString& filename = wxPyEmptyString,
975 int width = 0, int height = 0,
976 const wxString& description = wxPyEmptyString);
982 //---------------------------------------------------------------------------
984 class wxPalette : public wxGDIObject {
986 wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices);
989 int GetPixel(byte red, byte green, byte blue);
990 bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
994 //---------------------------------------------------------------------------
997 wxIMAGELIST_DRAW_NORMAL ,
998 wxIMAGELIST_DRAW_TRANSPARENT,
999 wxIMAGELIST_DRAW_SELECTED,
1000 wxIMAGELIST_DRAW_FOCUSED,
1001 wxIMAGE_LIST_NORMAL,
1006 class wxImageList : public wxObject {
1008 wxImageList(int width, int height, int mask=TRUE, int initialCount=1);
1011 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
1012 %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour);
1013 %name(AddIcon)int Add(const wxIcon& icon);
1015 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
1017 // %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon);
1018 // int Add(const wxBitmap& bitmap);
1019 bool Replace(int index, const wxBitmap& bitmap);
1022 bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL,
1023 const bool solidBackground = FALSE);
1025 int GetImageCount();
1026 bool Remove(int index);
1028 void GetSize(int index, int& OUTPUT, int& OUTPUT);
1032 //---------------------------------------------------------------------------
1035 enum wxRegionContain {
1036 wxOutRegion, wxPartRegion, wxInRegion
1040 class wxRegion : public wxGDIObject {
1042 wxRegion(wxCoord x=0, wxCoord y=0, wxCoord width=0, wxCoord height=0);
1044 %name(wxRegionFromPoints)wxRegion(int PCOUNT, wxPoint* points, int fillStyle = wxWINDING_RULE);
1050 bool Offset(wxCoord x, wxCoord y);
1053 wxRegionContain Contains(wxCoord x, wxCoord y);
1054 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
1055 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
1056 %name(ContainsRectDim)wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
1060 bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
1061 %name(IntersectRect)bool Intersect(const wxRect& rect);
1062 %name(IntersectRegion)bool Intersect(const wxRegion& region);
1066 bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
1067 %name(UnionRect)bool Union(const wxRect& rect);
1068 %name(UnionRegion)bool Union(const wxRegion& region);
1070 bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
1071 %name(SubtractRect)bool Subtract(const wxRect& rect);
1072 %name(SubtractRegion)bool Subtract(const wxRegion& region);
1074 bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
1075 %name(XorRect)bool Xor(const wxRect& rect);
1076 %name(XorRegion)bool Xor(const wxRegion& region);
1081 class wxRegionIterator : public wxObject {
1083 wxRegionIterator(const wxRegion& region);
1084 ~wxRegionIterator();
1091 wxCoord GetHeight();
1104 //---------------------------------------------------------------------------
1111 extern wxFont *wxNORMAL_FONT;
1112 extern wxFont *wxSMALL_FONT;
1113 extern wxFont *wxITALIC_FONT;
1114 extern wxFont *wxSWISS_FONT;
1116 extern wxPen *wxRED_PEN;
1117 extern wxPen *wxCYAN_PEN;
1118 extern wxPen *wxGREEN_PEN;
1119 extern wxPen *wxBLACK_PEN;
1120 extern wxPen *wxWHITE_PEN;
1121 extern wxPen *wxTRANSPARENT_PEN;
1122 extern wxPen *wxBLACK_DASHED_PEN;
1123 extern wxPen *wxGREY_PEN;
1124 extern wxPen *wxMEDIUM_GREY_PEN;
1125 extern wxPen *wxLIGHT_GREY_PEN;
1127 extern wxBrush *wxBLUE_BRUSH;
1128 extern wxBrush *wxGREEN_BRUSH;
1129 extern wxBrush *wxWHITE_BRUSH;
1130 extern wxBrush *wxBLACK_BRUSH;
1131 extern wxBrush *wxTRANSPARENT_BRUSH;
1132 extern wxBrush *wxCYAN_BRUSH;
1133 extern wxBrush *wxRED_BRUSH;
1134 extern wxBrush *wxGREY_BRUSH;
1135 extern wxBrush *wxMEDIUM_GREY_BRUSH;
1136 extern wxBrush *wxLIGHT_GREY_BRUSH;
1138 extern wxColour *wxBLACK;
1139 extern wxColour *wxWHITE;
1140 extern wxColour *wxRED;
1141 extern wxColour *wxBLUE;
1142 extern wxColour *wxGREEN;
1143 extern wxColour *wxCYAN;
1144 extern wxColour *wxLIGHT_GREY;
1146 extern wxCursor *wxSTANDARD_CURSOR;
1147 extern wxCursor *wxHOURGLASS_CURSOR;
1148 extern wxCursor *wxCROSS_CURSOR;
1151 extern wxBitmap wxNullBitmap;
1152 extern wxIcon wxNullIcon;
1153 extern wxCursor wxNullCursor;
1154 extern wxPen wxNullPen;
1155 extern wxBrush wxNullBrush;
1156 extern wxPalette wxNullPalette;
1157 extern wxFont wxNullFont;
1158 extern wxColour wxNullColour;
1161 extern wxFontList* wxTheFontList;
1162 extern wxPenList* wxThePenList;
1163 extern wxBrushList* wxTheBrushList;
1164 extern wxColourDatabase* wxTheColourDatabase;
1172 //---------------------------------------------------------------------------
1173 //---------------------------------------------------------------------------