X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/214c4fbea5875368cc21a082d20cb082cd38cb3c..88f67c2242209b8a752b515fdec30fd6ef858a18:/wxPython/src/_gbsizer.i?ds=sidebyside diff --git a/wxPython/src/_gbsizer.i b/wxPython/src/_gbsizer.i index 8b79cc4c7d..c100893129 100644 --- a/wxPython/src/_gbsizer.i +++ b/wxPython/src/_gbsizer.i @@ -80,14 +80,35 @@ public: void SetRow(int row); void SetCol(int col); -// %extend { -// bool __eq__(const wxGBPosition* other) { return other ? (*self == *other) : false; } -// bool __ne__(const wxGBPosition* other) { return other ? (*self != *other) : true; } -// } - bool operator==(const wxGBPosition& other); - bool operator!=(const wxGBPosition& other); - + %extend { + KeepGIL(__eq__); + DocStr(__eq__, "Compare GBPosition for equality.", ""); + bool __eq__(PyObject* other) { + wxGBPosition temp, *obj = &temp; + if ( other == Py_None ) return false; + if ( ! wxGBPosition_helper(other, &obj) ) { + PyErr_Clear(); + return false; + } + return self->operator==(*obj); + } + + + KeepGIL(__ne__); + DocStr(__ne__, "Compare GBPosition for inequality.", ""); + bool __ne__(PyObject* other) { + wxGBPosition temp, *obj = &temp; + if ( other == Py_None ) return true; + if ( ! wxGBPosition_helper(other, &obj)) { + PyErr_Clear(); + return true; + } + return self->operator!=(*obj); + } + } + + %extend { void Set(int row=0, int col=0) { self->SetRow(row); @@ -150,14 +171,35 @@ cell in each direction.", ""); int GetColspan() const; void SetRowspan(int rowspan); void SetColspan(int colspan); + -// %extend { -// bool __eq__(const wxGBSpan* other) { return other ? (*self == *other) : false; } -// bool __ne__(const wxGBSpan* other) { return other ? (*self != *other) : true; } -// } - bool operator==(const wxGBSpan& other); - bool operator!=(const wxGBSpan& other); - + %extend { + KeepGIL(__eq__); + DocStr(__eq__, "Compare wxGBSpan for equality.", ""); + bool __eq__(PyObject* other) { + wxGBSpan temp, *obj = &temp; + if ( other == Py_None ) return false; + if ( ! wxGBSpan_helper(other, &obj) ) { + PyErr_Clear(); + return false; + } + return self->operator==(*obj); + } + + + KeepGIL(__ne__); + DocStr(__ne__, "Compare GBSpan for inequality.", ""); + bool __ne__(PyObject* other) { + wxGBSpan temp, *obj = &temp; + if ( other == Py_None ) return true; + if ( ! wxGBSpan_helper(other, &obj)) { + PyErr_Clear(); + return true; + } + return self->operator!=(*obj); + } + } + %extend { void Set(int rowspan=1, int colspan=1) { @@ -351,6 +393,10 @@ is successful and after the next Layout() the item will be resized. void , SetGBSizer(wxGridBagSizer* sizer), "Set the sizer this item is a member of.", ""); + %property(EndPos, GetEndPos, doc="See `GetEndPos`"); + %property(GBSizer, GetGBSizer, SetGBSizer, doc="See `GetGBSizer` and `SetGBSizer`"); + %property(Pos, GetPos, SetPos, doc="See `GetPos` and `SetPos`"); + %property(Span, GetSpan, SetSpan, doc="See `GetSpan` and `SetSpan`"); }; @@ -508,7 +554,17 @@ Find the sizer item for the given window or subsizer, returns None if not found. (non-recursive)", ""); wxGBSizerItem* FindItem(wxWindow* window); wxGBSizerItem* FindItem(wxSizer* sizer); - + %pythoncode { + def GetItem(self, item): + gbsi = None + si = wx.FlexGridSizer.GetItem(self, item) + if not si: + return None + if type(item) is not int: + gbsi = self.FindItem(item) + if gbsi: return gbsi + return si + } DocDeclStr( wxGBSizerItem* , FindItemAtPosition(const wxGBPosition& pos), @@ -557,7 +613,6 @@ for intersection, for example it may be the item we are checking the position of.", "", CheckForIntersectionPos); - };