1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface file for wxDC, wxBrush, wxPen, wxFont, 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>
25 //----------------------------------------------------------------------
28 %include my_typemaps.i
30 // Import some definitions of other classes, etc.
35 static wxString wxPyEmptyStr("");
38 //---------------------------------------------------------------------------
40 class wxGDIObject : public wxObject {
46 void SetVisible( bool visible );
52 //---------------------------------------------------------------------------
54 class wxBitmap : public wxGDIObject
57 wxBitmap(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_BMP);
60 wxPalette* GetPalette();
62 bool LoadFile(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_BMP);
63 bool SaveFile(const wxString& name, wxBitmapType type, wxPalette* palette = NULL);
64 void SetMask(wxMask* mask);
66 void SetPalette(wxPalette& palette);
72 void SetHandle(long handle);
79 void SetHeight(int h);
82 void SetSize(const wxSize& size);
85 wxBitmap GetSubBitmap( const wxRect& rect );
86 bool CopyFromIcon(const wxIcon& icon);
88 bool CopyFromCursor(const wxCursor& cursor);
90 void SetQuality(int q);
93 %pragma(python) addtoclass = "
94 def __del__(self,gdic=gdic):
96 if self.thisown == 1 :
97 gdic.delete_wxBitmap(self)
104 // Declarations of some alternate "constructors"
105 %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
106 %new wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings);
107 %new wxBitmap* wxBitmapFromIcon(const wxIcon& icon);
108 %new wxBitmap* wxBitmapFromBits(char* bits, int width, int height, int depth = 1 );
111 // %new wxBitmap* wxBitmapFromData(PyObject* data, long type,
112 // int width, int height, int depth = 1);
117 %{ // Implementations of some alternate "constructors"
119 wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
120 return new wxBitmap(width, height, depth);
123 static char** ConvertListOfStrings(PyObject* listOfStrings) {
124 char** cArray = NULL;
127 if (!PyList_Check(listOfStrings)) {
128 PyErr_SetString(PyExc_TypeError, "Expected a list of strings.");
131 count = PyList_Size(listOfStrings);
132 cArray = new char*[count];
134 for(int x=0; x<count; x++) {
135 // TODO: Need some validation and error checking here
136 cArray[x] = PyString_AsString(PyList_GET_ITEM(listOfStrings, x));
142 wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings) {
143 char** cArray = NULL;
146 cArray = ConvertListOfStrings(listOfStrings);
149 bmp = new wxBitmap(cArray);
155 wxBitmap* wxBitmapFromIcon(const wxIcon& icon) {
156 return new wxBitmap(icon);
160 wxBitmap* wxBitmapFromBits(char* bits, int width, int height, int depth = 1 ) {
161 return new wxBitmap(bits, width, height, depth);
166 // wxBitmap* wxBitmapFromData(PyObject* data, long type,
167 // int width, int height, int depth = 1) {
168 // if (! PyString_Check(data)) {
169 // PyErr_SetString(PyExc_TypeError, "Expected string object");
172 // return new wxBitmap((void*)PyString_AsString(data), type, width, height, depth);
177 //---------------------------------------------------------------------------
179 class wxMask : public wxObject {
181 wxMask(const wxBitmap& bitmap);
184 %addmethods { void Destroy() { delete self; } }
187 %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
189 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
190 return new wxMask(bitmap, colour);
195 //---------------------------------------------------------------------------
198 class wxIcon : public wxGDIObject
201 wxIcon(const wxString& name, long flags,
202 int desiredWidth = -1, int desiredHeight = -1);
205 bool LoadFile(const wxString& name, long flags);
207 // wxGDIImage methods
210 void SetHandle(long handle);
216 void SetWidth(int w);
217 void SetHeight(int h);
218 void SetDepth(int d);
220 void SetSize(const wxSize& size);
222 void CopyFromBitmap(const wxBitmap& bmp);
224 %pragma(python) addtoclass = "
225 def __del__(self,gdic=gdic):
227 if self.thisown == 1 :
228 gdic.delete_wxIcon(self)
235 // Declarations of some alternate "constructors"
236 %new wxIcon* wxEmptyIcon();
237 %new wxIcon* wxIconFromXPMData(PyObject* listOfStrings);
239 %{ // Implementations of some alternate "constructors"
240 wxIcon* wxEmptyIcon() {
244 wxIcon* wxIconFromXPMData(PyObject* listOfStrings) {
245 char** cArray = NULL;
248 cArray = ConvertListOfStrings(listOfStrings);
251 icon = new wxIcon(cArray);
257 //---------------------------------------------------------------------------
259 class wxCursor : public wxGDIObject
263 wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
267 // wxGDIImage methods
270 void SetHandle(long handle);
277 void SetWidth(int w);
278 void SetHeight(int h);
279 void SetDepth(int d);
280 void SetSize(const wxSize& size);
284 %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
285 %{ // Alternate 'constructor'
286 wxCursor* wxPyStockCursor(int id) {
287 return new wxCursor(id);
291 //----------------------------------------------------------------------
296 wxFONTFAMILY_DEFAULT = wxDEFAULT,
297 wxFONTFAMILY_DECORATIVE = wxDECORATIVE,
298 wxFONTFAMILY_ROMAN = wxROMAN,
299 wxFONTFAMILY_SCRIPT = wxSCRIPT,
300 wxFONTFAMILY_SWISS = wxSWISS,
301 wxFONTFAMILY_MODERN = wxMODERN,
302 wxFONTFAMILY_TELETYPE = wxTELETYPE,
309 wxFONTSTYLE_NORMAL = wxNORMAL,
310 wxFONTSTYLE_ITALIC = wxITALIC,
311 wxFONTSTYLE_SLANT = wxSLANT,
318 wxFONTWEIGHT_NORMAL = wxNORMAL,
319 wxFONTWEIGHT_LIGHT = wxLIGHT,
320 wxFONTWEIGHT_BOLD = wxBOLD,
328 wxFONTENCODING_SYSTEM = -1, // system default
329 wxFONTENCODING_DEFAULT, // current default encoding
331 // ISO8859 standard defines a number of single-byte charsets
332 wxFONTENCODING_ISO8859_1, // West European (Latin1)
333 wxFONTENCODING_ISO8859_2, // Central and East European (Latin2)
334 wxFONTENCODING_ISO8859_3, // Esperanto (Latin3)
335 wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4)
336 wxFONTENCODING_ISO8859_5, // Cyrillic
337 wxFONTENCODING_ISO8859_6, // Arabic
338 wxFONTENCODING_ISO8859_7, // Greek
339 wxFONTENCODING_ISO8859_8, // Hebrew
340 wxFONTENCODING_ISO8859_9, // Turkish (Latin5)
341 wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6)
342 wxFONTENCODING_ISO8859_11, // Thai
343 wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it
344 // here anyhow to make all ISO8859
345 // consecutive numbers
346 wxFONTENCODING_ISO8859_13, // Baltic (Latin7)
347 wxFONTENCODING_ISO8859_14, // Latin8
348 wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro)
349 wxFONTENCODING_ISO8859_MAX,
351 // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
352 wxFONTENCODING_KOI8, // we don't support any of KOI8 variants
353 wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866
354 wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria
356 // what would we do without Microsoft? They have their own encodings
358 wxFONTENCODING_CP437, // original MS-DOS codepage
359 wxFONTENCODING_CP850, // CP437 merged with Latin1
360 wxFONTENCODING_CP852, // CP437 merged with Latin2
361 wxFONTENCODING_CP855, // another cyrillic encoding
362 wxFONTENCODING_CP866, // and another one
364 wxFONTENCODING_CP874, // WinThai
365 wxFONTENCODING_CP1250, // WinLatin2
366 wxFONTENCODING_CP1251, // WinCyrillic
367 wxFONTENCODING_CP1252, // WinLatin1
368 wxFONTENCODING_CP1253, // WinGreek (8859-7)
369 wxFONTENCODING_CP1254, // WinTurkish
370 wxFONTENCODING_CP1255, // WinHebrew
371 wxFONTENCODING_CP1256, // WinArabic
372 wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7)
373 wxFONTENCODING_CP12_MAX,
375 wxFONTENCODING_UTF7, // UTF-7 Unicode encoding
376 wxFONTENCODING_UTF8, // UTF-8 Unicode encoding
378 wxFONTENCODING_UNICODE, // Unicode - currently used only by
379 // wxEncodingConverter class
386 // wxNativeFontInfo is platform-specific font representation: this struct
387 // should be considered as opaque font description only used by the native
388 // functions, the user code can only get the objects of this type from
389 // somewhere and pass it somewhere else (possibly save them somewhere using
390 // ToString() and restore them using FromString())
391 struct wxNativeFontInfo
393 // it is important to be able to serialize wxNativeFontInfo objects to be
394 // able to store them (in config file, for example)
395 bool FromString(const wxString& s);
396 wxString ToString() const;
400 return self->ToString();
406 // wxFontMapper manages user-definable correspondence between logical font
407 // names and the fonts present on the machine.
409 // The default implementations of all functions will ask the user if they are
410 // not capable of finding the answer themselves and store the answer in a
411 // config file (configurable via SetConfigXXX functions). This behaviour may
412 // be disabled by giving the value of FALSE to "interactive" parameter.
413 // However, the functions will always consult the config file to allow the
414 // user-defined values override the default logic and there is no way to
415 // disable this - which shouldn't be ever needed because if "interactive" was
416 // never TRUE, the config file is never created anyhow.
424 // find an alternative for the given encoding (which is supposed to not be
425 // available on this system). If successful, return TRUE and rwxFontEcoding
426 // that can be used it wxFont ctor otherwise return FALSE
427 //bool GetAltForEncoding(wxFontEncoding encoding,
428 // wxFontEncoding *alt_encoding,
429 // const wxString& facename = wxEmptyString,
430 // bool interactive = TRUE);
433 // Find an alternative for the given encoding (which is supposed to not be
434 // available on this system). If successful, returns the encoding otherwise
437 PyObject* GetAltForEncoding(wxFontEncoding encoding,
438 const wxString& facename = wxEmptyString,
439 bool interactive = TRUE) {
440 wxFontEncoding alt_enc;
441 if (self->GetAltForEncoding(encoding, &alt_enc, facename, interactive))
442 return PyInt_FromLong(alt_enc);
451 // checks whether given encoding is available in given face or not.
452 // If no facename is given,
453 bool IsEncodingAvailable(wxFontEncoding encoding,
454 const wxString& facename = wxEmptyString);
456 // returns the encoding for the given charset (in the form of RFC 2046) or
457 // wxFONTENCODING_SYSTEM if couldn't decode it
458 wxFontEncoding CharsetToEncoding(const wxString& charset,
459 bool interactive = TRUE);
461 // return internal string identifier for the encoding (see also
462 // GetEncodingDescription())
463 static wxString GetEncodingName(wxFontEncoding encoding);
465 // return user-readable string describing the given encoding
467 // NB: hard-coded now, but might change later (read it from config?)
468 static wxString GetEncodingDescription(wxFontEncoding encoding);
470 // the parent window for modal dialogs
471 void SetDialogParent(wxWindow *parent);
473 // the title for the dialogs (note that default is quite reasonable)
474 void SetDialogTitle(const wxString& title);
476 // functions which allow to configure the config object used: by default,
477 // the global one (from wxConfigBase::Get() will be used) and the default
478 // root path for the config settings is the string returned by
479 // GetDefaultConfigPath()
482 // set the config object to use (may be NULL to use default)
483 void SetConfig(wxConfigBase *config);
485 // set the root config path to use (should be an absolute path)
486 void SetConfigPath(const wxString& prefix);
488 // return default config path
489 static const wxChar *GetDefaultConfigPath();
495 class wxFont : public wxGDIObject {
497 wxFont( int pointSize, int family, int style, int weight,
498 int underline=FALSE, char* faceName = "",
499 wxFontEncoding encoding=wxFONTENCODING_DEFAULT);
501 %name(wxFontFromNativeInfo)wxFont(const wxNativeFontInfo& info);
506 int GetPointSize() const;
507 int GetFamily() const;
508 int GetStyle() const;
509 int GetWeight() const;
510 bool GetUnderlined() const;
511 wxString GetFaceName() const;
512 wxFontEncoding GetEncoding() const;
513 wxNativeFontInfo* GetNativeFontInfo() const;
515 void SetPointSize(int pointSize);
516 void SetFamily(int family);
517 void SetStyle(int style);
518 void SetWeight(int weight);
519 void SetFaceName(const wxString& faceName);
520 void SetUnderlined(bool underlined);
521 void SetEncoding(wxFontEncoding encoding);
522 void SetNativeFontInfo(const wxNativeFontInfo& info);
524 wxString GetFamilyString() const;
525 wxString GetStyleString() const;
526 wxString GetWeightString() const;
528 static wxFontEncoding GetDefaultEncoding();
529 static void SetDefaultEncoding(wxFontEncoding encoding);
534 class wxFontList : public wxObject {
537 void AddFont(wxFont* font);
538 wxFont * FindOrCreateFont(int point_size, int family, int style, int weight,
539 bool underline = FALSE, const char* facename = NULL,
540 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
541 void RemoveFont(wxFont *font);
545 //----------------------------------------------------------------------
547 class wxColour : public wxObject {
549 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
552 unsigned char Green();
553 unsigned char Blue();
555 void Set(unsigned char red, unsigned char green, unsigned char blue);
558 PyObject* rv = PyTuple_New(3);
559 PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red()));
560 PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green()));
561 PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue()));
565 %pragma(python) addtoclass = "asTuple = Get"
566 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
567 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
571 %new wxColour* wxNamedColour(const wxString& colorName);
573 %{ // Alternate 'constructor'
574 wxColour* wxNamedColour(const wxString& colorName) {
575 return new wxColour(colorName);
581 class wxColourDatabase : public wxObject {
584 wxColour *FindColour(const wxString& colour);
585 wxString FindName(const wxColour& colour) const;
588 void Append(const wxString& name, int red, int green, int blue) {
589 self->Append(name.c_str(), new wxColour(red, green, blue));
595 //----------------------------------------------------------------------
597 class wxPen : public wxGDIObject {
599 wxPen(wxColour& colour, int width=1, int style=wxSOLID);
603 wxColour GetColour();
609 void SetCap(int cap_style);
610 void SetColour(wxColour& colour);
611 void SetJoin(int join_style);
612 void SetStyle(int style);
613 void SetWidth(int width);
615 // **** This one needs to return a list of ints (wxDash)
616 //int GetDashes(wxDash **dashes);
617 void SetDashes(int LCOUNT, wxDash* choices);
620 wxBitmap* GetStipple();
621 void SetStipple(wxBitmap& stipple);
628 class wxPyPen : public wxPen {
630 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID)
631 : wxPen(colour, width, style)
638 void SetDashes(int nb_dashes, const wxDash *dash) {
639 m_dash = new wxDash[nb_dashes];
640 for (int i=0; i<nb_dashes; i++)
642 wxPen::SetDashes(nb_dashes, m_dash);
652 class wxPyPen : public wxPen {
654 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID);
657 void SetDashes(int LCOUNT, wxDash* choices);
662 class wxPenList : public wxObject {
665 void AddPen(wxPen* pen);
666 wxPen* FindOrCreatePen(const wxColour& colour, int width, int style);
667 void RemovePen(wxPen* pen);
672 //----------------------------------------------------------------------
674 class wxBrush : public wxGDIObject {
676 wxBrush(const wxColour& colour, int style=wxSOLID);
679 wxColour GetColour();
680 wxBitmap * GetStipple();
683 void SetColour(wxColour &colour);
684 void SetStipple(wxBitmap& bitmap);
685 void SetStyle(int style);
689 class wxBrushList : public wxObject {
692 void AddBrush(wxBrush *brush);
693 wxBrush * FindOrCreateBrush(const wxColour& colour, int style);
694 void RemoveBrush(wxBrush *brush);
697 //----------------------------------------------------------------------
701 class wxDC : public wxObject {
703 // wxDC(); **** abstract base class, can't instantiate.
708 bool Blit(long xdest, long ydest,
709 long width, long height,
710 wxDC *source, long xsrc, long ysrc,
711 int logicalFunc = wxCOPY, int useMask = FALSE);
712 // bool Blit(const wxPoint& destPt, const wxSize& sz,
713 // wxDC *source, const wxPoint& srcPt,
714 // int logicalFunc = wxCOPY, int useMask = FALSE);
717 void CrossHair(long x, long y);
718 void DestroyClippingRegion();
719 long DeviceToLogicalX(long x);
720 long DeviceToLogicalXRel(long x);
721 long DeviceToLogicalY(long y);
722 long DeviceToLogicalYRel(long y);
723 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
724 void DrawCircle(long x, long y, long radius);
725 void DrawEllipse(long x, long y, long width, long height);
726 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
727 void DrawIcon(const wxIcon& icon, long x, long y);
728 void DrawLine(long x1, long y1, long x2, long y2);
729 void DrawLines(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0);
730 void DrawPolygon(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0,
731 int fill_style=wxODDEVEN_RULE);
732 void DrawPoint(long x, long y);
733 void DrawRectangle(long x, long y, long width, long height);
734 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
735 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
736 void DrawSpline(int PCOUNT, wxPoint* points);
737 void DrawText(const wxString& text, long x, long y);
741 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
742 wxBrush& GetBackground();
744 long GetCharHeight();
746 void GetClippingBox(long *OUTPUT, long *OUTPUT,
747 long *OUTPUT, long *OUTPUT);
749 int GetLogicalFunction();
750 void GetLogicalScale(double *OUTPUT, double *OUTPUT);
752 bool GetOptimization();
755 %new wxColour* GetPixel(long x, long y) {
756 wxColour* wc = new wxColour();
757 self->GetPixel(x, y, wc);
761 %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
764 wxColour GetTextBackground();
765 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT);
766 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
767 long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT,
768 const wxFont* font = NULL);
769 wxColour GetTextForeground();
770 void GetUserScale(double *OUTPUT, double *OUTPUT);
771 long LogicalToDeviceX(long x);
772 long LogicalToDeviceXRel(long x);
773 long LogicalToDeviceY(long y);
774 long LogicalToDeviceYRel(long y);
780 void SetDeviceOrigin(long x, long y);
781 void SetBackground(const wxBrush& brush);
782 void SetBackgroundMode(int mode);
783 void SetClippingRegion(long x, long y, long width, long height);
784 %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
785 void SetPalette(const wxPalette& colourMap);
786 void SetBrush(const wxBrush& brush);
787 void SetFont(const wxFont& font);
788 void SetLogicalFunction(int function);
789 void SetLogicalScale(double x, double y);
790 void SetMapMode(int mode);
791 void SetOptimization(bool optimize);
792 void SetPen(const wxPen& pen);
793 void SetTextBackground(const wxColour& colour);
794 void SetTextForeground(const wxColour& colour);
795 void SetUserScale(double x_scale, double y_scale);
796 bool StartDoc(const wxString& message);
801 void DrawBitmap(const wxBitmap& bitmap, long x, long y,
802 int useMask = FALSE);
804 bool CanDrawBitmap();
805 bool CanGetTextExtent();
809 void GetLogicalOrigin(int *OUTPUT, int *OUTPUT);
810 void SetLogicalOrigin(int x, int y);
811 void GetDeviceOrigin(int *OUTPUT, int *OUTPUT);
812 void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
814 void CalcBoundingBox(int x, int y);
815 void ResetBoundingBox();
818 void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
819 // See below for implementation
828 // NOTE: These methods are VERY SIMILAR in implentation. It would be
829 // nice to factor out common code and or turn them into a set of
830 // template-like macros.
832 // Draw a point for every set of coordinants in pyPoints, optionally
833 // setting a new pen for each
834 PyObject* _DrawPointList(PyObject* pyPoints, PyObject* pyPens) {
835 bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints);
836 bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
844 if (!PySequence_Check(pyPoints)) {
847 if (!PySequence_Check(pyPens)) {
850 numObjs = PySequence_Length(pyPoints);
851 numPens = PySequence_Length(pyPens);
853 for (i = 0; i < numObjs; i++) {
857 obj = PySequence_Fast_GET_ITEM(pyPens, i);
860 obj = PySequence_GetItem(pyPens, i);
862 if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) {
873 // Get the point coordinants
875 obj = PySequence_Fast_GET_ITEM(pyPoints, i);
878 obj = PySequence_GetItem(pyPoints, i);
880 if (! _2int_seq_helper(obj, &x1, &y1)) {
886 // Now draw the point
887 self->DrawPoint(x1, y1);
897 PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
900 PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y) sequences.");
905 // Draw a line for every set of coordinants in pyLines, optionally
906 // setting a new pen for each
907 PyObject* _DrawLineList(PyObject* pyLines, PyObject* pyPens) {
908 bool isFastSeq = PyList_Check(pyLines) || PyTuple_Check(pyLines);
909 bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
917 if (!PySequence_Check(pyLines)) {
920 if (!PySequence_Check(pyPens)) {
923 numObjs = PySequence_Length(pyLines);
924 numPens = PySequence_Length(pyPens);
926 for (i = 0; i < numObjs; i++) {
930 obj = PySequence_Fast_GET_ITEM(pyPens, i);
933 obj = PySequence_GetItem(pyPens, i);
935 if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) {
946 // Get the line coordinants
948 obj = PySequence_Fast_GET_ITEM(pyLines, i);
951 obj = PySequence_GetItem(pyLines, i);
953 if (! _4int_seq_helper(obj, &x1, &y1, &x2, &y2)) {
960 self->DrawLine(x1, y1, x2, y2);
970 PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
973 PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x1,y1, x2,y2) sequences.");
979 %pragma(python) addtoclass = "
980 def DrawPointList(self, points, pens=None):
983 elif isinstance(pens, wxPenPtr):
985 elif len(pens) != len(points):
986 raise ValueError('points and pens must have same length')
987 return self._DrawPointList(points, pens)
989 def DrawLineList(self, lines, pens=None):
992 elif isinstance(pens, wxPenPtr):
994 elif len(pens) != len(lines):
995 raise ValueError('lines and pens must have same length')
996 return self._DrawLineList(lines, pens)
1005 static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
1013 //----------------------------------------------------------------------
1015 class wxMemoryDC : public wxDC {
1019 void SelectObject(const wxBitmap& bitmap);
1022 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
1023 %{ // Alternate 'constructor'
1024 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
1025 return new wxMemoryDC(oldDC);
1030 //---------------------------------------------------------------------------
1032 class wxScreenDC : public wxDC {
1036 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
1037 bool StartDrawingOnTop(wxRect* rect = NULL);
1038 bool EndDrawingOnTop();
1041 //---------------------------------------------------------------------------
1043 class wxClientDC : public wxDC {
1045 wxClientDC(wxWindow* win);
1048 //---------------------------------------------------------------------------
1050 class wxPaintDC : public wxDC {
1052 wxPaintDC(wxWindow* win);
1055 //---------------------------------------------------------------------------
1057 class wxWindowDC : public wxDC {
1059 wxWindowDC(wxWindow* win);
1062 //---------------------------------------------------------------------------
1068 #include <wx/metafile.h>
1071 class wxMetaFile : public wxObject {
1073 wxMetaFile(const wxString& filename = wxPyEmptyStr);
1077 bool SetClipboard(int width = 0, int height = 0);
1083 const wxString& GetFileName() const { return m_filename; }
1087 // bool wxMakeMetaFilePlaceable(const wxString& filename,
1088 // int minX, int minY, int maxX, int maxY, float scale=1.0);
1091 class wxMetaFileDC : public wxDC {
1093 wxMetaFileDC(const wxString& filename = wxPyEmptyStr,
1094 int width = 0, int height = 0,
1095 const wxString& description = wxPyEmptyStr);
1096 wxMetaFile* Close();
1101 //---------------------------------------------------------------------------
1102 //---------------------------------------------------------------------------
1109 extern wxFont *wxNORMAL_FONT;
1110 extern wxFont *wxSMALL_FONT;
1111 extern wxFont *wxITALIC_FONT;
1112 extern wxFont *wxSWISS_FONT;
1114 extern wxPen *wxRED_PEN;
1115 extern wxPen *wxCYAN_PEN;
1116 extern wxPen *wxGREEN_PEN;
1117 extern wxPen *wxBLACK_PEN;
1118 extern wxPen *wxWHITE_PEN;
1119 extern wxPen *wxTRANSPARENT_PEN;
1120 extern wxPen *wxBLACK_DASHED_PEN;
1121 extern wxPen *wxGREY_PEN;
1122 extern wxPen *wxMEDIUM_GREY_PEN;
1123 extern wxPen *wxLIGHT_GREY_PEN;
1125 extern wxBrush *wxBLUE_BRUSH;
1126 extern wxBrush *wxGREEN_BRUSH;
1127 extern wxBrush *wxWHITE_BRUSH;
1128 extern wxBrush *wxBLACK_BRUSH;
1129 extern wxBrush *wxTRANSPARENT_BRUSH;
1130 extern wxBrush *wxCYAN_BRUSH;
1131 extern wxBrush *wxRED_BRUSH;
1132 extern wxBrush *wxGREY_BRUSH;
1133 extern wxBrush *wxMEDIUM_GREY_BRUSH;
1134 extern wxBrush *wxLIGHT_GREY_BRUSH;
1136 extern wxColour *wxBLACK;
1137 extern wxColour *wxWHITE;
1138 extern wxColour *wxRED;
1139 extern wxColour *wxBLUE;
1140 extern wxColour *wxGREEN;
1141 extern wxColour *wxCYAN;
1142 extern wxColour *wxLIGHT_GREY;
1144 extern wxCursor *wxSTANDARD_CURSOR;
1145 extern wxCursor *wxHOURGLASS_CURSOR;
1146 extern wxCursor *wxCROSS_CURSOR;
1148 extern wxBitmap wxNullBitmap;
1149 extern wxIcon wxNullIcon;
1150 extern wxCursor wxNullCursor;
1151 extern wxPen wxNullPen;
1152 extern wxBrush wxNullBrush;
1153 extern wxPalette wxNullPalette;
1154 extern wxFont wxNullFont;
1155 extern wxColour wxNullColour;
1158 extern wxFontList* wxTheFontList;
1159 extern wxPenList* wxThePenList;
1160 extern wxBrushList* wxTheBrushList;
1161 extern wxColourDatabase* wxTheColourDatabase;
1169 //---------------------------------------------------------------------------
1171 class wxPalette : public wxGDIObject {
1173 wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices);
1176 int GetPixel(byte red, byte green, byte blue);
1177 bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
1181 //---------------------------------------------------------------------------
1184 wxIMAGELIST_DRAW_NORMAL ,
1185 wxIMAGELIST_DRAW_TRANSPARENT,
1186 wxIMAGELIST_DRAW_SELECTED,
1187 wxIMAGELIST_DRAW_FOCUSED,
1188 wxIMAGE_LIST_NORMAL,
1193 class wxImageList : public wxObject {
1195 wxImageList(int width, int height, int mask=TRUE, int initialCount=1);
1198 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
1199 %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour);
1200 %name(AddIcon)int Add(const wxIcon& icon);
1202 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
1204 // %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon);
1205 // int Add(const wxBitmap& bitmap);
1206 bool Replace(int index, const wxBitmap& bitmap);
1209 bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL,
1210 const bool solidBackground = FALSE);
1212 int GetImageCount();
1213 bool Remove(int index);
1215 void GetSize(int index, int& OUTPUT, int& OUTPUT);
1219 //---------------------------------------------------------------------------
1222 enum wxRegionContain {
1223 wxOutRegion, wxPartRegion, wxInRegion
1227 class wxRegion : public wxGDIObject {
1229 wxRegion(long x=0, long y=0, long width=0, long height=0);
1233 wxRegionContain Contains(long x, long y);
1234 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
1235 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
1236 %name(ContainsRectDim)wxRegionContain Contains(long x, long y, long w, long h);
1240 bool Intersect(long x, long y, long width, long height);
1241 %name(IntersectRect)bool Intersect(const wxRect& rect);
1242 %name(IntersectRegion)bool Intersect(const wxRegion& region);
1246 bool Union(long x, long y, long width, long height);
1247 %name(UnionRect)bool Union(const wxRect& rect);
1248 %name(UnionRegion)bool Union(const wxRegion& region);
1250 bool Subtract(long x, long y, long width, long height);
1251 %name(SubtractRect)bool Subtract(const wxRect& rect);
1252 %name(SubtractRegion)bool Subtract(const wxRegion& region);
1254 bool Xor(long x, long y, long width, long height);
1255 %name(XorRect)bool Xor(const wxRect& rect);
1256 %name(XorRegion)bool Xor(const wxRegion& region);
1261 class wxRegionIterator : public wxObject {
1263 wxRegionIterator(const wxRegion& region);
1264 ~wxRegionIterator();
1284 //---------------------------------------------------------------------------