Fixed wxPoint.__cmp__ and a few others

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10201 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2001-05-18 02:32:22 +00:00
parent 3bdc265d9d
commit 419c299ae5
6 changed files with 72 additions and 12 deletions

View File

@ -107,6 +107,8 @@ specific. It could have been added long ago but OOR required it.
Finally added wxPyLineShape.GetLineControlPoints, which has been on my
list for a while. The above OOR modification made this easier.
Fixed the __cmp__ methods for wxPoiunt and others.
2.2.6

View File

@ -75,6 +75,12 @@ public:
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
return tup;
}
int __cmp__(const wxSize* sz) {
if (! sz) return 1;
if (*self == *sz) return 0;
return -1;
}
}
%pragma(python) addtoclass = "
@ -122,8 +128,9 @@ public:
}
int __cmp__(const wxRealPoint* p) {
if (! p) return 0;
return *self == *p;
if (! p) return 1;
if (*self == *p) return 0;
return -1;
}
}
%pragma(python) addtoclass = "
@ -169,8 +176,9 @@ public:
}
int __cmp__(const wxPoint* p) {
if (! p) return 0;
return *self == *p;
if (! p) return 1;
if (*self == *p) return 0;
return -1;
}
}
%pragma(python) addtoclass = "
@ -237,8 +245,9 @@ public:
}
int __cmp__(const wxRect* rect) {
if (! rect) return 0;
return *self == *rect;
if (! rect) return 1;
if (*self == *rect) return 0;
return -1;
}
}

View File

@ -1325,6 +1325,44 @@ static PyObject *_wrap_wxSize_asTuple(PyObject *self, PyObject *args, PyObject *
return _resultobj;
}
static int wxSize___cmp__(wxSize *self,const wxSize * sz) {
if (! sz) return 1;
if (*self == *sz) return 0;
return -1;
}
static PyObject *_wrap_wxSize___cmp__(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxSize * _arg0;
wxSize * _arg1;
wxSize temp;
PyObject * _obj0 = 0;
wxSize temp0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","sz", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxSize___cmp__",_kwnames,&_obj0,&_obj1))
return NULL;
{
_arg0 = &temp;
if (! wxSize_helper(_obj0, &_arg0))
return NULL;
}
{
_arg1 = &temp0;
if (! wxSize_helper(_obj1, &_arg1))
return NULL;
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxSize___cmp__(_arg0,_arg1);
wxPy_END_ALLOW_THREADS;
} _resultobj = Py_BuildValue("i",_result);
return _resultobj;
}
#define wxRealPoint_x_set(_swigobj,_swigval) (_swigobj->x = _swigval,_swigval)
static PyObject *_wrap_wxRealPoint_x_set(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@ -1627,8 +1665,9 @@ static PyObject *_wrap_wxRealPoint___sub__(PyObject *self, PyObject *args, PyObj
}
static int wxRealPoint___cmp__(wxRealPoint *self,const wxRealPoint * p) {
if (! p) return 0;
return *self == *p;
if (! p) return 1;
if (*self == *p) return 0;
return -1;
}
static PyObject *_wrap_wxRealPoint___cmp__(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@ -1965,8 +2004,9 @@ static PyObject *_wrap_wxPoint___sub__(PyObject *self, PyObject *args, PyObject
}
static int wxPoint___cmp__(wxPoint *self,const wxPoint * p) {
if (! p) return 0;
return *self == *p;
if (! p) return 1;
if (*self == *p) return 0;
return -1;
}
static PyObject *_wrap_wxPoint___cmp__(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@ -2879,8 +2919,9 @@ static PyObject *_wrap_wxRect___add__(PyObject *self, PyObject *args, PyObject *
}
static int wxRect___cmp__(wxRect *self,const wxRect * rect) {
if (! rect) return 0;
return *self == *rect;
if (! rect) return 1;
if (*self == *rect) return 0;
return -1;
}
static PyObject *_wrap_wxRect___cmp__(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@ -3990,6 +4031,7 @@ static PyMethodDef misccMethods[] = {
{ "wxRealPoint_y_set", (PyCFunction) _wrap_wxRealPoint_y_set, METH_VARARGS | METH_KEYWORDS },
{ "wxRealPoint_x_get", (PyCFunction) _wrap_wxRealPoint_x_get, METH_VARARGS | METH_KEYWORDS },
{ "wxRealPoint_x_set", (PyCFunction) _wrap_wxRealPoint_x_set, METH_VARARGS | METH_KEYWORDS },
{ "wxSize___cmp__", (PyCFunction) _wrap_wxSize___cmp__, METH_VARARGS | METH_KEYWORDS },
{ "wxSize_asTuple", (PyCFunction) _wrap_wxSize_asTuple, METH_VARARGS | METH_KEYWORDS },
{ "wxSize_SetHeight", (PyCFunction) _wrap_wxSize_SetHeight, METH_VARARGS | METH_KEYWORDS },
{ "wxSize_SetWidth", (PyCFunction) _wrap_wxSize_SetWidth, METH_VARARGS | METH_KEYWORDS },

View File

@ -50,6 +50,9 @@ class wxSizePtr :
def asTuple(self, *_args, **_kwargs):
val = apply(miscc.wxSize_asTuple,(self,) + _args, _kwargs)
return val
def __cmp__(self, *_args, **_kwargs):
val = apply(miscc.wxSize___cmp__,(self,) + _args, _kwargs)
return val
def __setattr__(self,name,value):
if name == "x" :
miscc.wxSize_x_set(self,value)

View File

@ -3000,6 +3000,8 @@ SWIGEXPORT(void) initwxc() {
PyDict_SetItemString(d,"wxEVT_MEASURE_ITEM", PyInt_FromLong((long) wxEVT_MEASURE_ITEM));
PyDict_SetItemString(d,"wxEVT_COMPARE_ITEM", PyInt_FromLong((long) wxEVT_COMPARE_ITEM));
PyDict_SetItemString(d,"wxEVT_INIT_DIALOG", PyInt_FromLong((long) wxEVT_INIT_DIALOG));
PyDict_SetItemString(d,"wxEVT_HELP", PyInt_FromLong((long) wxEVT_HELP));
PyDict_SetItemString(d,"wxEVT_DETAILED_HELP", PyInt_FromLong((long) wxEVT_DETAILED_HELP));
PyDict_SetItemString(d,"wxEVT_IDLE", PyInt_FromLong((long) wxEVT_IDLE));
PyDict_SetItemString(d,"wxEVT_UPDATE_UI", PyInt_FromLong((long) wxEVT_UPDATE_UI));
PyDict_SetItemString(d,"wxEVT_COMMAND_LEFT_CLICK", PyInt_FromLong((long) wxEVT_COMMAND_LEFT_CLICK));

View File

@ -818,6 +818,8 @@ wxEVT_DRAW_ITEM = wxc.wxEVT_DRAW_ITEM
wxEVT_MEASURE_ITEM = wxc.wxEVT_MEASURE_ITEM
wxEVT_COMPARE_ITEM = wxc.wxEVT_COMPARE_ITEM
wxEVT_INIT_DIALOG = wxc.wxEVT_INIT_DIALOG
wxEVT_HELP = wxc.wxEVT_HELP
wxEVT_DETAILED_HELP = wxc.wxEVT_DETAILED_HELP
wxEVT_IDLE = wxc.wxEVT_IDLE
wxEVT_UPDATE_UI = wxc.wxEVT_UPDATE_UI
wxEVT_COMMAND_LEFT_CLICK = wxc.wxEVT_COMMAND_LEFT_CLICK