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);
551 //----------------------------------------------------------------------
553 class wxColour : public wxObject {
555 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
558 unsigned char Green();
559 unsigned char Blue();
561 void Set(unsigned char red, unsigned char green, unsigned char blue);
564 PyObject* rv = PyTuple_New(3);
565 PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red()));
566 PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green()));
567 PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue()));
571 %pragma(python) addtoclass = "asTuple = Get"
572 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
573 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
577 %new wxColour* wxNamedColour(const wxString& colorName);
579 %{ // Alternate 'constructor'
580 wxColour* wxNamedColour(const wxString& colorName) {
581 return new wxColour(colorName);
587 class wxColourDatabase : public wxObject {
590 wxColour *FindColour(const wxString& colour);
591 wxString FindName(const wxColour& colour) const;
594 void Append(const wxString& name, int red, int green, int blue) {
595 self->Append(name.c_str(), new wxColour(red, green, blue));
601 //----------------------------------------------------------------------
603 class wxPen : public wxGDIObject {
605 wxPen(wxColour& colour, int width=1, int style=wxSOLID);
609 wxColour GetColour();
615 void SetCap(int cap_style);
616 void SetColour(wxColour& colour);
617 void SetJoin(int join_style);
618 void SetStyle(int style);
619 void SetWidth(int width);
621 // **** This one needs to return a list of ints (wxDash)
622 //int GetDashes(wxDash **dashes);
623 void SetDashes(int LCOUNT, wxDash* choices);
626 wxBitmap* GetStipple();
627 void SetStipple(wxBitmap& stipple);
634 // The list of ints for the dashes needs to exist for the life of the pen
635 // so we make it part of the class to save it. wxPyPen is aliased to wxPen
639 class wxPyPen : public wxPen {
641 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID)
642 : wxPen(colour, width, style)
649 void SetDashes(int nb_dashes, const wxDash *dash) {
652 m_dash = new wxDash[nb_dashes];
653 for (int i=0; i<nb_dashes; i++) {
656 wxPen::SetDashes(nb_dashes, m_dash);
665 class wxPyPen : public wxPen {
667 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID);
670 void SetDashes(int LCOUNT, wxDash* choices);
676 class wxPenList : public wxObject {
679 void AddPen(wxPen* pen);
680 wxPen* FindOrCreatePen(const wxColour& colour, int width, int style);
681 void RemovePen(wxPen* pen);
688 //----------------------------------------------------------------------
690 class wxBrush : public wxGDIObject {
692 wxBrush(const wxColour& colour, int style=wxSOLID);
695 wxColour GetColour();
696 wxBitmap * GetStipple();
699 void SetColour(wxColour &colour);
700 void SetStipple(wxBitmap& bitmap);
701 void SetStyle(int style);
705 class wxBrushList : public wxObject {
708 void AddBrush(wxBrush *brush);
709 wxBrush * FindOrCreateBrush(const wxColour& colour, int style);
710 void RemoveBrush(wxBrush *brush);
715 //----------------------------------------------------------------------
719 class wxDC : public wxObject {
721 // wxDC(); **** abstract base class, can't instantiate.
726 bool Blit(long xdest, long ydest,
727 long width, long height,
728 wxDC *source, long xsrc, long ysrc,
729 int logicalFunc = wxCOPY, int useMask = FALSE);
730 // bool Blit(const wxPoint& destPt, const wxSize& sz,
731 // wxDC *source, const wxPoint& srcPt,
732 // int logicalFunc = wxCOPY, int useMask = FALSE);
735 void CrossHair(long x, long y);
736 void DestroyClippingRegion();
737 long DeviceToLogicalX(long x);
738 long DeviceToLogicalXRel(long x);
739 long DeviceToLogicalY(long y);
740 long DeviceToLogicalYRel(long y);
741 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
742 void DrawCircle(long x, long y, long radius);
743 void DrawEllipse(long x, long y, long width, long height);
744 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
745 void DrawIcon(const wxIcon& icon, long x, long y);
746 void DrawLine(long x1, long y1, long x2, long y2);
747 void DrawLines(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0);
748 void DrawPolygon(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0,
749 int fill_style=wxODDEVEN_RULE);
750 void DrawPoint(long x, long y);
751 void DrawRectangle(long x, long y, long width, long height);
752 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
753 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
754 void DrawSpline(int PCOUNT, wxPoint* points);
755 void DrawText(const wxString& text, long x, long y);
759 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
760 wxBrush GetBackground();
762 long GetCharHeight();
764 void GetClippingBox(long *OUTPUT, long *OUTPUT,
765 long *OUTPUT, long *OUTPUT);
767 int GetLogicalFunction();
768 void GetLogicalScale(double *OUTPUT, double *OUTPUT);
770 bool GetOptimization();
773 %new wxColour* GetPixel(long x, long y) {
774 wxColour* wc = new wxColour();
775 self->GetPixel(x, y, wc);
779 %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
782 wxColour GetTextBackground();
783 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT);
784 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
785 long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT,
786 const wxFont* font = NULL);
787 wxColour GetTextForeground();
788 void GetUserScale(double *OUTPUT, double *OUTPUT);
789 long LogicalToDeviceX(long x);
790 long LogicalToDeviceXRel(long x);
791 long LogicalToDeviceY(long y);
792 long LogicalToDeviceYRel(long y);
798 void SetDeviceOrigin(long x, long y);
799 void SetBackground(const wxBrush& brush);
800 void SetBackgroundMode(int mode);
801 void SetClippingRegion(long x, long y, long width, long height);
802 %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
803 void SetPalette(const wxPalette& colourMap);
804 void SetBrush(const wxBrush& brush);
805 void SetFont(const wxFont& font);
806 void SetLogicalFunction(int function);
807 void SetLogicalScale(double x, double y);
808 void SetMapMode(int mode);
809 void SetOptimization(bool optimize);
810 void SetPen(const wxPen& pen);
811 void SetTextBackground(const wxColour& colour);
812 void SetTextForeground(const wxColour& colour);
813 void SetUserScale(double x_scale, double y_scale);
814 bool StartDoc(const wxString& message);
819 void DrawBitmap(const wxBitmap& bitmap, long x, long y,
820 int useMask = FALSE);
822 bool CanDrawBitmap();
823 bool CanGetTextExtent();
827 void GetLogicalOrigin(int *OUTPUT, int *OUTPUT);
828 void SetLogicalOrigin(int x, int y);
829 void GetDeviceOrigin(int *OUTPUT, int *OUTPUT);
830 void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
832 void CalcBoundingBox(int x, int y);
833 void ResetBoundingBox();
836 void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
837 // See below for implementation
846 // NOTE: These methods are VERY SIMILAR in implentation. It would be
847 // nice to factor out common code and or turn them into a set of
848 // template-like macros.
850 // Draw a point for every set of coordinants in pyPoints, optionally
851 // setting a new pen for each
852 PyObject* _DrawPointList(PyObject* pyPoints, PyObject* pyPens) {
853 bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints);
854 bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
862 if (!PySequence_Check(pyPoints)) {
865 if (!PySequence_Check(pyPens)) {
868 numObjs = PySequence_Length(pyPoints);
869 numPens = PySequence_Length(pyPens);
871 for (i = 0; i < numObjs; i++) {
875 obj = PySequence_Fast_GET_ITEM(pyPens, i);
878 obj = PySequence_GetItem(pyPens, i);
880 if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) {
891 // Get the point coordinants
893 obj = PySequence_Fast_GET_ITEM(pyPoints, i);
896 obj = PySequence_GetItem(pyPoints, i);
898 if (! _2int_seq_helper(obj, &x1, &y1)) {
904 // Now draw the point
905 self->DrawPoint(x1, y1);
915 PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
918 PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y) sequences.");
923 // Draw a line for every set of coordinants in pyLines, optionally
924 // setting a new pen for each
925 PyObject* _DrawLineList(PyObject* pyLines, PyObject* pyPens) {
926 bool isFastSeq = PyList_Check(pyLines) || PyTuple_Check(pyLines);
927 bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
935 if (!PySequence_Check(pyLines)) {
938 if (!PySequence_Check(pyPens)) {
941 numObjs = PySequence_Length(pyLines);
942 numPens = PySequence_Length(pyPens);
944 for (i = 0; i < numObjs; i++) {
948 obj = PySequence_Fast_GET_ITEM(pyPens, i);
951 obj = PySequence_GetItem(pyPens, i);
953 if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) {
964 // Get the line coordinants
966 obj = PySequence_Fast_GET_ITEM(pyLines, i);
969 obj = PySequence_GetItem(pyLines, i);
971 if (! _4int_seq_helper(obj, &x1, &y1, &x2, &y2)) {
978 self->DrawLine(x1, y1, x2, y2);
988 PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
991 PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x1,y1, x2,y2) sequences.");
997 %pragma(python) addtoclass = "
998 def DrawPointList(self, points, pens=None):
1001 elif isinstance(pens, wxPenPtr):
1003 elif len(pens) != len(points):
1004 raise ValueError('points and pens must have same length')
1005 return self._DrawPointList(points, pens)
1007 def DrawLineList(self, lines, pens=None):
1010 elif isinstance(pens, wxPenPtr):
1012 elif len(pens) != len(lines):
1013 raise ValueError('lines and pens must have same length')
1014 return self._DrawLineList(lines, pens)
1023 static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
1031 //----------------------------------------------------------------------
1033 class wxMemoryDC : public wxDC {
1037 void SelectObject(const wxBitmap& bitmap);
1040 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
1041 %{ // Alternate 'constructor'
1042 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
1043 return new wxMemoryDC(oldDC);
1048 //---------------------------------------------------------------------------
1050 class wxScreenDC : public wxDC {
1054 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
1055 bool StartDrawingOnTop(wxRect* rect = NULL);
1056 bool EndDrawingOnTop();
1059 //---------------------------------------------------------------------------
1061 class wxClientDC : public wxDC {
1063 wxClientDC(wxWindow* win);
1066 //---------------------------------------------------------------------------
1068 class wxPaintDC : public wxDC {
1070 wxPaintDC(wxWindow* win);
1073 //---------------------------------------------------------------------------
1075 class wxWindowDC : public wxDC {
1077 wxWindowDC(wxWindow* win);
1080 //---------------------------------------------------------------------------
1086 #include <wx/metafile.h>
1089 class wxMetaFile : public wxObject {
1091 wxMetaFile(const wxString& filename = wxPyEmptyStr);
1095 bool SetClipboard(int width = 0, int height = 0);
1101 const wxString& GetFileName() const { return m_filename; }
1105 // bool wxMakeMetaFilePlaceable(const wxString& filename,
1106 // int minX, int minY, int maxX, int maxY, float scale=1.0);
1109 class wxMetaFileDC : public wxDC {
1111 wxMetaFileDC(const wxString& filename = wxPyEmptyStr,
1112 int width = 0, int height = 0,
1113 const wxString& description = wxPyEmptyStr);
1114 wxMetaFile* Close();
1119 //---------------------------------------------------------------------------
1121 class wxPalette : public wxGDIObject {
1123 wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices);
1126 int GetPixel(byte red, byte green, byte blue);
1127 bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
1131 //---------------------------------------------------------------------------
1134 wxIMAGELIST_DRAW_NORMAL ,
1135 wxIMAGELIST_DRAW_TRANSPARENT,
1136 wxIMAGELIST_DRAW_SELECTED,
1137 wxIMAGELIST_DRAW_FOCUSED,
1138 wxIMAGE_LIST_NORMAL,
1143 class wxImageList : public wxObject {
1145 wxImageList(int width, int height, int mask=TRUE, int initialCount=1);
1148 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
1149 %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour);
1150 %name(AddIcon)int Add(const wxIcon& icon);
1152 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
1154 // %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon);
1155 // int Add(const wxBitmap& bitmap);
1156 bool Replace(int index, const wxBitmap& bitmap);
1159 bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL,
1160 const bool solidBackground = FALSE);
1162 int GetImageCount();
1163 bool Remove(int index);
1165 void GetSize(int index, int& OUTPUT, int& OUTPUT);
1169 //---------------------------------------------------------------------------
1172 enum wxRegionContain {
1173 wxOutRegion, wxPartRegion, wxInRegion
1177 class wxRegion : public wxGDIObject {
1179 wxRegion(long x=0, long y=0, long width=0, long height=0);
1183 wxRegionContain Contains(long x, long y);
1184 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
1185 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
1186 %name(ContainsRectDim)wxRegionContain Contains(long x, long y, long w, long h);
1190 bool Intersect(long x, long y, long width, long height);
1191 %name(IntersectRect)bool Intersect(const wxRect& rect);
1192 %name(IntersectRegion)bool Intersect(const wxRegion& region);
1196 bool Union(long x, long y, long width, long height);
1197 %name(UnionRect)bool Union(const wxRect& rect);
1198 %name(UnionRegion)bool Union(const wxRegion& region);
1200 bool Subtract(long x, long y, long width, long height);
1201 %name(SubtractRect)bool Subtract(const wxRect& rect);
1202 %name(SubtractRegion)bool Subtract(const wxRegion& region);
1204 bool Xor(long x, long y, long width, long height);
1205 %name(XorRect)bool Xor(const wxRect& rect);
1206 %name(XorRegion)bool Xor(const wxRegion& region);
1211 class wxRegionIterator : public wxObject {
1213 wxRegionIterator(const wxRegion& region);
1214 ~wxRegionIterator();
1234 //---------------------------------------------------------------------------
1241 extern wxFont *wxNORMAL_FONT;
1242 extern wxFont *wxSMALL_FONT;
1243 extern wxFont *wxITALIC_FONT;
1244 extern wxFont *wxSWISS_FONT;
1246 extern wxPen *wxRED_PEN;
1247 extern wxPen *wxCYAN_PEN;
1248 extern wxPen *wxGREEN_PEN;
1249 extern wxPen *wxBLACK_PEN;
1250 extern wxPen *wxWHITE_PEN;
1251 extern wxPen *wxTRANSPARENT_PEN;
1252 extern wxPen *wxBLACK_DASHED_PEN;
1253 extern wxPen *wxGREY_PEN;
1254 extern wxPen *wxMEDIUM_GREY_PEN;
1255 extern wxPen *wxLIGHT_GREY_PEN;
1257 extern wxBrush *wxBLUE_BRUSH;
1258 extern wxBrush *wxGREEN_BRUSH;
1259 extern wxBrush *wxWHITE_BRUSH;
1260 extern wxBrush *wxBLACK_BRUSH;
1261 extern wxBrush *wxTRANSPARENT_BRUSH;
1262 extern wxBrush *wxCYAN_BRUSH;
1263 extern wxBrush *wxRED_BRUSH;
1264 extern wxBrush *wxGREY_BRUSH;
1265 extern wxBrush *wxMEDIUM_GREY_BRUSH;
1266 extern wxBrush *wxLIGHT_GREY_BRUSH;
1268 extern wxColour *wxBLACK;
1269 extern wxColour *wxWHITE;
1270 extern wxColour *wxRED;
1271 extern wxColour *wxBLUE;
1272 extern wxColour *wxGREEN;
1273 extern wxColour *wxCYAN;
1274 extern wxColour *wxLIGHT_GREY;
1276 extern wxCursor *wxSTANDARD_CURSOR;
1277 extern wxCursor *wxHOURGLASS_CURSOR;
1278 extern wxCursor *wxCROSS_CURSOR;
1281 extern wxBitmap wxNullBitmap;
1282 extern wxIcon wxNullIcon;
1283 extern wxCursor wxNullCursor;
1284 extern wxPen wxNullPen;
1285 extern wxBrush wxNullBrush;
1286 extern wxPalette wxNullPalette;
1287 extern wxFont wxNullFont;
1288 extern wxColour wxNullColour;
1291 extern wxFontList* wxTheFontList;
1292 extern wxPenList* wxThePenList;
1293 extern wxBrushList* wxTheBrushList;
1294 extern wxColourDatabase* wxTheColourDatabase;
1302 //---------------------------------------------------------------------------
1303 //---------------------------------------------------------------------------