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_CP932, // Japanese (shift-JIS)
366 wxFONTENCODING_CP936, // Chiniese simplified (GB)
367 wxFONTENCODING_CP949, // Korean (Hangul charset)
368 wxFONTENCODING_CP950, // Chinese (traditional - Big5)
369 wxFONTENCODING_CP1250, // WinLatin2
370 wxFONTENCODING_CP1251, // WinCyrillic
371 wxFONTENCODING_CP1252, // WinLatin1
372 wxFONTENCODING_CP1253, // WinGreek (8859-7)
373 wxFONTENCODING_CP1254, // WinTurkish
374 wxFONTENCODING_CP1255, // WinHebrew
375 wxFONTENCODING_CP1256, // WinArabic
376 wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7)
377 wxFONTENCODING_CP12_MAX,
379 wxFONTENCODING_UTF7, // UTF-7 Unicode encoding
380 wxFONTENCODING_UTF8, // UTF-8 Unicode encoding
382 wxFONTENCODING_UNICODE, // Unicode - currently used only by
383 // wxEncodingConverter class
390 // wxNativeFontInfo is platform-specific font representation: this struct
391 // should be considered as opaque font description only used by the native
392 // functions, the user code can only get the objects of this type from
393 // somewhere and pass it somewhere else (possibly save them somewhere using
394 // ToString() and restore them using FromString())
395 struct wxNativeFontInfo
397 // it is important to be able to serialize wxNativeFontInfo objects to be
398 // able to store them (in config file, for example)
399 bool FromString(const wxString& s);
400 wxString ToString() const;
404 return self->ToString();
410 // wxFontMapper manages user-definable correspondence between logical font
411 // names and the fonts present on the machine.
413 // The default implementations of all functions will ask the user if they are
414 // not capable of finding the answer themselves and store the answer in a
415 // config file (configurable via SetConfigXXX functions). This behaviour may
416 // be disabled by giving the value of FALSE to "interactive" parameter.
417 // However, the functions will always consult the config file to allow the
418 // user-defined values override the default logic and there is no way to
419 // disable this - which shouldn't be ever needed because if "interactive" was
420 // never TRUE, the config file is never created anyhow.
428 // find an alternative for the given encoding (which is supposed to not be
429 // available on this system). If successful, return TRUE and rwxFontEcoding
430 // that can be used it wxFont ctor otherwise return FALSE
431 //bool GetAltForEncoding(wxFontEncoding encoding,
432 // wxFontEncoding *alt_encoding,
433 // const wxString& facename = wxEmptyString,
434 // bool interactive = TRUE);
437 // Find an alternative for the given encoding (which is supposed to not be
438 // available on this system). If successful, returns the encoding otherwise
441 PyObject* GetAltForEncoding(wxFontEncoding encoding,
442 const wxString& facename = wxEmptyString,
443 bool interactive = TRUE) {
444 wxFontEncoding alt_enc;
445 if (self->GetAltForEncoding(encoding, &alt_enc, facename, interactive))
446 return PyInt_FromLong(alt_enc);
455 // checks whether given encoding is available in given face or not.
456 // If no facename is given,
457 bool IsEncodingAvailable(wxFontEncoding encoding,
458 const wxString& facename = wxEmptyString);
460 // returns the encoding for the given charset (in the form of RFC 2046) or
461 // wxFONTENCODING_SYSTEM if couldn't decode it
462 wxFontEncoding CharsetToEncoding(const wxString& charset,
463 bool interactive = TRUE);
465 // return internal string identifier for the encoding (see also
466 // GetEncodingDescription())
467 static wxString GetEncodingName(wxFontEncoding encoding);
469 // return user-readable string describing the given encoding
471 // NB: hard-coded now, but might change later (read it from config?)
472 static wxString GetEncodingDescription(wxFontEncoding encoding);
474 // the parent window for modal dialogs
475 void SetDialogParent(wxWindow *parent);
477 // the title for the dialogs (note that default is quite reasonable)
478 void SetDialogTitle(const wxString& title);
480 // functions which allow to configure the config object used: by default,
481 // the global one (from wxConfigBase::Get() will be used) and the default
482 // root path for the config settings is the string returned by
483 // GetDefaultConfigPath()
486 // set the config object to use (may be NULL to use default)
487 void SetConfig(wxConfigBase *config);
489 // set the root config path to use (should be an absolute path)
490 void SetConfigPath(const wxString& prefix);
492 // return default config path
493 static const wxChar *GetDefaultConfigPath();
499 class wxFont : public wxGDIObject {
501 wxFont( int pointSize, int family, int style, int weight,
502 int underline=FALSE, char* faceName = "",
503 wxFontEncoding encoding=wxFONTENCODING_DEFAULT);
505 %name(wxFontFromNativeInfo)wxFont(const wxNativeFontInfo& info);
510 int GetPointSize() const;
511 int GetFamily() const;
512 int GetStyle() const;
513 int GetWeight() const;
514 bool GetUnderlined() const;
515 wxString GetFaceName() const;
516 wxFontEncoding GetEncoding() const;
517 wxNativeFontInfo* GetNativeFontInfo() const;
519 void SetPointSize(int pointSize);
520 void SetFamily(int family);
521 void SetStyle(int style);
522 void SetWeight(int weight);
523 void SetFaceName(const wxString& faceName);
524 void SetUnderlined(bool underlined);
525 void SetEncoding(wxFontEncoding encoding);
526 void SetNativeFontInfo(const wxNativeFontInfo& info);
528 wxString GetFamilyString() const;
529 wxString GetStyleString() const;
530 wxString GetWeightString() const;
532 static wxFontEncoding GetDefaultEncoding();
533 static void SetDefaultEncoding(wxFontEncoding encoding);
538 class wxFontList : public wxObject {
541 void AddFont(wxFont* font);
542 wxFont * FindOrCreateFont(int point_size, int family, int style, int weight,
543 bool underline = FALSE, const char* facename = NULL,
544 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
545 void RemoveFont(wxFont *font);
549 //----------------------------------------------------------------------
551 class wxColour : public wxObject {
553 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
556 unsigned char Green();
557 unsigned char Blue();
559 void Set(unsigned char red, unsigned char green, unsigned char blue);
562 PyObject* rv = PyTuple_New(3);
563 PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red()));
564 PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green()));
565 PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue()));
569 %pragma(python) addtoclass = "asTuple = Get"
570 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
571 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
575 %new wxColour* wxNamedColour(const wxString& colorName);
577 %{ // Alternate 'constructor'
578 wxColour* wxNamedColour(const wxString& colorName) {
579 return new wxColour(colorName);
585 class wxColourDatabase : public wxObject {
588 wxColour *FindColour(const wxString& colour);
589 wxString FindName(const wxColour& colour) const;
592 void Append(const wxString& name, int red, int green, int blue) {
593 self->Append(name.c_str(), new wxColour(red, green, blue));
599 //----------------------------------------------------------------------
601 class wxPen : public wxGDIObject {
603 wxPen(wxColour& colour, int width=1, int style=wxSOLID);
607 wxColour GetColour();
613 void SetCap(int cap_style);
614 void SetColour(wxColour& colour);
615 void SetJoin(int join_style);
616 void SetStyle(int style);
617 void SetWidth(int width);
619 // **** This one needs to return a list of ints (wxDash)
620 //int GetDashes(wxDash **dashes);
621 void SetDashes(int LCOUNT, wxDash* choices);
624 wxBitmap* GetStipple();
625 void SetStipple(wxBitmap& stipple);
632 // The list of ints for the dashes needs to exist for the life of the pen
633 // so we make it part of the class to save it. wxPyPen is aliased to wxPen
637 class wxPyPen : public wxPen {
639 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID)
640 : wxPen(colour, width, style)
647 void SetDashes(int nb_dashes, const wxDash *dash) {
650 m_dash = new wxDash[nb_dashes];
651 for (int i=0; i<nb_dashes; i++) {
654 wxPen::SetDashes(nb_dashes, m_dash);
663 class wxPyPen : public wxPen {
665 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID);
668 void SetDashes(int LCOUNT, wxDash* choices);
674 class wxPenList : public wxObject {
677 void AddPen(wxPen* pen);
678 wxPen* FindOrCreatePen(const wxColour& colour, int width, int style);
679 void RemovePen(wxPen* pen);
684 //----------------------------------------------------------------------
686 class wxBrush : public wxGDIObject {
688 wxBrush(const wxColour& colour, int style=wxSOLID);
691 wxColour GetColour();
692 wxBitmap * GetStipple();
695 void SetColour(wxColour &colour);
696 void SetStipple(wxBitmap& bitmap);
697 void SetStyle(int style);
701 class wxBrushList : public wxObject {
704 void AddBrush(wxBrush *brush);
705 wxBrush * FindOrCreateBrush(const wxColour& colour, int style);
706 void RemoveBrush(wxBrush *brush);
709 //----------------------------------------------------------------------
713 class wxDC : public wxObject {
715 // wxDC(); **** abstract base class, can't instantiate.
720 bool Blit(long xdest, long ydest,
721 long width, long height,
722 wxDC *source, long xsrc, long ysrc,
723 int logicalFunc = wxCOPY, int useMask = FALSE);
724 // bool Blit(const wxPoint& destPt, const wxSize& sz,
725 // wxDC *source, const wxPoint& srcPt,
726 // int logicalFunc = wxCOPY, int useMask = FALSE);
729 void CrossHair(long x, long y);
730 void DestroyClippingRegion();
731 long DeviceToLogicalX(long x);
732 long DeviceToLogicalXRel(long x);
733 long DeviceToLogicalY(long y);
734 long DeviceToLogicalYRel(long y);
735 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
736 void DrawCircle(long x, long y, long radius);
737 void DrawEllipse(long x, long y, long width, long height);
738 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
739 void DrawIcon(const wxIcon& icon, long x, long y);
740 void DrawLine(long x1, long y1, long x2, long y2);
741 void DrawLines(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0);
742 void DrawPolygon(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0,
743 int fill_style=wxODDEVEN_RULE);
744 void DrawPoint(long x, long y);
745 void DrawRectangle(long x, long y, long width, long height);
746 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
747 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
748 void DrawSpline(int PCOUNT, wxPoint* points);
749 void DrawText(const wxString& text, long x, long y);
753 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
754 wxBrush& GetBackground();
756 long GetCharHeight();
758 void GetClippingBox(long *OUTPUT, long *OUTPUT,
759 long *OUTPUT, long *OUTPUT);
761 int GetLogicalFunction();
762 void GetLogicalScale(double *OUTPUT, double *OUTPUT);
764 bool GetOptimization();
767 %new wxColour* GetPixel(long x, long y) {
768 wxColour* wc = new wxColour();
769 self->GetPixel(x, y, wc);
773 %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
776 wxColour GetTextBackground();
777 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT);
778 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
779 long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT,
780 const wxFont* font = NULL);
781 wxColour GetTextForeground();
782 void GetUserScale(double *OUTPUT, double *OUTPUT);
783 long LogicalToDeviceX(long x);
784 long LogicalToDeviceXRel(long x);
785 long LogicalToDeviceY(long y);
786 long LogicalToDeviceYRel(long y);
792 void SetDeviceOrigin(long x, long y);
793 void SetBackground(const wxBrush& brush);
794 void SetBackgroundMode(int mode);
795 void SetClippingRegion(long x, long y, long width, long height);
796 %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
797 void SetPalette(const wxPalette& colourMap);
798 void SetBrush(const wxBrush& brush);
799 void SetFont(const wxFont& font);
800 void SetLogicalFunction(int function);
801 void SetLogicalScale(double x, double y);
802 void SetMapMode(int mode);
803 void SetOptimization(bool optimize);
804 void SetPen(const wxPen& pen);
805 void SetTextBackground(const wxColour& colour);
806 void SetTextForeground(const wxColour& colour);
807 void SetUserScale(double x_scale, double y_scale);
808 bool StartDoc(const wxString& message);
813 void DrawBitmap(const wxBitmap& bitmap, long x, long y,
814 int useMask = FALSE);
816 bool CanDrawBitmap();
817 bool CanGetTextExtent();
821 void GetLogicalOrigin(int *OUTPUT, int *OUTPUT);
822 void SetLogicalOrigin(int x, int y);
823 void GetDeviceOrigin(int *OUTPUT, int *OUTPUT);
824 void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
826 void CalcBoundingBox(int x, int y);
827 void ResetBoundingBox();
830 void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
831 // See below for implementation
840 // NOTE: These methods are VERY SIMILAR in implentation. It would be
841 // nice to factor out common code and or turn them into a set of
842 // template-like macros.
844 // Draw a point for every set of coordinants in pyPoints, optionally
845 // setting a new pen for each
846 PyObject* _DrawPointList(PyObject* pyPoints, PyObject* pyPens) {
847 bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints);
848 bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
856 if (!PySequence_Check(pyPoints)) {
859 if (!PySequence_Check(pyPens)) {
862 numObjs = PySequence_Length(pyPoints);
863 numPens = PySequence_Length(pyPens);
865 for (i = 0; i < numObjs; i++) {
869 obj = PySequence_Fast_GET_ITEM(pyPens, i);
872 obj = PySequence_GetItem(pyPens, i);
874 if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) {
885 // Get the point coordinants
887 obj = PySequence_Fast_GET_ITEM(pyPoints, i);
890 obj = PySequence_GetItem(pyPoints, i);
892 if (! _2int_seq_helper(obj, &x1, &y1)) {
898 // Now draw the point
899 self->DrawPoint(x1, y1);
909 PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
912 PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y) sequences.");
917 // Draw a line for every set of coordinants in pyLines, optionally
918 // setting a new pen for each
919 PyObject* _DrawLineList(PyObject* pyLines, PyObject* pyPens) {
920 bool isFastSeq = PyList_Check(pyLines) || PyTuple_Check(pyLines);
921 bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
929 if (!PySequence_Check(pyLines)) {
932 if (!PySequence_Check(pyPens)) {
935 numObjs = PySequence_Length(pyLines);
936 numPens = PySequence_Length(pyPens);
938 for (i = 0; i < numObjs; i++) {
942 obj = PySequence_Fast_GET_ITEM(pyPens, i);
945 obj = PySequence_GetItem(pyPens, i);
947 if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) {
958 // Get the line coordinants
960 obj = PySequence_Fast_GET_ITEM(pyLines, i);
963 obj = PySequence_GetItem(pyLines, i);
965 if (! _4int_seq_helper(obj, &x1, &y1, &x2, &y2)) {
972 self->DrawLine(x1, y1, x2, y2);
982 PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
985 PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x1,y1, x2,y2) sequences.");
991 %pragma(python) addtoclass = "
992 def DrawPointList(self, points, pens=None):
995 elif isinstance(pens, wxPenPtr):
997 elif len(pens) != len(points):
998 raise ValueError('points and pens must have same length')
999 return self._DrawPointList(points, pens)
1001 def DrawLineList(self, lines, pens=None):
1004 elif isinstance(pens, wxPenPtr):
1006 elif len(pens) != len(lines):
1007 raise ValueError('lines and pens must have same length')
1008 return self._DrawLineList(lines, pens)
1017 static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
1025 //----------------------------------------------------------------------
1027 class wxMemoryDC : public wxDC {
1031 void SelectObject(const wxBitmap& bitmap);
1034 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
1035 %{ // Alternate 'constructor'
1036 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
1037 return new wxMemoryDC(oldDC);
1042 //---------------------------------------------------------------------------
1044 class wxScreenDC : public wxDC {
1048 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
1049 bool StartDrawingOnTop(wxRect* rect = NULL);
1050 bool EndDrawingOnTop();
1053 //---------------------------------------------------------------------------
1055 class wxClientDC : public wxDC {
1057 wxClientDC(wxWindow* win);
1060 //---------------------------------------------------------------------------
1062 class wxPaintDC : public wxDC {
1064 wxPaintDC(wxWindow* win);
1067 //---------------------------------------------------------------------------
1069 class wxWindowDC : public wxDC {
1071 wxWindowDC(wxWindow* win);
1074 //---------------------------------------------------------------------------
1080 #include <wx/metafile.h>
1083 class wxMetaFile : public wxObject {
1085 wxMetaFile(const wxString& filename = wxPyEmptyStr);
1089 bool SetClipboard(int width = 0, int height = 0);
1095 const wxString& GetFileName() const { return m_filename; }
1099 // bool wxMakeMetaFilePlaceable(const wxString& filename,
1100 // int minX, int minY, int maxX, int maxY, float scale=1.0);
1103 class wxMetaFileDC : public wxDC {
1105 wxMetaFileDC(const wxString& filename = wxPyEmptyStr,
1106 int width = 0, int height = 0,
1107 const wxString& description = wxPyEmptyStr);
1108 wxMetaFile* Close();
1113 //---------------------------------------------------------------------------
1114 //---------------------------------------------------------------------------
1121 extern wxFont *wxNORMAL_FONT;
1122 extern wxFont *wxSMALL_FONT;
1123 extern wxFont *wxITALIC_FONT;
1124 extern wxFont *wxSWISS_FONT;
1126 extern wxPen *wxRED_PEN;
1127 extern wxPen *wxCYAN_PEN;
1128 extern wxPen *wxGREEN_PEN;
1129 extern wxPen *wxBLACK_PEN;
1130 extern wxPen *wxWHITE_PEN;
1131 extern wxPen *wxTRANSPARENT_PEN;
1132 extern wxPen *wxBLACK_DASHED_PEN;
1133 extern wxPen *wxGREY_PEN;
1134 extern wxPen *wxMEDIUM_GREY_PEN;
1135 extern wxPen *wxLIGHT_GREY_PEN;
1137 extern wxBrush *wxBLUE_BRUSH;
1138 extern wxBrush *wxGREEN_BRUSH;
1139 extern wxBrush *wxWHITE_BRUSH;
1140 extern wxBrush *wxBLACK_BRUSH;
1141 extern wxBrush *wxTRANSPARENT_BRUSH;
1142 extern wxBrush *wxCYAN_BRUSH;
1143 extern wxBrush *wxRED_BRUSH;
1144 extern wxBrush *wxGREY_BRUSH;
1145 extern wxBrush *wxMEDIUM_GREY_BRUSH;
1146 extern wxBrush *wxLIGHT_GREY_BRUSH;
1148 extern wxColour *wxBLACK;
1149 extern wxColour *wxWHITE;
1150 extern wxColour *wxRED;
1151 extern wxColour *wxBLUE;
1152 extern wxColour *wxGREEN;
1153 extern wxColour *wxCYAN;
1154 extern wxColour *wxLIGHT_GREY;
1156 extern wxCursor *wxSTANDARD_CURSOR;
1157 extern wxCursor *wxHOURGLASS_CURSOR;
1158 extern wxCursor *wxCROSS_CURSOR;
1160 extern wxBitmap wxNullBitmap;
1161 extern wxIcon wxNullIcon;
1162 extern wxCursor wxNullCursor;
1163 extern wxPen wxNullPen;
1164 extern wxBrush wxNullBrush;
1165 extern wxPalette wxNullPalette;
1166 extern wxFont wxNullFont;
1167 extern wxColour wxNullColour;
1170 extern wxFontList* wxTheFontList;
1171 extern wxPenList* wxThePenList;
1172 extern wxBrushList* wxTheBrushList;
1173 extern wxColourDatabase* wxTheColourDatabase;
1181 //---------------------------------------------------------------------------
1183 class wxPalette : public wxGDIObject {
1185 wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices);
1188 int GetPixel(byte red, byte green, byte blue);
1189 bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
1193 //---------------------------------------------------------------------------
1196 wxIMAGELIST_DRAW_NORMAL ,
1197 wxIMAGELIST_DRAW_TRANSPARENT,
1198 wxIMAGELIST_DRAW_SELECTED,
1199 wxIMAGELIST_DRAW_FOCUSED,
1200 wxIMAGE_LIST_NORMAL,
1205 class wxImageList : public wxObject {
1207 wxImageList(int width, int height, int mask=TRUE, int initialCount=1);
1210 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
1211 %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour);
1212 %name(AddIcon)int Add(const wxIcon& icon);
1214 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
1216 // %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon);
1217 // int Add(const wxBitmap& bitmap);
1218 bool Replace(int index, const wxBitmap& bitmap);
1221 bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL,
1222 const bool solidBackground = FALSE);
1224 int GetImageCount();
1225 bool Remove(int index);
1227 void GetSize(int index, int& OUTPUT, int& OUTPUT);
1231 //---------------------------------------------------------------------------
1234 enum wxRegionContain {
1235 wxOutRegion, wxPartRegion, wxInRegion
1239 class wxRegion : public wxGDIObject {
1241 wxRegion(long x=0, long y=0, long width=0, long height=0);
1245 wxRegionContain Contains(long x, long y);
1246 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
1247 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
1248 %name(ContainsRectDim)wxRegionContain Contains(long x, long y, long w, long h);
1252 bool Intersect(long x, long y, long width, long height);
1253 %name(IntersectRect)bool Intersect(const wxRect& rect);
1254 %name(IntersectRegion)bool Intersect(const wxRegion& region);
1258 bool Union(long x, long y, long width, long height);
1259 %name(UnionRect)bool Union(const wxRect& rect);
1260 %name(UnionRegion)bool Union(const wxRegion& region);
1262 bool Subtract(long x, long y, long width, long height);
1263 %name(SubtractRect)bool Subtract(const wxRect& rect);
1264 %name(SubtractRegion)bool Subtract(const wxRegion& region);
1266 bool Xor(long x, long y, long width, long height);
1267 %name(XorRect)bool Xor(const wxRect& rect);
1268 %name(XorRegion)bool Xor(const wxRegion& region);
1273 class wxRegionIterator : public wxObject {
1275 wxRegionIterator(const wxRegion& region);
1276 ~wxRegionIterator();
1296 //---------------------------------------------------------------------------