X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0482c494d3a5a518ac65ee0386ddc23517f07188..da8d6ffa5790529ae784345cb4441a3956751193:/wxPython/src/_bitmap.i diff --git a/wxPython/src/_bitmap.i b/wxPython/src/_bitmap.i index 0dbb88f169..44f39290e6 100644 --- a/wxPython/src/_bitmap.i +++ b/wxPython/src/_bitmap.i @@ -53,12 +53,12 @@ public: ~wxBitmap(); - DocCtorStrName( - wxBitmap(int width, int height, int depth=-1), - "Creates a new bitmap of the given size. A depth of -1 indicates the depth of\n" - "the current screen or visual. Some platforms only support 1 for monochrome and\n" - "-1 for the current colour setting.", - EmptyBitmap); +// DocCtorStrName( +// wxBitmap(int width, int height, int depth=-1), +// "Creates a new bitmap of the given size. A depth of -1 indicates the depth of\n" +// "the current screen or visual. Some platforms only support 1 for monochrome and\n" +// "-1 for the current colour setting.", +// EmptyBitmap); DocCtorStrName( wxBitmap(const wxIcon& icon), @@ -100,6 +100,21 @@ public: PyString_AsStringAndSize(bits, &buf, &length); return new wxBitmap(buf, width, height, depth); } + + + DocStr(wxBitmap(const wxSize& size, int depth=-1), + "Creates a new bitmap of the given size. A depth of -1 indicates +the depth of the current screen or visual. Some platforms only +support 1 for monochrome and -1 for the current colour setting."); + + %nokwargs wxBitmap(int width, int height, int depth=-1); + %nokwargs wxBitmap(const wxSize& size, int depth=-1); + %name(EmptyBitmap)wxBitmap(int width, int height, int depth=-1) { + return new wxBitmap(width, height, depth); + } + %name(EmptyBitmap)wxBitmap(const wxSize& size, int depth=-1) { + return new wxBitmap(size.x, size.y, depth); + } } @@ -110,7 +125,9 @@ public: // wxGDIImage methods #ifdef __WXMSW__ long GetHandle(); - void SetHandle(long handle); + %extend { + void SetHandle(long handle) { self->SetHandle((WXHANDLE)handle); } + } #endif bool Ok(); @@ -126,6 +143,16 @@ public: "monochrome bitmap."); int GetDepth(); + + %extend { + DocStr(GetSize, "Get the size of the bitmap."); + wxSize GetSize() { + wxSize size(self->GetWidth(), self->GetHeight()); + return size; + } + } + + DocStr(ConvertToImage, "Creates a platform-independent image from a platform-dependent bitmap. This\n" "preserves mask information so that bitmaps and images can be converted back\n" @@ -180,6 +207,13 @@ public: DocStr(SetDepth, "Set the depth property (does not affect the bitmap data).") virtual void SetDepth(int depth); + %extend { + DocStr(SetSize, "Set the bitmap size"); + void SetSize(const wxSize& size) { + self->SetWidth(size.x); + self->SetHeight(size.y); + } + } #ifdef __WXMSW__ bool CopyFromCursor(const wxCursor& cursor); @@ -188,6 +222,11 @@ public: #endif %pythoncode { def __nonzero__(self): return self.Ok() } + + %extend { + bool __eq__(const wxBitmap* other) { return other ? (*self == *other) : False; } + bool __ne__(const wxBitmap* other) { return other ? (*self != *other) : True; } + } };