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>
22 #include <wx/fontmap.h>
23 #include <wx/fontenc.h>
24 #include <wx/fontmap.h>
25 #include <wx/fontutil.h>
28 //----------------------------------------------------------------------
31 %include my_typemaps.i
33 // Import some definitions of other classes, etc.
38 static wxString wxPyEmptyStr("");
41 //---------------------------------------------------------------------------
43 class wxGDIObject : public wxObject {
49 void SetVisible( bool visible );
55 //---------------------------------------------------------------------------
57 class wxBitmap : public wxGDIObject
60 wxBitmap(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_BMP);
63 wxPalette* GetPalette();
65 bool LoadFile(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_BMP);
66 bool SaveFile(const wxString& name, wxBitmapType type, wxPalette* palette = NULL);
67 void SetMask(wxMask* mask);
69 void SetPalette(wxPalette& palette);
75 void SetHandle(long handle);
82 void SetHeight(int h);
85 void SetSize(const wxSize& size);
88 wxBitmap GetSubBitmap( const wxRect& rect );
89 bool CopyFromIcon(const wxIcon& icon);
91 bool CopyFromCursor(const wxCursor& cursor);
93 void SetQuality(int q);
96 %pragma(python) addtoclass = "
97 def __del__(self,gdic=gdic):
99 if self.thisown == 1 :
100 gdic.delete_wxBitmap(self)
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(char* 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(char* bits, int width, int height, int depth = 1 ) {
164 return new wxBitmap(bits, width, height, depth);
169 // wxBitmap* wxBitmapFromData(PyObject* data, long type,
170 // int width, int height, int depth = 1) {
171 // if (! PyString_Check(data)) {
172 // PyErr_SetString(PyExc_TypeError, "Expected string object");
175 // return new wxBitmap((void*)PyString_AsString(data), type, width, height, depth);
180 //---------------------------------------------------------------------------
182 class wxMask : public wxObject {
184 wxMask(const wxBitmap& bitmap);
187 %addmethods { void Destroy() { delete self; } }
190 %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
192 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
193 return new wxMask(bitmap, colour);
198 //---------------------------------------------------------------------------
201 class wxIcon : public wxGDIObject
204 wxIcon(const wxString& name, long flags,
205 int desiredWidth = -1, int desiredHeight = -1);
208 bool LoadFile(const wxString& name, long flags);
210 // wxGDIImage methods
213 void SetHandle(long handle);
219 void SetWidth(int w);
220 void SetHeight(int h);
221 void SetDepth(int d);
223 void SetSize(const wxSize& size);
225 void CopyFromBitmap(const wxBitmap& bmp);
227 %pragma(python) addtoclass = "
228 def __del__(self,gdic=gdic):
230 if self.thisown == 1 :
231 gdic.delete_wxIcon(self)
238 // Declarations of some alternate "constructors"
239 %new wxIcon* wxEmptyIcon();
240 %new wxIcon* wxIconFromXPMData(PyObject* listOfStrings);
242 %{ // Implementations of some alternate "constructors"
243 wxIcon* wxEmptyIcon() {
247 wxIcon* wxIconFromXPMData(PyObject* listOfStrings) {
248 char** cArray = NULL;
251 cArray = ConvertListOfStrings(listOfStrings);
254 icon = new wxIcon(cArray);
260 //---------------------------------------------------------------------------
262 class wxCursor : public wxGDIObject
266 wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
270 // wxGDIImage methods
273 void SetHandle(long handle);
280 void SetWidth(int w);
281 void SetHeight(int h);
282 void SetDepth(int d);
283 void SetSize(const wxSize& size);
287 %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
288 %{ // Alternate 'constructor'
289 wxCursor* wxPyStockCursor(int id) {
290 return new wxCursor(id);
294 //----------------------------------------------------------------------
299 wxFONTFAMILY_DEFAULT = wxDEFAULT,
300 wxFONTFAMILY_DECORATIVE = wxDECORATIVE,
301 wxFONTFAMILY_ROMAN = wxROMAN,
302 wxFONTFAMILY_SCRIPT = wxSCRIPT,
303 wxFONTFAMILY_SWISS = wxSWISS,
304 wxFONTFAMILY_MODERN = wxMODERN,
305 wxFONTFAMILY_TELETYPE = wxTELETYPE,
312 wxFONTSTYLE_NORMAL = wxNORMAL,
313 wxFONTSTYLE_ITALIC = wxITALIC,
314 wxFONTSTYLE_SLANT = wxSLANT,
321 wxFONTWEIGHT_NORMAL = wxNORMAL,
322 wxFONTWEIGHT_LIGHT = wxLIGHT,
323 wxFONTWEIGHT_BOLD = wxBOLD,
331 wxFONTENCODING_SYSTEM = -1, // system default
332 wxFONTENCODING_DEFAULT, // current default encoding
334 // ISO8859 standard defines a number of single-byte charsets
335 wxFONTENCODING_ISO8859_1, // West European (Latin1)
336 wxFONTENCODING_ISO8859_2, // Central and East European (Latin2)
337 wxFONTENCODING_ISO8859_3, // Esperanto (Latin3)
338 wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4)
339 wxFONTENCODING_ISO8859_5, // Cyrillic
340 wxFONTENCODING_ISO8859_6, // Arabic
341 wxFONTENCODING_ISO8859_7, // Greek
342 wxFONTENCODING_ISO8859_8, // Hebrew
343 wxFONTENCODING_ISO8859_9, // Turkish (Latin5)
344 wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6)
345 wxFONTENCODING_ISO8859_11, // Thai
346 wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it
347 // here anyhow to make all ISO8859
348 // consecutive numbers
349 wxFONTENCODING_ISO8859_13, // Baltic (Latin7)
350 wxFONTENCODING_ISO8859_14, // Latin8
351 wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro)
352 wxFONTENCODING_ISO8859_MAX,
354 // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
355 wxFONTENCODING_KOI8, // we don't support any of KOI8 variants
356 wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866
357 wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria
359 // what would we do without Microsoft? They have their own encodings
361 wxFONTENCODING_CP437, // original MS-DOS codepage
362 wxFONTENCODING_CP850, // CP437 merged with Latin1
363 wxFONTENCODING_CP852, // CP437 merged with Latin2
364 wxFONTENCODING_CP855, // another cyrillic encoding
365 wxFONTENCODING_CP866, // and another one
367 wxFONTENCODING_CP874, // WinThai
368 wxFONTENCODING_CP1250, // WinLatin2
369 wxFONTENCODING_CP1251, // WinCyrillic
370 wxFONTENCODING_CP1252, // WinLatin1
371 wxFONTENCODING_CP1253, // WinGreek (8859-7)
372 wxFONTENCODING_CP1254, // WinTurkish
373 wxFONTENCODING_CP1255, // WinHebrew
374 wxFONTENCODING_CP1256, // WinArabic
375 wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7)
376 wxFONTENCODING_CP12_MAX,
378 wxFONTENCODING_UTF7, // UTF-7 Unicode encoding
379 wxFONTENCODING_UTF8, // UTF-8 Unicode encoding
381 wxFONTENCODING_UNICODE, // Unicode - currently used only by
382 // wxEncodingConverter class
389 // wxNativeFontInfo is platform-specific font representation: this struct
390 // should be considered as opaque font description only used by the native
391 // functions, the user code can only get the objects of this type from
392 // somewhere and pass it somewhere else (possibly save them somewhere using
393 // ToString() and restore them using FromString())
394 struct wxNativeFontInfo
396 // it is important to be able to serialize wxNativeFontInfo objects to be
397 // able to store them (in config file, for example)
398 bool FromString(const wxString& s);
399 wxString ToString() const;
403 return self->ToString();
409 // wxFontMapper manages user-definable correspondence between logical font
410 // names and the fonts present on the machine.
412 // The default implementations of all functions will ask the user if they are
413 // not capable of finding the answer themselves and store the answer in a
414 // config file (configurable via SetConfigXXX functions). This behaviour may
415 // be disabled by giving the value of FALSE to "interactive" parameter.
416 // However, the functions will always consult the config file to allow the
417 // user-defined values override the default logic and there is no way to
418 // disable this - which shouldn't be ever needed because if "interactive" was
419 // never TRUE, the config file is never created anyhow.
427 // find an alternative for the given encoding (which is supposed to not be
428 // available on this system). If successful, return TRUE and rwxFontEcoding
429 // that can be used it wxFont ctor otherwise return FALSE
430 //bool GetAltForEncoding(wxFontEncoding encoding,
431 // wxFontEncoding *alt_encoding,
432 // const wxString& facename = wxEmptyString,
433 // bool interactive = TRUE);
436 // Find an alternative for the given encoding (which is supposed to not be
437 // available on this system). If successful, returns the encoding otherwise
440 PyObject* GetAltForEncoding(wxFontEncoding encoding,
441 const wxString& facename = wxEmptyString,
442 bool interactive = TRUE) {
443 wxFontEncoding alt_enc;
444 if (self->GetAltForEncoding(encoding, &alt_enc, facename, interactive))
445 return PyInt_FromLong(alt_enc);
454 // checks whether given encoding is available in given face or not.
455 // If no facename is given,
456 bool IsEncodingAvailable(wxFontEncoding encoding,
457 const wxString& facename = wxEmptyString);
459 // returns the encoding for the given charset (in the form of RFC 2046) or
460 // wxFONTENCODING_SYSTEM if couldn't decode it
461 wxFontEncoding CharsetToEncoding(const wxString& charset,
462 bool interactive = TRUE);
464 // return internal string identifier for the encoding (see also
465 // GetEncodingDescription())
466 static wxString GetEncodingName(wxFontEncoding encoding);
468 // return user-readable string describing the given encoding
470 // NB: hard-coded now, but might change later (read it from config?)
471 static wxString GetEncodingDescription(wxFontEncoding encoding);
473 // the parent window for modal dialogs
474 void SetDialogParent(wxWindow *parent);
476 // the title for the dialogs (note that default is quite reasonable)
477 void SetDialogTitle(const wxString& title);
479 // functions which allow to configure the config object used: by default,
480 // the global one (from wxConfigBase::Get() will be used) and the default
481 // root path for the config settings is the string returned by
482 // GetDefaultConfigPath()
485 // set the config object to use (may be NULL to use default)
486 void SetConfig(wxConfigBase *config);
488 // set the root config path to use (should be an absolute path)
489 void SetConfigPath(const wxString& prefix);
491 // return default config path
492 static const wxChar *GetDefaultConfigPath();
498 class wxFont : public wxGDIObject {
500 wxFont( int pointSize, int family, int style, int weight,
501 int underline=FALSE, char* faceName = "",
502 wxFontEncoding encoding=wxFONTENCODING_DEFAULT);
504 %name(wxFontFromNativeInfo)wxFont(const wxNativeFontInfo& info);
509 int GetPointSize() const;
510 int GetFamily() const;
511 int GetStyle() const;
512 int GetWeight() const;
513 bool GetUnderlined() const;
514 wxString GetFaceName() const;
515 wxFontEncoding GetEncoding() const;
516 wxNativeFontInfo* GetNativeFontInfo() const;
518 void SetPointSize(int pointSize);
519 void SetFamily(int family);
520 void SetStyle(int style);
521 void SetWeight(int weight);
522 void SetFaceName(const wxString& faceName);
523 void SetUnderlined(bool underlined);
524 void SetEncoding(wxFontEncoding encoding);
525 void SetNativeFontInfo(const wxNativeFontInfo& info);
527 wxString GetFamilyString() const;
528 wxString GetStyleString() const;
529 wxString GetWeightString() const;
531 static wxFontEncoding GetDefaultEncoding();
532 static void SetDefaultEncoding(wxFontEncoding encoding);
537 class wxFontList : public wxObject {
540 void AddFont(wxFont* font);
541 wxFont * FindOrCreateFont(int point_size, int family, int style, int weight,
542 bool underline = FALSE, const char* facename = NULL,
543 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
544 void RemoveFont(wxFont *font);
548 //----------------------------------------------------------------------
550 class wxColour : public wxObject {
552 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
555 unsigned char Green();
556 unsigned char Blue();
558 void Set(unsigned char red, unsigned char green, unsigned char blue);
561 PyObject* rv = PyTuple_New(3);
562 PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red()));
563 PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green()));
564 PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue()));
568 %pragma(python) addtoclass = "asTuple = Get"
569 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
570 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
574 %new wxColour* wxNamedColour(const wxString& colorName);
576 %{ // Alternate 'constructor'
577 wxColour* wxNamedColour(const wxString& colorName) {
578 return new wxColour(colorName);
584 class wxColourDatabase : public wxObject {
587 wxColour *FindColour(const wxString& colour);
588 wxString FindName(const wxColour& colour) const;
591 void Append(const wxString& name, int red, int green, int blue) {
592 self->Append(name.c_str(), new wxColour(red, green, blue));
598 //----------------------------------------------------------------------
600 class wxPen : public wxGDIObject {
602 wxPen(wxColour& colour, int width=1, int style=wxSOLID);
606 wxColour GetColour();
612 void SetCap(int cap_style);
613 void SetColour(wxColour& colour);
614 void SetJoin(int join_style);
615 void SetStyle(int style);
616 void SetWidth(int width);
618 // **** This one needs to return a list of ints (wxDash)
619 //int GetDashes(wxDash **dashes);
620 void SetDashes(int LCOUNT, wxDash* choices);
623 wxBitmap* GetStipple();
624 void SetStipple(wxBitmap& stipple);
631 class wxPyPen : public wxPen {
633 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID)
634 : wxPen(colour, width, style)
641 void SetDashes(int nb_dashes, const wxDash *dash) {
642 m_dash = new wxDash[nb_dashes];
643 for (int i=0; i<nb_dashes; i++)
645 wxPen::SetDashes(nb_dashes, m_dash);
655 class wxPyPen : public wxPen {
657 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID);
660 void SetDashes(int LCOUNT, wxDash* choices);
665 class wxPenList : public wxObject {
668 void AddPen(wxPen* pen);
669 wxPen* FindOrCreatePen(const wxColour& colour, int width, int style);
670 void RemovePen(wxPen* pen);
675 //----------------------------------------------------------------------
677 class wxBrush : public wxGDIObject {
679 wxBrush(const wxColour& colour, int style=wxSOLID);
682 wxColour GetColour();
683 wxBitmap * GetStipple();
686 void SetColour(wxColour &colour);
687 void SetStipple(wxBitmap& bitmap);
688 void SetStyle(int style);
692 class wxBrushList : public wxObject {
695 void AddBrush(wxBrush *brush);
696 wxBrush * FindOrCreateBrush(const wxColour& colour, int style);
697 void RemoveBrush(wxBrush *brush);
700 //----------------------------------------------------------------------
704 class wxDC : public wxObject {
706 // wxDC(); **** abstract base class, can't instantiate.
711 bool Blit(long xdest, long ydest,
712 long width, long height,
713 wxDC *source, long xsrc, long ysrc,
714 int logicalFunc = wxCOPY, int useMask = FALSE);
715 // bool Blit(const wxPoint& destPt, const wxSize& sz,
716 // wxDC *source, const wxPoint& srcPt,
717 // int logicalFunc = wxCOPY, int useMask = FALSE);
720 void CrossHair(long x, long y);
721 void DestroyClippingRegion();
722 long DeviceToLogicalX(long x);
723 long DeviceToLogicalXRel(long x);
724 long DeviceToLogicalY(long y);
725 long DeviceToLogicalYRel(long y);
726 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
727 void DrawCircle(long x, long y, long radius);
728 void DrawEllipse(long x, long y, long width, long height);
729 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
730 void DrawIcon(const wxIcon& icon, long x, long y);
731 void DrawLine(long x1, long y1, long x2, long y2);
732 void DrawLines(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0);
733 void DrawPolygon(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0,
734 int fill_style=wxODDEVEN_RULE);
735 void DrawPoint(long x, long y);
736 void DrawRectangle(long x, long y, long width, long height);
737 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
738 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
739 void DrawSpline(int PCOUNT, wxPoint* points);
740 void DrawText(const wxString& text, long x, long y);
744 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
745 wxBrush& GetBackground();
747 long GetCharHeight();
749 void GetClippingBox(long *OUTPUT, long *OUTPUT,
750 long *OUTPUT, long *OUTPUT);
752 int GetLogicalFunction();
753 void GetLogicalScale(double *OUTPUT, double *OUTPUT);
755 bool GetOptimization();
758 %new wxColour* GetPixel(long x, long y) {
759 wxColour* wc = new wxColour();
760 self->GetPixel(x, y, wc);
764 %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
767 wxColour GetTextBackground();
768 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT);
769 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
770 long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT,
771 const wxFont* font = NULL);
772 wxColour GetTextForeground();
773 void GetUserScale(double *OUTPUT, double *OUTPUT);
774 long LogicalToDeviceX(long x);
775 long LogicalToDeviceXRel(long x);
776 long LogicalToDeviceY(long y);
777 long LogicalToDeviceYRel(long y);
783 void SetDeviceOrigin(long x, long y);
784 void SetBackground(const wxBrush& brush);
785 void SetBackgroundMode(int mode);
786 void SetClippingRegion(long x, long y, long width, long height);
787 %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
788 void SetPalette(const wxPalette& colourMap);
789 void SetBrush(const wxBrush& brush);
790 void SetFont(const wxFont& font);
791 void SetLogicalFunction(int function);
792 void SetLogicalScale(double x, double y);
793 void SetMapMode(int mode);
794 void SetOptimization(bool optimize);
795 void SetPen(const wxPen& pen);
796 void SetTextBackground(const wxColour& colour);
797 void SetTextForeground(const wxColour& colour);
798 void SetUserScale(double x_scale, double y_scale);
799 bool StartDoc(const wxString& message);
804 void DrawBitmap(const wxBitmap& bitmap, long x, long y,
805 int useMask = FALSE);
807 bool CanDrawBitmap();
808 bool CanGetTextExtent();
812 void GetLogicalOrigin(int *OUTPUT, int *OUTPUT);
813 void SetLogicalOrigin(int x, int y);
814 void GetDeviceOrigin(int *OUTPUT, int *OUTPUT);
815 void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
817 void CalcBoundingBox(int x, int y);
818 void ResetBoundingBox();
821 void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
822 // See below for implementation
831 // NOTE: These methods are VERY SIMILAR in implentation. It would be
832 // nice to factor out common code and or turn them into a set of
833 // template-like macros.
835 // Draw a point for every set of coordinants in pyPoints, optionally
836 // setting a new pen for each
837 PyObject* _DrawPointList(PyObject* pyPoints, PyObject* pyPens) {
838 bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints);
839 bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
847 if (!PySequence_Check(pyPoints)) {
850 if (!PySequence_Check(pyPens)) {
853 numObjs = PySequence_Length(pyPoints);
854 numPens = PySequence_Length(pyPens);
856 for (i = 0; i < numObjs; i++) {
860 obj = PySequence_Fast_GET_ITEM(pyPens, i);
863 obj = PySequence_GetItem(pyPens, i);
865 if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) {
876 // Get the point coordinants
878 obj = PySequence_Fast_GET_ITEM(pyPoints, i);
881 obj = PySequence_GetItem(pyPoints, i);
883 if (! _2int_seq_helper(obj, &x1, &y1)) {
889 // Now draw the point
890 self->DrawPoint(x1, y1);
900 PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
903 PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y) sequences.");
908 // Draw a line for every set of coordinants in pyLines, optionally
909 // setting a new pen for each
910 PyObject* _DrawLineList(PyObject* pyLines, PyObject* pyPens) {
911 bool isFastSeq = PyList_Check(pyLines) || PyTuple_Check(pyLines);
912 bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
920 if (!PySequence_Check(pyLines)) {
923 if (!PySequence_Check(pyPens)) {
926 numObjs = PySequence_Length(pyLines);
927 numPens = PySequence_Length(pyPens);
929 for (i = 0; i < numObjs; i++) {
933 obj = PySequence_Fast_GET_ITEM(pyPens, i);
936 obj = PySequence_GetItem(pyPens, i);
938 if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) {
949 // Get the line coordinants
951 obj = PySequence_Fast_GET_ITEM(pyLines, i);
954 obj = PySequence_GetItem(pyLines, i);
956 if (! _4int_seq_helper(obj, &x1, &y1, &x2, &y2)) {
963 self->DrawLine(x1, y1, x2, y2);
973 PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
976 PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x1,y1, x2,y2) sequences.");
982 %pragma(python) addtoclass = "
983 def DrawPointList(self, points, pens=None):
986 elif isinstance(pens, wxPenPtr):
988 elif len(pens) != len(points):
989 raise ValueError('points and pens must have same length')
990 return self._DrawPointList(points, pens)
992 def DrawLineList(self, lines, pens=None):
995 elif isinstance(pens, wxPenPtr):
997 elif len(pens) != len(lines):
998 raise ValueError('lines and pens must have same length')
999 return self._DrawLineList(lines, pens)
1008 static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
1016 //----------------------------------------------------------------------
1018 class wxMemoryDC : public wxDC {
1022 void SelectObject(const wxBitmap& bitmap);
1025 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
1026 %{ // Alternate 'constructor'
1027 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
1028 return new wxMemoryDC(oldDC);
1033 //---------------------------------------------------------------------------
1035 class wxScreenDC : public wxDC {
1039 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
1040 bool StartDrawingOnTop(wxRect* rect = NULL);
1041 bool EndDrawingOnTop();
1044 //---------------------------------------------------------------------------
1046 class wxClientDC : public wxDC {
1048 wxClientDC(wxWindow* win);
1051 //---------------------------------------------------------------------------
1053 class wxPaintDC : public wxDC {
1055 wxPaintDC(wxWindow* win);
1058 //---------------------------------------------------------------------------
1060 class wxWindowDC : public wxDC {
1062 wxWindowDC(wxWindow* win);
1065 //---------------------------------------------------------------------------
1068 class wxPostScriptDC : public wxDC {
1070 wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL);
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 //---------------------------------------------------------------------------