Added wxClientDataContainer to wxSizer, so sizers can now do OOR in
wxPython too. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12130 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -837,6 +837,41 @@ static void *SwigwxSizerTowxObject(void *ptr) {
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
static void wxSizer__setOORInfo(wxSizer *self,PyObject * _self) {
|
||||
self->SetClientObject(new wxPyClientData(_self));
|
||||
}
|
||||
static PyObject *_wrap_wxSizer__setOORInfo(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxSizer * _arg0;
|
||||
PyObject * _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
char *_kwnames[] = { "self","_self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxSizer__setOORInfo",_kwnames,&_argo0,&_obj1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSizer_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSizer__setOORInfo. Expected _wxSizer_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
_arg1 = _obj1;
|
||||
}
|
||||
{
|
||||
wxPy_BEGIN_ALLOW_THREADS;
|
||||
wxSizer__setOORInfo(_arg0,_arg1);
|
||||
|
||||
wxPy_END_ALLOW_THREADS;
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static void wxSizer_Destroy(wxSizer *self) { delete self; }
|
||||
static PyObject *_wrap_wxSizer_Destroy(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
@@ -2912,6 +2947,7 @@ static PyMethodDef sizerscMethods[] = {
|
||||
{ "wxSizer_AddSizer", (PyCFunction) _wrap_wxSizer_AddSizer, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxSizer_AddWindow", (PyCFunction) _wrap_wxSizer_AddWindow, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxSizer_Destroy", (PyCFunction) _wrap_wxSizer_Destroy, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxSizer__setOORInfo", (PyCFunction) _wrap_wxSizer__setOORInfo, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxSizerItem_GetUserData", (PyCFunction) _wrap_wxSizerItem_GetUserData, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxSizerItem_SetBorder", (PyCFunction) _wrap_wxSizerItem_SetBorder, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxSizerItem_SetFlag", (PyCFunction) _wrap_wxSizerItem_SetFlag, METH_VARARGS | METH_KEYWORDS },
|
||||
|
||||
@@ -103,6 +103,9 @@ class wxSizerPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def _setOORInfo(self, *_args, **_kwargs):
|
||||
val = apply(sizersc.wxSizer__setOORInfo,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def Destroy(self, *_args, **_kwargs):
|
||||
val = apply(sizersc.wxSizer_Destroy,(self,) + _args, _kwargs)
|
||||
return val
|
||||
@@ -252,6 +255,7 @@ class wxPySizer(wxPySizerPtr):
|
||||
self.this = apply(sizersc.new_wxPySizer,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setCallbackInfo(self, wxPySizer)
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
@@ -276,6 +280,7 @@ class wxBoxSizer(wxBoxSizerPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(sizersc.new_wxBoxSizer,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
@@ -300,6 +305,7 @@ class wxStaticBoxSizer(wxStaticBoxSizerPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(sizersc.new_wxStaticBoxSizer,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
@@ -324,6 +330,7 @@ class wxNotebookSizer(wxNotebookSizerPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(sizersc.new_wxNotebookSizer,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
@@ -369,6 +376,7 @@ class wxGridSizer(wxGridSizerPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(sizersc.new_wxGridSizer,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
@@ -402,6 +410,7 @@ class wxFlexGridSizer(wxFlexGridSizerPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(sizersc.new_wxFlexGridSizer,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1499,7 +1499,8 @@ def wxPyTypeCast(obj, typeStr):
|
||||
theClass = globals()[typeStr+"Ptr"]
|
||||
typeStr = __wxPyPtrTypeMap.get(typeStr, typeStr)
|
||||
if hasattr(obj, "this"):
|
||||
if obj.__class__ is theClass: # if already the right type then just return it
|
||||
# if already the right type then just return it
|
||||
if isinstance(obj, theClass) or obj.__class__ is theClass:
|
||||
return obj
|
||||
newPtr = ptrcast(obj.this, typeStr+"_p")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user