diff options
| author | Jeff Armstrong <jeffrey.armstrong@approximatrix.com> | 2011-07-13 22:31:36 -0400 |
|---|---|---|
| committer | Jeff Armstrong <jeffrey.armstrong@approximatrix.com> | 2011-07-13 22:31:36 -0400 |
| commit | 206bac5ec8a0faafc1e65c992b404f80a9d96daf (patch) | |
| tree | 433f0b8cf10c799dbc4bdf46a79b1d28bce44e67 /lib/py_aes.c | |
| parent | 33346eaee2add1bf9c801cf92f19664ffaa71f2b (diff) | |
| download | gempy-206bac5ec8a0faafc1e65c992b404f80a9d96daf.tar.gz gempy-206bac5ec8a0faafc1e65c992b404f80a9d96daf.zip | |
Added a number of AES Window library function wrappers.
Diffstat (limited to 'lib/py_aes.c')
| -rw-r--r-- | lib/py_aes.c | 134 |
1 files changed, 132 insertions, 2 deletions
diff --git a/lib/py_aes.c b/lib/py_aes.c index d4d315b..6f60a29 100644 --- a/lib/py_aes.c +++ b/lib/py_aes.c @@ -48,7 +48,7 @@ int x; } /* --- Resources Library --- */ -static void __CDECL py_rsrc_load(PyObject *self, PyObject *args) +static PyObject* __CDECL py_rsrc_load(PyObject *self, PyObject *args) { char *file; int x; @@ -60,7 +60,9 @@ int x; PyErr_SetString(GEMError,"Resource failed to load"); return NULL; } - return Py_BuildValue("i",x); + + Py_INCREF(Py_None); + return Py_None; } static PyObject* __CDECL py_rsrc_gaddr(PyObject *self, PyObject *args) @@ -79,3 +81,131 @@ void *gaddr; return PyCapsule_New(gaddr,NULL,NULL); } + +/* --- Windows Library --- */ +static PyObject* __CDECL py_wind_create(PyObject *self, PyObject *args) +{ +int type, x, y, w, h; +int ret; + + if(!PyArg_ParseTuple(args,"i(iiii)",&type,&x,&y,&w,&h)) + return NULL; + + return Py_BuildValue("i",wind_create(type,x,y,w,h)); +} + +static PyObject* __CDECL py_wind_close(PyObject *self, PyObject *args) +{ +int id; + + if(!PyArg_ParseTuple(args,"i",&id)) + return NULL; + + if(wind_close(id) == 0) { + PyErr_SetString(GEMError,"Window failed to close"); + return NULL; + } + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* __CDECL py_wind_delete(PyObject *self, PyObject *args) +{ +int id; + + if(!PyArg_ParseTuple(args,"i",&id)) + return NULL; + + if(wind_delete(id) == 0) { + PyErr_SetString(GEMError,"Window was not deleted"); + return NULL; + } + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* __CDECL py_wind_open(PyObject *self, PyObject *args) +{ +int id, x, y, w, h; +int ret; + + if(!PyArg_ParseTuple(args,"i(iiii)",&id,&x,&y,&w,&h)) + return NULL; + + ret = wind_open(type,x,y,w,h); + if(ret == 0) { + PyErr_SetString(GEMError,"Window could not be opened"); + return NULL; + } + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* __CDECL py_wind_get(PyObject *self, PyObject *args) +{ +int id, gp; +int w1, w2, w3, w4; +int ret; + + if(!PyArg_ParseTuple(args,"ii",&id,&gp)) + return NULL; + + ret = wind_get(id,gp,&w1,&w2,&w3,&w4); + if(ret == 0) { + PyErr_SetString(GEMError,"Window request failed"); + return NULL; + } + + switch(gp) { + + case WF_WORKXYWH: + case WF_WINXCFG: + case WF_WINX: + case WF_WIDGETS: + case WF_UNICONIFY: + case WF_TOP: + case WF_PREVXYWH: + case WF_OWNER: + case WF_NTOOLBAR: + case WF_NEXTXYWH: + case WF_MINXYWH: + case WF_FULLXYWH: + case WF_FTOOLBAR: + case WF_FIRSTXYWH: + case WF_DDELAY: + case WF_CURRXYWH: + return Py_BuildValue("(iiii)", w1, w2, w3, w4); + break; + case WF_DCOLOR: + case WF_ICONIFY: + case WF_NEWDESK: + return Py_BuildValue("(iii)", w1, w2, w3); + break; + case WF_MENU: + case WF_TOOLBAR: + case WF_M_WINDLIST: + return Py_BuildValue("(ii)", w1, w2); + break; + case XA: + return Py_BuildValue("ii", ret, w1); + break; + case WF_BEVENT: + case WF_BOTTOM: + case WF_HSLIDE: + case WF_HSLSIZE: + case WF_KIND: + case WF_M_OWNER: + case WF_SHADE: + case WF_VSLIDE: + case WF_VSLSIZE: + default: + return Py_BuildValue("i", w1); + break; + } + + Py_INCREF(Py_None); + return Py_None; +} |
