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 //---------------------------------------------------------------------------
37 class wxGDIObject : public wxObject {
43 void SetVisible( bool visible );
49 //---------------------------------------------------------------------------
51 class wxBitmap : public wxGDIObject
54 wxBitmap(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_BMP);
57 wxPalette* GetPalette();
59 bool LoadFile(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_BMP);
60 bool SaveFile(const wxString& name, wxBitmapType type, wxPalette* palette = NULL);
61 void SetMask(wxMask* mask);
63 void SetPalette(wxPalette& palette);
69 void SetHandle(long handle);
76 void SetHeight(int h);
79 void SetSize(const wxSize& size);
82 wxBitmap GetSubBitmap( const wxRect& rect );
83 bool CopyFromIcon(const wxIcon& icon);
85 bool CopyFromCursor(const wxCursor& cursor);
87 void SetQuality(int q);
90 %pragma(python) addtoclass = "
91 def __del__(self,gdic=gdic):
93 if self.thisown == 1 :
94 gdic.delete_wxBitmap(self)
101 // Declarations of some alternate "constructors"
102 %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
103 %new wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings);
104 %new wxBitmap* wxBitmapFromIcon(const wxIcon& icon);
105 %new wxBitmap* wxBitmapFromBits(char* bits, int width, int height, int depth = 1 );
108 // %new wxBitmap* wxBitmapFromData(PyObject* data, long type,
109 // int width, int height, int depth = 1);
114 %{ // Implementations of some alternate "constructors"
116 wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1) {
117 return new wxBitmap(width, height, depth);
120 static char** ConvertListOfStrings(PyObject* listOfStrings) {
121 char** cArray = NULL;
124 if (!PyList_Check(listOfStrings)) {
125 PyErr_SetString(PyExc_TypeError, "Expected a list of strings.");
128 count = PyList_Size(listOfStrings);
129 cArray = new char*[count];
131 for(int x=0; x<count; x++) {
132 // TODO: Need some validation and error checking here
133 cArray[x] = PyString_AsString(PyList_GET_ITEM(listOfStrings, x));
139 wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings) {
140 char** cArray = NULL;
143 cArray = ConvertListOfStrings(listOfStrings);
146 bmp = new wxBitmap(cArray);
152 wxBitmap* wxBitmapFromIcon(const wxIcon& icon) {
153 return new wxBitmap(icon);
157 wxBitmap* wxBitmapFromBits(char* bits, int width, int height, int depth = 1 ) {
158 return new wxBitmap(bits, width, height, depth);
163 // wxBitmap* wxBitmapFromData(PyObject* data, long type,
164 // int width, int height, int depth = 1) {
165 // if (! PyString_Check(data)) {
166 // PyErr_SetString(PyExc_TypeError, "Expected string object");
169 // return new wxBitmap((void*)PyString_AsString(data), type, width, height, depth);
174 //---------------------------------------------------------------------------
176 class wxMask : public wxObject {
178 wxMask(const wxBitmap& bitmap);
181 %addmethods { void Destroy() { delete self; } }
184 %new wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour);
186 wxMask* wxMaskColour(const wxBitmap& bitmap, const wxColour& colour) {
187 return new wxMask(bitmap, colour);
192 //---------------------------------------------------------------------------
195 class wxIcon : public wxGDIObject
198 wxIcon(const wxString& name, long flags,
199 int desiredWidth = -1, int desiredHeight = -1);
203 bool LoadFile(const wxString& name, long flags);
206 // wxGDIImage methods
209 void SetHandle(long handle);
215 void SetWidth(int w);
216 void SetHeight(int h);
217 void SetDepth(int d);
219 void SetSize(const wxSize& size);
221 void CopyFromBitmap(const wxBitmap& bmp);
223 %pragma(python) addtoclass = "
224 def __del__(self,gdic=gdic):
226 if self.thisown == 1 :
227 gdic.delete_wxIcon(self)
234 // Declarations of some alternate "constructors"
235 %new wxIcon* wxEmptyIcon();
236 %new wxIcon* wxIconFromXPMData(PyObject* listOfStrings);
238 %{ // Implementations of some alternate "constructors"
239 wxIcon* wxEmptyIcon() {
243 wxIcon* wxIconFromXPMData(PyObject* listOfStrings) {
244 char** cArray = NULL;
247 cArray = ConvertListOfStrings(listOfStrings);
250 icon = new wxIcon(cArray);
256 //---------------------------------------------------------------------------
258 class wxCursor : public wxGDIObject
262 wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
266 // wxGDIImage methods
269 void SetHandle(long handle);
276 void SetWidth(int w);
277 void SetHeight(int h);
278 void SetDepth(int d);
279 void SetSize(const wxSize& size);
283 %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
284 %{ // Alternate 'constructor'
285 wxCursor* wxPyStockCursor(int id) {
286 return new wxCursor(id);
290 //----------------------------------------------------------------------
295 wxFONTFAMILY_DEFAULT = wxDEFAULT,
296 wxFONTFAMILY_DECORATIVE = wxDECORATIVE,
297 wxFONTFAMILY_ROMAN = wxROMAN,
298 wxFONTFAMILY_SCRIPT = wxSCRIPT,
299 wxFONTFAMILY_SWISS = wxSWISS,
300 wxFONTFAMILY_MODERN = wxMODERN,
301 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
398 // init the elements from an XLFD, return TRUE if ok
399 bool FromXFontName(const wxString& xFontName);
401 // return false if we were never initialized with a valid XLFD
402 bool IsDefault() const;
404 // generate an XLFD using the fontElements
405 wxString GetXFontName() const;
408 void SetXFontName(const wxString& xFontName);
411 wxNativeFontInfo() { Init(); }
413 // reset to the default state
417 // accessors and modifiers for the font elements
418 int GetPointSize() const;
419 wxFontStyle GetStyle() const;
420 wxFontWeight GetWeight() const;
421 bool GetUnderlined() const;
422 wxString GetFaceName() const;
423 wxFontFamily GetFamily() const;
424 wxFontEncoding GetEncoding() const;
426 void SetPointSize(int pointsize);
427 void SetStyle(wxFontStyle style);
428 void SetWeight(wxFontWeight weight);
429 void SetUnderlined(bool underlined);
430 void SetFaceName(wxString facename);
431 void SetFamily(wxFontFamily family);
432 void SetEncoding(wxFontEncoding encoding);
435 // it is important to be able to serialize wxNativeFontInfo objects to be
436 // able to store them (in config file, for example)
437 bool FromString(const wxString& s);
438 wxString ToString() const;
442 return self->ToString();
446 // we also want to present the native font descriptions to the user in some
447 // human-readable form (it is not platform independent neither, but can
448 // hopefully be understood by the user)
449 bool FromUserString(const wxString& s);
450 wxString ToUserString() const;
454 // wxFontMapper manages user-definable correspondence between logical font
455 // names and the fonts present on the machine.
457 // The default implementations of all functions will ask the user if they are
458 // not capable of finding the answer themselves and store the answer in a
459 // config file (configurable via SetConfigXXX functions). This behaviour may
460 // be disabled by giving the value of FALSE to "interactive" parameter.
461 // However, the functions will always consult the config file to allow the
462 // user-defined values override the default logic and there is no way to
463 // disable this - which shouldn't be ever needed because if "interactive" was
464 // never TRUE, the config file is never created anyhow.
472 // find an alternative for the given encoding (which is supposed to not be
473 // available on this system). If successful, return TRUE and rwxFontEcoding
474 // that can be used it wxFont ctor otherwise return FALSE
475 //bool GetAltForEncoding(wxFontEncoding encoding,
476 // wxFontEncoding *alt_encoding,
477 // const wxString& facename = wxEmptyString,
478 // bool interactive = TRUE);
481 // Find an alternative for the given encoding (which is supposed to not be
482 // available on this system). If successful, returns the encoding otherwise
485 PyObject* GetAltForEncoding(wxFontEncoding encoding,
486 const wxString& facename = wxEmptyString,
487 bool interactive = TRUE) {
488 wxFontEncoding alt_enc;
489 if (self->GetAltForEncoding(encoding, &alt_enc, facename, interactive))
490 return PyInt_FromLong(alt_enc);
499 // checks whether given encoding is available in given face or not.
500 // If no facename is given,
501 bool IsEncodingAvailable(wxFontEncoding encoding,
502 const wxString& facename = wxEmptyString);
504 // returns the encoding for the given charset (in the form of RFC 2046) or
505 // wxFONTENCODING_SYSTEM if couldn't decode it
506 wxFontEncoding CharsetToEncoding(const wxString& charset,
507 bool interactive = TRUE);
509 // return internal string identifier for the encoding (see also
510 // GetEncodingDescription())
511 static wxString GetEncodingName(wxFontEncoding encoding);
513 // return user-readable string describing the given encoding
515 // NB: hard-coded now, but might change later (read it from config?)
516 static wxString GetEncodingDescription(wxFontEncoding encoding);
518 // the parent window for modal dialogs
519 void SetDialogParent(wxWindow *parent);
521 // the title for the dialogs (note that default is quite reasonable)
522 void SetDialogTitle(const wxString& title);
524 // functions which allow to configure the config object used: by default,
525 // the global one (from wxConfigBase::Get() will be used) and the default
526 // root path for the config settings is the string returned by
527 // GetDefaultConfigPath()
530 // set the config object to use (may be NULL to use default)
531 void SetConfig(wxConfigBase *config);
533 // set the root config path to use (should be an absolute path)
534 void SetConfigPath(const wxString& prefix);
536 // return default config path
537 static const wxChar *GetDefaultConfigPath();
543 class wxFont : public wxGDIObject {
545 wxFont( int pointSize, int family, int style, int weight,
546 int underline=FALSE, char* faceName = "",
547 wxFontEncoding encoding=wxFONTENCODING_DEFAULT);
549 %name(wxFontFromNativeInfo)wxFont(const wxNativeFontInfo& info);
554 int GetPointSize() const;
555 int GetFamily() const;
556 int GetStyle() const;
557 int GetWeight() const;
558 bool GetUnderlined() const;
559 wxString GetFaceName() const;
560 wxFontEncoding GetEncoding() const;
564 wxNativeFontInfo* GetNativeFontInfo() const;
565 wxString GetNativeFontInfoDesc() const;
566 wxString GetNativeFontInfoUserDesc() const;
568 void SetPointSize(int pointSize);
569 void SetFamily(int family);
570 void SetStyle(int style);
571 void SetWeight(int weight);
572 void SetFaceName(const wxString& faceName);
573 void SetUnderlined(bool underlined);
574 void SetEncoding(wxFontEncoding encoding);
575 void SetNativeFontInfo(const wxNativeFontInfo& info);
576 // void SetNativeFontInfo(const wxString& info);
577 void SetNativeFontInfoUserDesc(const wxString& info);
579 wxString GetFamilyString() const;
580 wxString GetStyleString() const;
581 wxString GetWeightString() const;
583 static wxFontEncoding GetDefaultEncoding();
584 static void SetDefaultEncoding(wxFontEncoding encoding);
589 class wxFontList : public wxObject {
592 void AddFont(wxFont* font);
593 wxFont * FindOrCreateFont(int point_size, int family, int style, int weight,
594 bool underline = FALSE, const char* facename = NULL,
595 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
596 void RemoveFont(wxFont *font);
602 //----------------------------------------------------------------------
604 class wxColour : public wxObject {
606 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
609 unsigned char Green();
610 unsigned char Blue();
612 void Set(unsigned char red, unsigned char green, unsigned char blue);
615 PyObject* rv = PyTuple_New(3);
616 PyTuple_SetItem(rv, 0, PyInt_FromLong(self->Red()));
617 PyTuple_SetItem(rv, 1, PyInt_FromLong(self->Green()));
618 PyTuple_SetItem(rv, 2, PyInt_FromLong(self->Blue()));
622 %pragma(python) addtoclass = "asTuple = Get"
623 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
624 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
628 %new wxColour* wxNamedColour(const wxString& colorName);
630 %{ // Alternate 'constructor'
631 wxColour* wxNamedColour(const wxString& colorName) {
632 return new wxColour(colorName);
638 class wxColourDatabase : public wxObject {
641 wxColour *FindColour(const wxString& colour);
642 wxString FindName(const wxColour& colour) const;
645 void Append(const wxString& name, int red, int green, int blue) {
646 self->Append(name.c_str(), new wxColour(red, green, blue));
652 //----------------------------------------------------------------------
654 class wxPen : public wxGDIObject {
656 wxPen(wxColour& colour, int width=1, int style=wxSOLID);
660 wxColour GetColour();
666 void SetCap(int cap_style);
667 void SetColour(wxColour& colour);
668 void SetJoin(int join_style);
669 void SetStyle(int style);
670 void SetWidth(int width);
672 // **** This one needs to return a list of ints (wxDash)
673 //int GetDashes(wxDash **dashes);
674 void SetDashes(int LCOUNT, wxDash* choices);
677 wxBitmap* GetStipple();
678 void SetStipple(wxBitmap& stipple);
685 // The list of ints for the dashes needs to exist for the life of the pen
686 // so we make it part of the class to save it. wxPyPen is aliased to wxPen
690 class wxPyPen : public wxPen {
692 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID)
693 : wxPen(colour, width, style)
700 void SetDashes(int nb_dashes, const wxDash *dash) {
703 m_dash = new wxDash[nb_dashes];
704 for (int i=0; i<nb_dashes; i++) {
707 wxPen::SetDashes(nb_dashes, m_dash);
716 class wxPyPen : public wxPen {
718 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID);
721 void SetDashes(int LCOUNT, wxDash* choices);
727 class wxPenList : public wxObject {
730 void AddPen(wxPen* pen);
731 wxPen* FindOrCreatePen(const wxColour& colour, int width, int style);
732 void RemovePen(wxPen* pen);
739 //----------------------------------------------------------------------
741 class wxBrush : public wxGDIObject {
743 wxBrush(const wxColour& colour, int style=wxSOLID);
746 wxColour GetColour();
747 wxBitmap * GetStipple();
750 void SetColour(wxColour &colour);
751 void SetStipple(wxBitmap& bitmap);
752 void SetStyle(int style);
756 class wxBrushList : public wxObject {
759 void AddBrush(wxBrush *brush);
760 wxBrush * FindOrCreateBrush(const wxColour& colour, int style);
761 void RemoveBrush(wxBrush *brush);
766 //----------------------------------------------------------------------
770 class wxDC : public wxObject {
772 // wxDC(); **** abstract base class, can't instantiate.
777 bool Blit(long xdest, long ydest,
778 long width, long height,
779 wxDC *source, long xsrc, long ysrc,
780 int logicalFunc = wxCOPY, int useMask = FALSE);
781 // bool Blit(const wxPoint& destPt, const wxSize& sz,
782 // wxDC *source, const wxPoint& srcPt,
783 // int logicalFunc = wxCOPY, int useMask = FALSE);
786 void CrossHair(long x, long y);
787 void DestroyClippingRegion();
788 long DeviceToLogicalX(long x);
789 long DeviceToLogicalXRel(long x);
790 long DeviceToLogicalY(long y);
791 long DeviceToLogicalYRel(long y);
792 void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc);
793 void DrawCircle(long x, long y, long radius);
794 void DrawEllipse(long x, long y, long width, long height);
795 void DrawEllipticArc(long x, long y, long width, long height, long start, long end);
796 void DrawIcon(const wxIcon& icon, long x, long y);
798 void DrawLabel(const wxString& text, const wxRect& rect,
799 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
800 int indexAccel = -1);
803 wxRect DrawImageLabel(const wxString& text,
804 const wxBitmap& image,
806 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
807 int indexAccel = -1) {
809 self->DrawLabel(text, image, rect, alignment, indexAccel, &rv);
814 void DrawLine(long x1, long y1, long x2, long y2);
815 void DrawLines(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0);
816 void DrawPolygon(int PCOUNT, wxPoint* points, long xoffset=0, long yoffset=0,
817 int fill_style=wxODDEVEN_RULE);
818 void DrawPoint(long x, long y);
819 void DrawRectangle(long x, long y, long width, long height);
820 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
821 void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
822 void DrawSpline(int PCOUNT, wxPoint* points);
823 void DrawText(const wxString& text, long x, long y);
827 void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE);
828 wxBrush GetBackground();
830 long GetCharHeight();
832 void GetClippingBox(long *OUTPUT, long *OUTPUT,
833 long *OUTPUT, long *OUTPUT);
835 int GetLogicalFunction();
836 void GetLogicalScale(double *OUTPUT, double *OUTPUT);
838 bool GetOptimization();
841 %new wxColour* GetPixel(long x, long y) {
842 wxColour* wc = new wxColour();
843 self->GetPixel(x, y, wc);
847 %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
850 wxColour GetTextBackground();
851 void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT);
852 %name(GetFullTextExtent)void GetTextExtent(const wxString& string,
853 long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT,
854 const wxFont* font = NULL);
855 wxColour GetTextForeground();
856 void GetUserScale(double *OUTPUT, double *OUTPUT);
857 long LogicalToDeviceX(long x);
858 long LogicalToDeviceXRel(long x);
859 long LogicalToDeviceY(long y);
860 long LogicalToDeviceYRel(long y);
866 void SetDeviceOrigin(long x, long y);
867 void SetBackground(const wxBrush& brush);
868 void SetBackgroundMode(int mode);
869 void SetClippingRegion(long x, long y, long width, long height);
870 %name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
871 void SetPalette(const wxPalette& colourMap);
872 void SetBrush(const wxBrush& brush);
873 void SetFont(const wxFont& font);
874 void SetLogicalFunction(int function);
875 void SetLogicalScale(double x, double y);
876 void SetMapMode(int mode);
877 void SetOptimization(bool optimize);
878 void SetPen(const wxPen& pen);
879 void SetTextBackground(const wxColour& colour);
880 void SetTextForeground(const wxColour& colour);
881 void SetUserScale(double x_scale, double y_scale);
882 bool StartDoc(const wxString& message);
887 void DrawBitmap(const wxBitmap& bitmap, long x, long y,
888 int useMask = FALSE);
890 bool CanDrawBitmap();
891 bool CanGetTextExtent();
895 void GetLogicalOrigin(int *OUTPUT, int *OUTPUT);
896 void SetLogicalOrigin(int x, int y);
897 void GetDeviceOrigin(int *OUTPUT, int *OUTPUT);
898 void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
900 void CalcBoundingBox(int x, int y);
901 void ResetBoundingBox();
904 void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
905 // See below for implementation
914 // NOTE: These methods are VERY SIMILAR in implentation. It would be
915 // nice to factor out common code and or turn them into a set of
916 // template-like macros.
918 // Draw a point for every set of coordinants in pyPoints, optionally
919 // setting a new pen for each
920 PyObject* _DrawPointList(PyObject* pyPoints, PyObject* pyPens) {
921 bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints);
922 bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
930 if (!PySequence_Check(pyPoints)) {
933 if (!PySequence_Check(pyPens)) {
936 numObjs = PySequence_Length(pyPoints);
937 numPens = PySequence_Length(pyPens);
939 for (i = 0; i < numObjs; i++) {
943 obj = PySequence_Fast_GET_ITEM(pyPens, i);
946 obj = PySequence_GetItem(pyPens, i);
948 if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) {
959 // Get the point coordinants
961 obj = PySequence_Fast_GET_ITEM(pyPoints, i);
964 obj = PySequence_GetItem(pyPoints, i);
966 if (! _2int_seq_helper(obj, &x1, &y1)) {
972 // Now draw the point
973 self->DrawPoint(x1, y1);
983 PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
986 PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y) sequences.");
991 // Draw a line for every set of coordinants in pyLines, optionally
992 // setting a new pen for each
993 PyObject* _DrawLineList(PyObject* pyLines, PyObject* pyPens) {
994 bool isFastSeq = PyList_Check(pyLines) || PyTuple_Check(pyLines);
995 bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
1003 if (!PySequence_Check(pyLines)) {
1006 if (!PySequence_Check(pyPens)) {
1009 numObjs = PySequence_Length(pyLines);
1010 numPens = PySequence_Length(pyPens);
1012 for (i = 0; i < numObjs; i++) {
1016 obj = PySequence_Fast_GET_ITEM(pyPens, i);
1019 obj = PySequence_GetItem(pyPens, i);
1021 if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) {
1032 // Get the line coordinants
1034 obj = PySequence_Fast_GET_ITEM(pyLines, i);
1037 obj = PySequence_GetItem(pyLines, i);
1039 if (! _4int_seq_helper(obj, &x1, &y1, &x2, &y2)) {
1045 // Now draw the line
1046 self->DrawLine(x1, y1, x2, y2);
1056 PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
1059 PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x1,y1, x2,y2) sequences.");
1065 %pragma(python) addtoclass = "
1066 def DrawPointList(self, points, pens=None):
1069 elif isinstance(pens, wxPenPtr):
1071 elif len(pens) != len(points):
1072 raise ValueError('points and pens must have same length')
1073 return self._DrawPointList(points, pens)
1075 def DrawLineList(self, lines, pens=None):
1078 elif isinstance(pens, wxPenPtr):
1080 elif len(pens) != len(lines):
1081 raise ValueError('lines and pens must have same length')
1082 return self._DrawLineList(lines, pens)
1091 static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
1099 //----------------------------------------------------------------------
1101 class wxMemoryDC : public wxDC {
1105 void SelectObject(const wxBitmap& bitmap);
1108 %new wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC);
1109 %{ // Alternate 'constructor'
1110 wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
1111 return new wxMemoryDC(oldDC);
1116 //---------------------------------------------------------------------------
1118 class wxScreenDC : public wxDC {
1122 %name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
1123 bool StartDrawingOnTop(wxRect* rect = NULL);
1124 bool EndDrawingOnTop();
1127 //---------------------------------------------------------------------------
1129 class wxClientDC : public wxDC {
1131 wxClientDC(wxWindow* win);
1134 //---------------------------------------------------------------------------
1136 class wxPaintDC : public wxDC {
1138 wxPaintDC(wxWindow* win);
1141 //---------------------------------------------------------------------------
1143 class wxWindowDC : public wxDC {
1145 wxWindowDC(wxWindow* win);
1148 //---------------------------------------------------------------------------
1154 #include <wx/metafile.h>
1157 class wxMetaFile : public wxObject {
1159 wxMetaFile(const wxString& filename = wxEmptyString);
1163 bool SetClipboard(int width = 0, int height = 0);
1169 const wxString& GetFileName() const { return m_filename; }
1173 // bool wxMakeMetaFilePlaceable(const wxString& filename,
1174 // int minX, int minY, int maxX, int maxY, float scale=1.0);
1177 class wxMetaFileDC : public wxDC {
1179 wxMetaFileDC(const wxString& filename = wxEmptyString,
1180 int width = 0, int height = 0,
1181 const wxString& description = wxEmptyString);
1182 wxMetaFile* Close();
1187 //---------------------------------------------------------------------------
1189 class wxPalette : public wxGDIObject {
1191 wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices);
1194 int GetPixel(byte red, byte green, byte blue);
1195 bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
1199 //---------------------------------------------------------------------------
1202 wxIMAGELIST_DRAW_NORMAL ,
1203 wxIMAGELIST_DRAW_TRANSPARENT,
1204 wxIMAGELIST_DRAW_SELECTED,
1205 wxIMAGELIST_DRAW_FOCUSED,
1206 wxIMAGE_LIST_NORMAL,
1211 class wxImageList : public wxObject {
1213 wxImageList(int width, int height, int mask=TRUE, int initialCount=1);
1216 int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
1217 %name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour);
1218 %name(AddIcon)int Add(const wxIcon& icon);
1220 bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
1222 // %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon);
1223 // int Add(const wxBitmap& bitmap);
1224 bool Replace(int index, const wxBitmap& bitmap);
1227 bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL,
1228 const bool solidBackground = FALSE);
1230 int GetImageCount();
1231 bool Remove(int index);
1233 void GetSize(int index, int& OUTPUT, int& OUTPUT);
1237 //---------------------------------------------------------------------------
1240 enum wxRegionContain {
1241 wxOutRegion, wxPartRegion, wxInRegion
1245 class wxRegion : public wxGDIObject {
1247 wxRegion(long x=0, long y=0, long width=0, long height=0);
1251 bool Offset(wxCoord x, wxCoord y);
1253 wxRegionContain Contains(long x, long y);
1254 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
1255 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
1256 %name(ContainsRectDim)wxRegionContain Contains(long x, long y, long w, long h);
1260 bool Intersect(long x, long y, long width, long height);
1261 %name(IntersectRect)bool Intersect(const wxRect& rect);
1262 %name(IntersectRegion)bool Intersect(const wxRegion& region);
1266 bool Union(long x, long y, long width, long height);
1267 %name(UnionRect)bool Union(const wxRect& rect);
1268 %name(UnionRegion)bool Union(const wxRegion& region);
1270 bool Subtract(long x, long y, long width, long height);
1271 %name(SubtractRect)bool Subtract(const wxRect& rect);
1272 %name(SubtractRegion)bool Subtract(const wxRegion& region);
1274 bool Xor(long x, long y, long width, long height);
1275 %name(XorRect)bool Xor(const wxRect& rect);
1276 %name(XorRegion)bool Xor(const wxRegion& region);
1281 class wxRegionIterator : public wxObject {
1283 wxRegionIterator(const wxRegion& region);
1284 ~wxRegionIterator();
1304 //---------------------------------------------------------------------------
1311 extern wxFont *wxNORMAL_FONT;
1312 extern wxFont *wxSMALL_FONT;
1313 extern wxFont *wxITALIC_FONT;
1314 extern wxFont *wxSWISS_FONT;
1316 extern wxPen *wxRED_PEN;
1317 extern wxPen *wxCYAN_PEN;
1318 extern wxPen *wxGREEN_PEN;
1319 extern wxPen *wxBLACK_PEN;
1320 extern wxPen *wxWHITE_PEN;
1321 extern wxPen *wxTRANSPARENT_PEN;
1322 extern wxPen *wxBLACK_DASHED_PEN;
1323 extern wxPen *wxGREY_PEN;
1324 extern wxPen *wxMEDIUM_GREY_PEN;
1325 extern wxPen *wxLIGHT_GREY_PEN;
1327 extern wxBrush *wxBLUE_BRUSH;
1328 extern wxBrush *wxGREEN_BRUSH;
1329 extern wxBrush *wxWHITE_BRUSH;
1330 extern wxBrush *wxBLACK_BRUSH;
1331 extern wxBrush *wxTRANSPARENT_BRUSH;
1332 extern wxBrush *wxCYAN_BRUSH;
1333 extern wxBrush *wxRED_BRUSH;
1334 extern wxBrush *wxGREY_BRUSH;
1335 extern wxBrush *wxMEDIUM_GREY_BRUSH;
1336 extern wxBrush *wxLIGHT_GREY_BRUSH;
1338 extern wxColour *wxBLACK;
1339 extern wxColour *wxWHITE;
1340 extern wxColour *wxRED;
1341 extern wxColour *wxBLUE;
1342 extern wxColour *wxGREEN;
1343 extern wxColour *wxCYAN;
1344 extern wxColour *wxLIGHT_GREY;
1346 extern wxCursor *wxSTANDARD_CURSOR;
1347 extern wxCursor *wxHOURGLASS_CURSOR;
1348 extern wxCursor *wxCROSS_CURSOR;
1351 extern wxBitmap wxNullBitmap;
1352 extern wxIcon wxNullIcon;
1353 extern wxCursor wxNullCursor;
1354 extern wxPen wxNullPen;
1355 extern wxBrush wxNullBrush;
1356 extern wxPalette wxNullPalette;
1357 extern wxFont wxNullFont;
1358 extern wxColour wxNullColour;
1361 extern wxFontList* wxTheFontList;
1362 extern wxPenList* wxThePenList;
1363 extern wxBrushList* wxTheBrushList;
1364 extern wxColourDatabase* wxTheColourDatabase;
1372 //---------------------------------------------------------------------------
1373 //---------------------------------------------------------------------------