A bunch of little tweaks

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@8401 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2000-09-19 00:21:48 +00:00
parent 2bd6903d18
commit a927ed1665
12 changed files with 1340 additions and 48 deletions

View File

@@ -380,7 +380,7 @@ public:
%addmethods {
int __cmp__(wxTreeItemId* other) {
if (! other) return 0;
if (! other) return -1;
return *self != *other;
}
}
@@ -392,15 +392,15 @@ public:
class wxPyTreeItemData : public wxTreeItemData {
public:
wxPyTreeItemData(PyObject* obj = NULL) {
if (obj == NULL)
if (obj == NULL)
obj = Py_None;
Py_INCREF(obj);
m_obj = obj;
Py_INCREF(obj);
m_obj = obj;
}
~wxPyTreeItemData() {
bool doSave = wxPyRestoreThread();
Py_DECREF(m_obj);
Py_DECREF(m_obj);
wxPySaveThread(doSave);
}
@@ -517,8 +517,8 @@ public:
void SetItemHasChildren(const wxTreeItemId& item, bool hasChildren = TRUE);
%addmethods {
// [Get|Set]ItemData substitutes. Automatically create wxPyTreeItemData
// if needed.
// [Get|Set]ItemData substitutes. Automatically create wxPyTreeItemData
// if needed.
wxPyTreeItemData* GetItemData(const wxTreeItemId& item) {
wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
if (data == NULL) {
@@ -532,11 +532,11 @@ public:
void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) {
data->SetId(item); // set the id
self->SetItemData(item, data);
}
}
// [Get|Set]PyData are short-cuts. Also made somewhat crash-proof by
// automatically creating data classes.
PyObject* GetPyData(const wxTreeItemId& item) {
// [Get|Set]PyData are short-cuts. Also made somewhat crash-proof by
// automatically creating data classes.
PyObject* GetPyData(const wxTreeItemId& item) {
wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
if (data == NULL) {
data = new wxPyTreeItemData();
@@ -544,7 +544,7 @@ public:
self->SetItemData(item, data);
}
return data->GetData();
}
}
void SetPyData(const wxTreeItemId& item, PyObject* obj) {
wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
@@ -554,7 +554,7 @@ public:
self->SetItemData(item, data);
} else
data->SetData(obj);
}
}
}

View File

@@ -156,6 +156,15 @@ public:
wxPoint GetLogicalPosition(const wxDC& dc);
long GetX();
long GetY();
long m_x, m_y;
bool m_leftDown;
bool m_middleDown;
bool m_rightDown;
bool m_controlDown;
bool m_shiftDown;
bool m_altDown;
bool m_metaDown;
};
//---------------------------------------------------------------------------
@@ -177,6 +186,15 @@ public:
long GetY();
wxPoint GetPosition();
%name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
long m_x, m_y;
long m_keyCode;
bool m_controlDown;
bool m_shiftDown;
bool m_altDown;
bool m_metaDown;
bool m_scanCode;
};
//---------------------------------------------------------------------------

View File

