X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/329b045c615ff0a40a7bbaf1440a262b1d702d0d..02161c7c81e12685d04a1f73e714ca52ad858f6c:/wxPython/src/_sizers.i?ds=inline diff --git a/wxPython/src/_sizers.i b/wxPython/src/_sizers.i index 6fe840b6ba..d85ecefb7a 100644 --- a/wxPython/src/_sizers.i +++ b/wxPython/src/_sizers.i @@ -263,8 +263,8 @@ isn't any.", ""); struct wxPySizerItemInfo { wxPySizerItemInfo() - : window(NULL), sizer(NULL), gotSize(False), - size(wxDefaultSize), gotPos(False), pos(-1) + : window(NULL), sizer(NULL), gotSize(false), + size(wxDefaultSize), gotPos(false), pos(-1) {} wxWindow* window; @@ -295,13 +295,13 @@ static wxPySizerItemInfo wxPySizerItemTypeHelper(PyObject* item, bool checkSize, // try wxSize or (w,h) if ( checkSize && wxSize_helper(item, &sizePtr)) { info.size = *sizePtr; - info.gotSize = True; + info.gotSize = true; } // or a single int if (checkIdx && PyInt_Check(item)) { info.pos = PyInt_AsLong(item); - info.gotPos = True; + info.gotPos = true; } } } @@ -372,7 +372,8 @@ public: %extend { void _setOORInfo(PyObject* _self) { - self->SetClientObject(new wxPyOORClientData(_self)); + if (!self->GetClientObject()) + self->SetClientObject(new wxPyOORClientData(_self)); } DocAStr(Add, @@ -481,7 +482,7 @@ public: wxPyUserData* data = NULL; bool blocked = wxPyBeginBlockThreads(); - wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, True, False); + wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false); if ( userData && (info.window || info.sizer || info.gotSize) ) data = new wxPyUserData(userData); wxPyEndBlockThreads(blocked); @@ -496,6 +497,8 @@ public: proportion, flag, border, data); } +// virtual void AddSpacer(int size); +// virtual void AddStretchSpacer(int prop = 1); DocAStr(Insert, "Insert(self, int before, item, int proportion=0, int flag=0, int border=0, @@ -508,7 +511,7 @@ the item at index *before*. See `Add` for a description of the parameters.", "" wxPyUserData* data = NULL; bool blocked = wxPyBeginBlockThreads(); - wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, True, False); + wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false); if ( userData && (info.window || info.sizer || info.gotSize) ) data = new wxPyUserData(userData); wxPyEndBlockThreads(blocked); @@ -524,6 +527,8 @@ the item at index *before*. See `Add` for a description of the parameters.", "" } +// virtual void InsertSpacer(size_t index, int size); +// virtual void InsertStretchSpacer(size_t index, int prop = 1); DocAStr(Prepend, "Prepend(self, item, int proportion=0, int flag=0, int border=0, @@ -536,7 +541,7 @@ this sizer. See `Add` for a description of the parameters.", ""); wxPyUserData* data = NULL; bool blocked = wxPyBeginBlockThreads(); - wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, True, False); + wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false); if ( userData && (info.window || info.sizer || info.gotSize) ) data = new wxPyUserData(userData); wxPyEndBlockThreads(blocked); @@ -551,6 +556,8 @@ this sizer. See `Add` for a description of the parameters.", ""); proportion, flag, border, data); } +// virtual void PrependSpacer(int size); +// virtual void PrependStretchSpacer(int prop = 1); DocAStr(Remove, "Remove(self, item) -> bool", @@ -568,7 +575,7 @@ and removed.", " "); bool Remove(PyObject* item) { bool blocked = wxPyBeginBlockThreads(); - wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, True); + wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true); wxPyEndBlockThreads(blocked); if ( info.window ) return self->Remove(info.window); @@ -577,7 +584,7 @@ and removed.", " else if ( info.gotPos ) return self->Remove(info.pos); else - return False; + return false; } @@ -590,7 +597,7 @@ zero-based index of the item to be detached. Returns True if the child item was found and detached.", ""); bool Detach(PyObject* item) { bool blocked = wxPyBeginBlockThreads(); - wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, True); + wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true); wxPyEndBlockThreads(blocked); if ( info.window ) return self->Detach(info.window); @@ -599,13 +606,13 @@ was found and detached.", ""); else if ( info.gotPos ) return self->Detach(info.pos); else - return False; + return false; } void _SetItemMinSize(PyObject* item, const wxSize& size) { bool blocked = wxPyBeginBlockThreads(); - wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, True); + wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true); wxPyEndBlockThreads(blocked); if ( info.window ) self->SetItemMinSize(info.window, size); @@ -786,7 +793,7 @@ this will set them appropriately. DocDeclStr( - void , Clear( bool deleteWindows=False ), + void , Clear( bool deleteWindows=false ), "Clear all items from the sizer, optionally destroying the window items as well.", ""); @@ -813,21 +820,24 @@ as well.", ""); %extend { DocAStr(Show, - "Show(self, item, bool show=True)", + "Show(self, item, bool show=True, bool recursive=false) -> bool", "Shows or hides an item managed by the sizer. To make a sizer item disappear or reappear, use Show followed by `Layout`. The *item* parameter can be either a window, a sizer, or the zero-based index of -the item.", ""); - void Show(PyObject* item, bool show = True) { +the item. Use the recursive parameter to show or hide an item in a +subsizer. Returns True if the item was found.", ""); + bool Show(PyObject* item, bool show = true, bool recursive=false) { bool blocked = wxPyBeginBlockThreads(); - wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, True); + wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true); wxPyEndBlockThreads(blocked); if ( info.window ) - self->Show(info.window, show); + return self->Show(info.window, show, recursive); else if ( info.sizer ) - self->Show(info.sizer, show); + return self->Show(info.sizer, show, recursive); else if ( info.gotPos ) - self->Show(info.pos, show); + return self->Show(info.pos, show); + else + return false; } DocAStr(IsShown, @@ -838,7 +848,7 @@ parameter can be either a window, a sizer, or the zero-based index of the item.", ""); bool IsShown(PyObject* item) { bool blocked = wxPyBeginBlockThreads(); - wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, False); + wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, false); wxPyEndBlockThreads(blocked); if ( info.window ) return self->IsShown(info.window); @@ -847,16 +857,16 @@ the item.", ""); else if ( info.gotPos ) return self->IsShown(info.pos); else - return False; + return false; } } %pythoncode { - def Hide(self, item): + def Hide(self, item, recursive=False): """ - A convenience method for Show(item, False). + A convenience method for Show(item, False, recursive). """ - self.Show(item, False) + return self.Show(item, false, recursive) }