X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/926bb76c2a79fcb83406552e9ca9324fc249ed31..6c41903ced78c0b4115785aa80a934833abbc1ef:/wxPython/src/gdi.i diff --git a/wxPython/src/gdi.i b/wxPython/src/gdi.i index ccf31d5fd3..192668dbab 100644 --- a/wxPython/src/gdi.i +++ b/wxPython/src/gdi.i @@ -37,24 +37,21 @@ //--------------------------------------------------------------------------- -// class wxGDIImage { -// public: -// long GetHandle(); -// void SetHandle(long handle); -// bool Ok(); -// int GetWidth(); -// int GetHeight(); -// int GetDepth(); -// void SetWidth(int w); -// void SetHeight(int h); -// void SetDepth(int d); -// void SetSize(const wxSize& size); -// }; +class wxGDIObject : public wxObject { +public: + wxGDIObject(); + ~wxGDIObject(); + + bool GetVisible(); + void SetVisible( bool visible ); + + bool IsNull(); + +}; //--------------------------------------------------------------------------- -class wxBitmap -//: public wxGDIImage +class wxBitmap : public wxGDIObject { public: wxBitmap(const wxString& name, wxBitmapType type); @@ -108,11 +105,12 @@ public: %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1); %new wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings); %new wxBitmap* wxBitmapFromIcon(const wxIcon& icon); +%new wxBitmap* wxBitmapFromBits(char* bits, int width, int height, int depth = 1 ); -#ifdef __WXMSW__ -%new wxBitmap* wxBitmapFromData(PyObject* data, long type, - int width, int height, int depth = 1); -#endif +// #ifdef __WXMSW__ +// %new wxBitmap* wxBitmapFromData(PyObject* data, long type, +// int width, int height, int depth = 1); +// #endif @@ -140,6 +138,7 @@ public: return cArray; } + wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings) { char** cArray = NULL; wxBitmap* bmp; @@ -158,23 +157,26 @@ public: } + wxBitmap* wxBitmapFromBits(char* bits, int width, int height, int depth = 1 ) { + return new wxBitmap(bits, width, height, depth); + } -#ifdef __WXMSW__ - wxBitmap* wxBitmapFromData(PyObject* data, long type, - int width, int height, int depth = 1) { - if (! PyString_Check(data)) { - PyErr_SetString(PyExc_TypeError, "Expected string object"); - return NULL; - } - return new wxBitmap((void*)PyString_AsString(data), type, width, height, depth); - } -#endif +// #ifdef __WXMSW__ +// wxBitmap* wxBitmapFromData(PyObject* data, long type, +// int width, int height, int depth = 1) { +// if (! PyString_Check(data)) { +// PyErr_SetString(PyExc_TypeError, "Expected string object"); +// return NULL; +// } +// return new wxBitmap((void*)PyString_AsString(data), type, width, height, depth); +// } +// #endif %} //--------------------------------------------------------------------------- -class wxMask { +class wxMask : public wxObject { public: wxMask(const wxBitmap& bitmap); //~wxMask(); @@ -193,8 +195,7 @@ public: //--------------------------------------------------------------------------- -class wxIcon -//: public wxGDIImage +class wxIcon : public wxGDIObject { public: wxIcon(const wxString& name, long flags, @@ -255,8 +256,7 @@ public: //--------------------------------------------------------------------------- -class wxCursor -//: public wxGDIImage +class wxCursor : public wxGDIObject { public: #ifdef __WXMSW__ @@ -336,7 +336,7 @@ enum wxFontEncoding }; -class wxFont { +class wxFont : public wxGDIObject { public: wxFont( int pointSize, int family, int style, int weight, int underline=FALSE, char* faceName = "", @@ -377,7 +377,7 @@ public: %} -class wxFontList { +class wxFontList : public wxObject { public: void AddFont(wxFont* font); @@ -390,7 +390,7 @@ public: //---------------------------------------------------------------------- -class wxColour { +class wxColour : public wxObject { public: wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0); ~wxColour(); @@ -424,7 +424,7 @@ public: -class wxColourDatabase { +class wxColourDatabase : public wxObject { public: wxColour *FindColour(const wxString& colour); @@ -441,13 +441,13 @@ public: //---------------------------------------------------------------------- -class wxPen { +class wxPen : public wxGDIObject { public: wxPen(wxColour& colour, int width=1, int style=wxSOLID); ~wxPen(); int GetCap(); - wxColour& GetColour(); + wxColour GetColour(); int GetJoin(); int GetStyle(); @@ -470,7 +470,7 @@ public: }; -class wxPenList { +class wxPenList : public wxObject { public: void AddPen(wxPen* pen); @@ -482,12 +482,12 @@ public: //---------------------------------------------------------------------- -class wxBrush { +class wxBrush : public wxGDIObject { public: wxBrush(const wxColour& colour, int style=wxSOLID); ~wxBrush(); - wxColour& GetColour(); + wxColour GetColour(); wxBitmap * GetStipple(); int GetStyle(); bool Ok(); @@ -509,7 +509,7 @@ public: -class wxDC { +class wxDC : public wxObject { public: // wxDC(); **** abstract base class, can't instantiate. ~wxDC(); @@ -572,12 +572,12 @@ public: %name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT); wxSize GetSize(); wxSize GetSizeMM(); - wxColour& GetTextBackground(); + wxColour GetTextBackground(); void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT); %name(GetFullTextExtent)void GetTextExtent(const wxString& string, long *OUTPUT, long *OUTPUT, long *OUTPUT, long* OUTPUT, const wxFont* font = NULL); - wxColour& GetTextForeground(); + wxColour GetTextForeground(); void GetUserScale(double *OUTPUT, double *OUTPUT); long LogicalToDeviceX(long x); long LogicalToDeviceXRel(long x); @@ -765,7 +765,7 @@ extern wxColourDatabase* wxTheColourDatabase; //--------------------------------------------------------------------------- -class wxPalette { +class wxPalette : public wxGDIObject { public: wxPalette(int LCOUNT, byte* choices, byte* choices, byte* choices); ~wxPalette(); @@ -787,7 +787,7 @@ enum { wxIMAGE_LIST_STATE }; -class wxImageList { +class wxImageList : public wxObject { public: wxImageList(int width, int height, int mask=TRUE, int initialCount=1); ~wxImageList(); @@ -813,5 +813,70 @@ public: }; +//--------------------------------------------------------------------------- +// Regions, etc. + +enum wxRegionContain { + wxOutRegion, wxPartRegion, wxInRegion +}; + + +class wxRegion : public wxGDIObject { +public: + wxRegion(long x=0, long y=0, long width=0, long height=0); + ~wxRegion(); + + void Clear(); + wxRegionContain Contains(long x, long y); + %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt); + %name(ContainsRect)wxRegionContain Contains(const wxRect& rect); + %name(ContainsRectDim)wxRegionContain Contains(long x, long y, long w, long h); + + wxRect GetBox(); + + bool Intersect(long x, long y, long width, long height); + %name(IntersectRect)bool Intersect(const wxRect& rect); + %name(IntersectRegion)bool Intersect(const wxRegion& region); + + bool IsEmpty(); + + bool Union(long x, long y, long width, long height); + %name(UnionRect)bool Union(const wxRect& rect); + %name(UnionRegion)bool Union(const wxRegion& region); + + bool Subtract(long x, long y, long width, long height); + %name(SubtractRect)bool Subtract(const wxRect& rect); + %name(SubtractRegion)bool Subtract(const wxRegion& region); + + bool Xor(long x, long y, long width, long height); + %name(XorRect)bool Xor(const wxRect& rect); + %name(XorRegion)bool Xor(const wxRegion& region); +}; + + + +class wxRegionIterator : public wxObject { +public: + wxRegionIterator(const wxRegion& region); + ~wxRegionIterator(); + + long GetX(); + long GetY(); + long GetW(); + long GetWidth(); + long GetH(); + long GetHeight(); + wxRect GetRect(); + bool HaveRects(); + void Reset(); + + %addmethods { + void Next() { + (*self) ++; + } + }; +}; + + //---------------------------------------------------------------------------