@@ -462,7 +462,7 @@ PyObject* wxPyCallbackHelper::callCallbackObj(PyObject* argTuple) const {
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// These classes can be derived from in Python and passed through the event
// system without loosing anything. They do this by keeping a reference to
// system without losing anything. They do this by keeping a reference to
// themselves and some special case handling in wxPyCallback::EventThunker.

View File

@@ -7327,7 +7327,150 @@ static PyObject *_wrap_new_wxSpinCtrl(PyObject *self, PyObject *args, PyObject *
return _resultobj;
}
#define wxSpinCtrl_GetMax(_swigobj) (_swigobj->GetMax())
static PyObject *_wrap_wxSpinCtrl_GetMax(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxSpinCtrl * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSpinCtrl_GetMax",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_GetMax. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxSpinCtrl_GetMax(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxSpinCtrl_GetMin(_swigobj) (_swigobj->GetMin())
static PyObject *_wrap_wxSpinCtrl_GetMin(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxSpinCtrl * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSpinCtrl_GetMin",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_GetMin. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxSpinCtrl_GetMin(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxSpinCtrl_GetValue(_swigobj) (_swigobj->GetValue())
static PyObject *_wrap_wxSpinCtrl_GetValue(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxSpinCtrl * _arg0;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxSpinCtrl_GetValue",_kwnames,&_argo0))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_GetValue. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxSpinCtrl_GetValue(_arg0);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxSpinCtrl_SetRange(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetRange(_swigarg0,_swigarg1))
static PyObject *_wrap_wxSpinCtrl_SetRange(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxSpinCtrl * _arg0;
int _arg1;
int _arg2;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","min","max", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxSpinCtrl_SetRange",_kwnames,&_argo0,&_arg1,&_arg2))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_SetRange. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxSpinCtrl_SetRange(_arg0,_arg1,_arg2);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
#define wxSpinCtrl_SetValue(_swigobj,_swigarg0) (_swigobj->SetValue(_swigarg0))
static PyObject *_wrap_wxSpinCtrl_SetValue(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxSpinCtrl * _arg0;
int _arg1;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","value", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxSpinCtrl_SetValue",_kwnames,&_argo0,&_arg1))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxSpinCtrl_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxSpinCtrl_SetValue. Expected _wxSpinCtrl_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxSpinCtrl_SetValue(_arg0,_arg1);
wxPy_END_ALLOW_THREADS;
} Py_INCREF(Py_None);
_resultobj = Py_None;
return _resultobj;
}
static PyMethodDef controlscMethods[] = {
{ "wxSpinCtrl_SetValue", (PyCFunction) _wrap_wxSpinCtrl_SetValue, METH_VARARGS | METH_KEYWORDS },
{ "wxSpinCtrl_SetRange", (PyCFunction) _wrap_wxSpinCtrl_SetRange, METH_VARARGS | METH_KEYWORDS },
{ "wxSpinCtrl_GetValue", (PyCFunction) _wrap_wxSpinCtrl_GetValue, METH_VARARGS | METH_KEYWORDS },
{ "wxSpinCtrl_GetMin", (PyCFunction) _wrap_wxSpinCtrl_GetMin, METH_VARARGS | METH_KEYWORDS },
{ "wxSpinCtrl_GetMax", (PyCFunction) _wrap_wxSpinCtrl_GetMax, METH_VARARGS | METH_KEYWORDS },
{ "new_wxSpinCtrl", (PyCFunction) _wrap_new_wxSpinCtrl, METH_VARARGS | METH_KEYWORDS },
{ "wxSlider_SetValue", (PyCFunction) _wrap_wxSlider_SetValue, METH_VARARGS | METH_KEYWORDS },
{ "wxSlider_SetTick", (PyCFunction) _wrap_wxSlider_SetTick, METH_VARARGS | METH_KEYWORDS },

View File

@@ -806,6 +806,21 @@ class wxSpinCtrlPtr(wxSpinButtonPtr):
def __init__(self,this):
self.this = this
self.thisown = 0
def GetMax(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_GetMax,(self,) + _args, _kwargs)
return val
def GetMin(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_GetMin,(self,) + _args, _kwargs)
return val
def GetValue(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_GetValue,(self,) + _args, _kwargs)
return val
def SetRange(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_SetRange,(self,) + _args, _kwargs)
return val
def SetValue(self, *_args, **_kwargs):
val = apply(controlsc.wxSpinCtrl_SetValue,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxSpinCtrl instance at %s>" % (self.this,)
class wxSpinCtrl(wxSpinCtrlPtr):

View File

@@ -132,15 +132,15 @@ extern wxValidator wxPyDefaultValidator;
class wxPyTreeItemData : public wxTreeItemData {
public:
wxPyTreeItemData(PyObject* obj = NULL) {
if (obj == NULL)
if (obj == NULL)
obj = Py_None;
Py_INCREF(obj);
m_obj = obj;
Py_INCREF(obj);
m_obj = obj;
}
~wxPyTreeItemData() {
bool doSave = wxPyRestoreThread();
Py_DECREF(m_obj);
Py_DECREF(m_obj);
wxPySaveThread(doSave);
}
@@ -4678,7 +4678,7 @@ static PyObject *_wrap_wxTreeItemId_IsOk(PyObject *self, PyObject *args, PyObjec
}
static int wxTreeItemId___cmp__(wxTreeItemId *self,wxTreeItemId * other) {
if (! other) return 0;
if (! other) return -1;
return *self != *other;
}
static PyObject *_wrap_wxTreeItemId___cmp__(PyObject *self, PyObject *args, PyObject *kwargs) {
@@ -5780,7 +5780,7 @@ static PyObject *_wrap_wxTreeCtrl_GetItemData(PyObject *self, PyObject *args, Py
static void wxPyTreeCtrl_SetItemData(wxPyTreeCtrl *self,const wxTreeItemId & item,wxPyTreeItemData * data) {
data->SetId(item); // set the id
self->SetItemData(item, data);
}
}
static PyObject *_wrap_wxTreeCtrl_SetItemData(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyTreeCtrl * _arg0;
@@ -5833,7 +5833,7 @@ static PyObject * wxPyTreeCtrl_GetPyData(wxPyTreeCtrl *self,const wxTreeItemId &
self->SetItemData(item, data);
}
return data->GetData();
}
}
static PyObject *_wrap_wxTreeCtrl_GetPyData(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
PyObject * _result;
@@ -5879,7 +5879,7 @@ static void wxPyTreeCtrl_SetPyData(wxPyTreeCtrl *self,const wxTreeItemId & item
self->SetItemData(item, data);
} else
data->SetData(obj);
}
}
static PyObject *_wrap_wxTreeCtrl_SetPyData(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxPyTreeCtrl * _arg0;

File diff suppressed because it is too large Load Diff

View File

@@ -298,6 +298,55 @@ class wxMouseEventPtr(wxEventPtr):
def GetY(self, *_args, **_kwargs):
val = apply(eventsc.wxMouseEvent_GetY,(self,) + _args, _kwargs)
return val
def __setattr__(self,name,value):
if name == "m_x" :
eventsc.wxMouseEvent_m_x_set(self,value)
return
if name == "m_y" :
eventsc.wxMouseEvent_m_y_set(self,value)
return
if name == "m_leftDown" :
eventsc.wxMouseEvent_m_leftDown_set(self,value)
return
if name == "m_middleDown" :
eventsc.wxMouseEvent_m_middleDown_set(self,value)
return
if name == "m_rightDown" :
eventsc.wxMouseEvent_m_rightDown_set(self,value)
return
if name == "m_controlDown" :
eventsc.wxMouseEvent_m_controlDown_set(self,value)
return
if name == "m_shiftDown" :
eventsc.wxMouseEvent_m_shiftDown_set(self,value)
return
if name == "m_altDown" :
eventsc.wxMouseEvent_m_altDown_set(self,value)
return
if name == "m_metaDown" :
eventsc.wxMouseEvent_m_metaDown_set(self,value)
return
self.__dict__[name] = value
def __getattr__(self,name):
if name == "m_x" :
return eventsc.wxMouseEvent_m_x_get(self)
if name == "m_y" :
return eventsc.wxMouseEvent_m_y_get(self)
if name == "m_leftDown" :
return eventsc.wxMouseEvent_m_leftDown_get(self)
if name == "m_middleDown" :
return eventsc.wxMouseEvent_m_middleDown_get(self)
if name == "m_rightDown" :
return eventsc.wxMouseEvent_m_rightDown_get(self)
if name == "m_controlDown" :
return eventsc.wxMouseEvent_m_controlDown_get(self)
if name == "m_shiftDown" :
return eventsc.wxMouseEvent_m_shiftDown_get(self)
if name == "m_altDown" :
return eventsc.wxMouseEvent_m_altDown_get(self)
if name == "m_metaDown" :
return eventsc.wxMouseEvent_m_metaDown_get(self)
raise AttributeError,name
def __repr__(self):
return "<C wxMouseEvent instance at %s>" % (self.this,)
class wxMouseEvent(wxMouseEventPtr):
@@ -346,6 +395,50 @@ class wxKeyEventPtr(wxEventPtr):
def GetPositionTuple(self, *_args, **_kwargs):
val = apply(eventsc.wxKeyEvent_GetPositionTuple,(self,) + _args, _kwargs)
return val
def __setattr__(self,name,value):
if name == "m_x" :
eventsc.wxKeyEvent_m_x_set(self,value)
return
if name == "m_y" :
eventsc.wxKeyEvent_m_y_set(self,value)
return
if name == "m_keyCode" :
eventsc.wxKeyEvent_m_keyCode_set(self,value)
return
if name == "m_controlDown" :
eventsc.wxKeyEvent_m_controlDown_set(self,value)
return
if name == "m_shiftDown" :
eventsc.wxKeyEvent_m_shiftDown_set(self,value)
return
if name == "m_altDown" :
eventsc.wxKeyEvent_m_altDown_set(self,value)
return
if name == "m_metaDown" :
eventsc.wxKeyEvent_m_metaDown_set(self,value)
return
if name == "m_scanCode" :
eventsc.wxKeyEvent_m_scanCode_set(self,value)
return
self.__dict__[name] = value
def __getattr__(self,name):
if name == "m_x" :
return eventsc.wxKeyEvent_m_x_get(self)
if name == "m_y" :
return eventsc.wxKeyEvent_m_y_get(self)
if name == "m_keyCode" :
return eventsc.wxKeyEvent_m_keyCode_get(self)
if name == "m_controlDown" :
return eventsc.wxKeyEvent_m_controlDown_get(self)
if name == "m_shiftDown" :
return eventsc.wxKeyEvent_m_shiftDown_get(self)
if name == "m_altDown" :
return eventsc.wxKeyEvent_m_altDown_get(self)
if name == "m_metaDown" :
return eventsc.wxKeyEvent_m_metaDown_get(self)
if name == "m_scanCode" :
return eventsc.wxKeyEvent_m_scanCode_get(self)
raise AttributeError,name
def __repr__(self):
return "<C wxKeyEvent instance at %s>" % (self.this,)
class wxKeyEvent(wxKeyEventPtr):