:see: `wx.SizerItemSpacer`, `wx.SizerItemWindow`, `wx.SizerItemSizer`", "");
+
+ ~wxSizerItem();
%extend {
{
wxPyUserData* data = NULL;
if ( userData ) {
- bool blocked = wxPyBeginBlockThreads();
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
data = new wxPyUserData(userData);
wxPyEndBlockThreads(blocked);
}
{
wxPyUserData* data = NULL;
if ( userData ) {
- bool blocked = wxPyBeginBlockThreads();
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
data = new wxPyUserData(userData);
wxPyEndBlockThreads(blocked);
}
int border, PyObject* userData=NULL ),
"Constructs a `wx.SizerItem` for tracking a subsizer", "");
+ %disownarg( wxSizer *sizer );
%RenameCtor(SizerItemSizer, wxSizerItem( wxSizer *sizer, int proportion, int flag,
int border, PyObject* userData=NULL ))
{
wxPyUserData* data = NULL;
if ( userData ) {
- bool blocked = wxPyBeginBlockThreads();
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
data = new wxPyUserData(userData);
wxPyEndBlockThreads(blocked);
}
return new wxSizerItem(sizer, proportion, flag, border, data);
}
+ %cleardisown( wxSizer *sizer );
}
needed by borders.", "");
DocDeclStr(
- void , SetDimension( wxPoint pos, wxSize size ),
+ void , SetDimension( const wxPoint& pos, const wxSize& size ),
"Set the position and size of the space allocated for this item by the
sizer, and adjust the position and size of the item (window or
subsizer) to be within that space taking alignment and borders into
DocStr(SetRatio,
"Set the ratio item attribute.", "");
%Rename(SetRatioWH, void, SetRatio( int width, int height ));
- %Rename(SetRatioSize, void, SetRatio( wxSize size ));
+ %Rename(SetRatioSize, void, SetRatio( const wxSize& size ));
void SetRatio( float ratio );
DocDeclStr(
wxSizer *, GetSizer(),
"Get the subsizer (if any) that is managed by this sizer item.", "");
+ %disownarg( wxSizer *sizer );
DocDeclStr(
void , SetSizer( wxSizer *sizer ),
"Set the subsizer to be managed by this sizer item.", "");
+ %cleardisown( wxSizer *sizer );
DocDeclStr(
return Py_None;
}
}
+
+ DocStr(SetUserData,
+ "Associate a Python object with this sizer item.", "");
+ void SetUserData(PyObject* userData) {
+ wxPyUserData* data = NULL;
+ if ( userData ) {
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
+ data = new wxPyUserData(userData);
+ wxPyEndBlockThreads(blocked);
+ }
+ self->SetUserData(data);
+ }
}
};
if ( !(info.window || info.sizer || (checkSize && info.gotSize) || (checkIdx && info.gotPos)) ) {
// no expected type, figure out what kind of error message to generate
if ( !checkSize && !checkIdx )
- PyErr_SetString(PyExc_TypeError, "wxWindow or wxSizer expected for item");
+ PyErr_SetString(PyExc_TypeError, "wx.Window or wx.Sizer expected for item");
else if ( checkSize && !checkIdx )
- PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer, wxSize, or (w,h) expected for item");
+ PyErr_SetString(PyExc_TypeError, "wx.Window, wx.Sizer, wx.Size, or (w,h) expected for item");
else if ( !checkSize && checkIdx)
- PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer or int (position) expected for item");
+ PyErr_SetString(PyExc_TypeError, "wx.Window, wx.Sizer or int (position) expected for item");
else
// can this one happen?
- PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer, wxSize, or (w,h) or int (position) expected for item");
+ PyErr_SetString(PyExc_TypeError, "wx.Window, wx.Sizer, wx.Size, or (w,h) or int (position) expected for item");
}
return info;
more space than on Windows, then the initial size of a dialog using a
sizer will automatically be bigger on Mac than on Windows.", "
+Sizers may also be used to control the layout of custom drawn items on
+the window. The `Add`, `Insert`, and `Prepend` functions return a
+pointer to the newly added `wx.SizerItem`. Just add empty space of the
+desired size and attributes, and then use the `wx.SizerItem.GetRect`
+method to determine where the drawing operations should take place.
+
:note: If you wish to create a custom sizer class in wxPython you
should derive the class from `wx.PySizer` in order to get
Python-aware capabilities for the various virtual methods.
class wxSizer : public wxObject {
public:
// wxSizer(); **** abstract, can't instantiate
- // ~wxSizer();
+
+ ~wxSizer();
%extend {
void _setOORInfo(PyObject* _self) {
|- wx.ALL | |
| | |
+----------------------------+------------------------------------------+
- |- wx.EXAPAND |The item will be expanded to fill |
+ |- wx.EXPAND |The item will be expanded to fill |
| |the space allotted to the item. |
+----------------------------+------------------------------------------+
|- wx.SHAPED |The item will be expanded as much as |
PyObject* userData=NULL) {
wxPyUserData* data = NULL;
- bool blocked = wxPyBeginBlockThreads();
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
if ( userData && (info.window || info.sizer || info.gotSize) )
data = new wxPyUserData(userData);
+ if ( info.sizer )
+ PyObject_SetAttrString(item,"thisown",Py_False);
wxPyEndBlockThreads(blocked);
// Now call the real Add method if a valid item type was found
int border=0, PyObject* userData=NULL) {
wxPyUserData* data = NULL;
- bool blocked = wxPyBeginBlockThreads();
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
if ( userData && (info.window || info.sizer || info.gotSize) )
data = new wxPyUserData(userData);
+ if ( info.sizer )
+ PyObject_SetAttrString(item,"thisown",Py_False);
wxPyEndBlockThreads(blocked);
// Now call the real Insert method if a valid item type was found
PyObject* userData=NULL) {
wxPyUserData* data = NULL;
- bool blocked = wxPyBeginBlockThreads();
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
if ( userData && (info.window || info.sizer || info.gotSize) )
data = new wxPyUserData(userData);
+ if ( info.sizer )
+ PyObject_SetAttrString(item,"thisown",Py_False);
wxPyEndBlockThreads(blocked);
// Now call the real Prepend method if a valid item type was found
instead.
");
bool Remove(PyObject* item) {
- bool blocked = wxPyBeginBlockThreads();
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
wxPyEndBlockThreads(blocked);
if ( info.window )
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();
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
wxPyEndBlockThreads(blocked);
if ( info.window )
"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.", "");
+the item to be found.", "");
wxSizerItem* GetItem(PyObject* item) {
- bool blocked = wxPyBeginBlockThreads();
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
wxPyEndBlockThreads(blocked);
if ( info.window )
void _SetItemMinSize(PyObject* item, const wxSize& size) {
- bool blocked = wxPyBeginBlockThreads();
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
wxPyEndBlockThreads(blocked);
if ( info.window )
return self._SetItemMinSize(item, args[0])
}
+
+ %disownarg( wxSizerItem *item );
+
DocDeclAStrName(
wxSizerItem* , Add( wxSizerItem *item ),
"AddItem(self, SizerItem item)",
"Prepends a `wx.SizerItem` to the sizer.", "",
PrependItem);
+ %cleardisown( wxSizerItem *item );
%pythoncode {
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();
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
wxPyEndBlockThreads(blocked);
if ( info.window )
DocAStr(IsShown,
"IsShown(self, item)",
- "Determines if the item is currently shown. sizer. To make a sizer
+ "Determines if the item is currently shown. 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.", "");
bool IsShown(PyObject* item) {
- bool blocked = wxPyBeginBlockThreads();
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, false);
wxPyEndBlockThreads(blocked);
if ( info.window )
%pythoncode {
def Hide(self, item, recursive=False):
"""
- A convenience method for Show(item, False, recursive).
+ A convenience method for `Show` (item, False, recursive).
"""
return self.Show(item, False, recursive)
}