wxSize , GetMinSize(),
"Get the minimum size needed for the item.", "");
+ DocDeclStr(
+ wxSize , GetMinSizeWithBorder() const,
+ "Get the minimum size needed for the item with space for the borders
+added, if needed.", "");
+
DocDeclStr(
void , SetInitSize( int x, int y ),
"", "");
DocDeclStr(
float , GetRatio(),
"Set the ratio item attribute.", "");
+
+ DocDeclStr(
+ wxRect , GetRect(),
+ "Returns the rectangle that the sizer item should occupy", "");
DocDeclStr(
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;
// 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;
}
}
}
%extend {
void _setOORInfo(PyObject* _self) {
- self->SetClientObject(new wxPyOORClientData(_self));
+ if (!self->GetClientObject())
+ self->SetClientObject(new wxPyOORClientData(_self));
}
DocAStr(Add,
"Add(self, item, int proportion=0, int flag=0, int border=0,
- PyObject userData=None)",
+ PyObject userData=None) -> wx.SizerItem",
"Appends a child item to the sizer.", "
is more complex than the *proportion* and *flag* will allow for.
");
- void Add(PyObject* item, int proportion=0, int flag=0, int border=0,
- PyObject* userData=NULL) {
+ wxSizerItem* Add(PyObject* item, int proportion=0, int flag=0, int border=0,
+ PyObject* userData=NULL) {
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);
// Now call the real Add method if a valid item type was found
if ( info.window )
- self->Add(info.window, proportion, flag, border, data);
+ return self->Add(info.window, proportion, flag, border, data);
else if ( info.sizer )
- self->Add(info.sizer, proportion, flag, border, data);
+ return self->Add(info.sizer, proportion, flag, border, data);
else if (info.gotSize)
- self->Add(info.size.GetWidth(), info.size.GetHeight(),
- proportion, flag, border, data);
+ return self->Add(info.size.GetWidth(), info.size.GetHeight(),
+ proportion, flag, border, data);
+ else
+ return NULL;
}
+// virtual wxSizerItem* AddSpacer(int size);
+// virtual wxSizerItem* AddStretchSpacer(int prop = 1);
DocAStr(Insert,
"Insert(self, int before, item, int proportion=0, int flag=0, int border=0,
- PyObject userData=None)",
+ PyObject userData=None) -> wx.SizerItem",
"Inserts a new item into the list of items managed by this sizer before
the item at index *before*. See `Add` for a description of the parameters.", "");
- void Insert(int before, PyObject* item, int proportion=0, int flag=0,
- int border=0, PyObject* userData=NULL) {
+ wxSizerItem* Insert(int before, PyObject* item, int proportion=0, int flag=0,
+ int border=0, PyObject* userData=NULL) {
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);
// Now call the real Insert method if a valid item type was found
if ( info.window )
- self->Insert(before, info.window, proportion, flag, border, data);
+ return self->Insert(before, info.window, proportion, flag, border, data);
else if ( info.sizer )
- self->Insert(before, info.sizer, proportion, flag, border, data);
+ return self->Insert(before, info.sizer, proportion, flag, border, data);
else if (info.gotSize)
- self->Insert(before, info.size.GetWidth(), info.size.GetHeight(),
- proportion, flag, border, data);
+ return self->Insert(before, info.size.GetWidth(), info.size.GetHeight(),
+ proportion, flag, border, data);
+ else
+ return NULL;
}
+// virtual wxSizerItem* InsertSpacer(size_t index, int size);
+// virtual wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1);
DocAStr(Prepend,
"Prepend(self, item, int proportion=0, int flag=0, int border=0,
- PyObject userData=None)",
+ PyObject userData=None) -> wx.SizerItem",
"Adds a new item to the begining of the list of sizer items managed by
this sizer. See `Add` for a description of the parameters.", "");
- void Prepend(PyObject* item, int proportion=0, int flag=0, int border=0,
- PyObject* userData=NULL) {
+ wxSizerItem* Prepend(PyObject* item, int proportion=0, int flag=0, int border=0,
+ PyObject* userData=NULL) {
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);
// Now call the real Prepend method if a valid item type was found
if ( info.window )
- self->Prepend(info.window, proportion, flag, border, data);
+ return self->Prepend(info.window, proportion, flag, border, data);
else if ( info.sizer )
- self->Prepend(info.sizer, proportion, flag, border, data);
+ return self->Prepend(info.sizer, proportion, flag, border, data);
else if (info.gotSize)
- self->Prepend(info.size.GetWidth(), info.size.GetHeight(),
- proportion, flag, border, data);
+ return self->Prepend(info.size.GetWidth(), info.size.GetHeight(),
+ proportion, flag, border, data);
+ else
+ return NULL;
}
+// virtual wxSizerItem* PrependSpacer(int size);
+// virtual wxSizerItem* PrependStretchSpacer(int prop = 1);
DocAStr(Remove,
"Remove(self, item) -> bool",
");
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);
else if ( info.gotPos )
return self->Remove(info.pos);
else
- return False;
+ return false;
}
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);
else if ( info.gotPos )
return self->Detach(info.pos);
else
- return False;
+ return false;
+ }
+
+
+ DocAStr(GetItem,
+ "GetItem(self, item) -> wx.SizerItem",
+ "Returns the `wx.SizerItem` which holds the *item* given. The *item*
+parameter can be either a window, a sizer, or the zero-based index of
+the item to be detached.", "");
+ wxSizerItem* GetItem(PyObject* item) {
+ bool blocked = wxPyBeginBlockThreads();
+ wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
+ wxPyEndBlockThreads(blocked);
+ if ( info.window )
+ return self->GetItem(info.window);
+ else if ( info.sizer )
+ return self->GetItem(info.sizer);
+ else if ( info.gotPos )
+ return self->GetItem(info.pos);
+ else
+ return NULL;
}
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);
}
DocDeclAStrName(
- void , Add( wxSizerItem *item ),
+ wxSizerItem* , Add( wxSizerItem *item ),
"AddItem(self, SizerItem item)",
"Adds a `wx.SizerItem` to the sizer.", "",
AddItem);
DocDeclAStrName(
- void , Insert( size_t index, wxSizerItem *item ),
+ wxSizerItem* , Insert( size_t index, wxSizerItem *item ),
"InsertItem(self, int index, SizerItem item)",
"Inserts a `wx.SizerItem` to the sizer at the position given by *index*.", "",
InsertItem);
DocDeclAStrName(
- void , Prepend( wxSizerItem *item ),
+ wxSizerItem* , Prepend( wxSizerItem *item ),
"PrependItem(self, SizerItem item)",
"Prepends a `wx.SizerItem` to the sizer.", "",
PrependItem);
DocDeclStr(
- void , Clear( bool deleteWindows=False ),
+ void , Clear( bool deleteWindows=false ),
"Clear all items from the sizer, optionally destroying the window items
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,
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);
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)
}
DocDeclStr(
void , ShowItems(bool show),
- "Recursively call `wx.Window.Show` on all sizer items.", "");
+ "Recursively call `wx.SizerItem.Show` on all sizer items.", "");
};