From f4be6ead7080a62c18058b42e4b50b9a92c2ff3a Mon Sep 17 00:00:00 2001 From: Jeff Armstrong Date: Thu, 14 Jul 2011 20:35:27 -0400 Subject: Added additional dialog calls and the two remaining (planned) window calls. --- lib/gem.c | 14 ++++++- lib/py_aes.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/py_aes.h | 5 +++ 3 files changed, 139 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/gem.c b/lib/gem.c index 941d532..7bd2705 100644 --- a/lib/gem.c +++ b/lib/gem.c @@ -24,6 +24,9 @@ GemMethods[] = { /* AES Forms Library */ {"form_alert", py_form_alert, METH_VARARGS, "Display a GEM alert dialog"}, + {"form_dial", py_form_dial, METH_VARARGS, "Reserves and releases screen memory"}, + {"form_do", py_form_do, METH_VARARGS, "Processes a dialog"}, + {"form_center", py_form_center, METH_VARARGS, "Centers an object"}, /* AES Resource Library */ {"rsrc_load", py_rsrc_load, METH_VARARGS, "Load a resource into memory"}, @@ -35,6 +38,8 @@ GemMethods[] = { {"wind_get", py_wind_get, METH_VARARGS, "Retrieve window information"}, {"wind_delete", py_wind_delete, METH_VARARGS, "Delete a window (after closing...)"}, {"wind_close", py_wind_close, METH_VARARGS, "Close a window"}, + {"wind_set", py_wind_set, METH_VARARGS, "Set a window parameter"}, + {"wind_update", py_wind_update, METH_VARARGS, "Lock window redraw for updates"}, {NULL,NULL,0,NULL} }; @@ -77,6 +82,9 @@ PROC LibFunc[] = { /* AES Forms Library */ "py_form_alert", "Internal\n", py_form_alert, + "py_form_dial", "Internal\n", py_form_dial, + "py_form_do", "Internal\n", py_form_do, + "py_form_center", "Internal\n", py_form_center, /* AES Resource Library */ "py_rsrc_load", "Internal\n", py_rsrc_load, @@ -87,11 +95,13 @@ PROC LibFunc[] = { "py_wind_open", "Internal\n", py_wind_open, "py_wind_get", "Internal\n", py_wind_get, "py_wind_delete", "Internal\n", py_wind_delete, - "py_wind_close", "Internal\n", py_wind_close + "py_wind_close", "Internal\n", py_wind_close, + "py_wind_update", "Internal\n", py_wind_update, + "py_wind_set", "Internal\n", py_wind_set }; LDGLIB LibLdg[] = { - 0x0001, 13, LibFunc, "GEM Extensions for Python", 0 + 0x0001, 18, LibFunc, "GEM Extensions for Python", 0 }; int main( void) diff --git a/lib/py_aes.c b/lib/py_aes.c index 6f60a29..09bf588 100644 --- a/lib/py_aes.c +++ b/lib/py_aes.c @@ -47,6 +47,53 @@ int x; return Py_BuildValue("i",x); } +static PyObject* __CDECL py_form_dial(PyObject *self, PyObject *args) +{ +int id; +int lx, ly, lw, lh; +int bx, by, bw, bh; +int ret; + + if(!PyArg_ParseTuple(args,"i(iiii)(iiii)",&id,&lx,&ly,&lw,&lh,&bx,&by,&bw,&bh)) + return NULL; + + ret = form_dial(id, lx, ly, lw, lh, bx, by, bw, bh); + + if(ret == 0) { + PyErr_SetString(GEMError,"Form dial call failed"); + return NULL; + } + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* __CDECL py_form_do(PyObject *self, PyObject *args) +PyObject *obj; +int x; +int ret; + + if(!PyArg_ParseTuple(args,"Oi",&obj,&x)) + return NULL; + + ret = form_do(PyCapsule_GetPointer(obj),x); + return Py_BuildValue("i",ret); +} + +static PyObject* __CDECL py_form_center(PyObject *self, PyObject *args) +PyObject *obj; +int x,y,w,h; +int ret; + + if(!PyArg_ParseTuple(args,"O(iiii)",&obj,&x,&y,&w,&h)) + return NULL; + + form_center(PyCapsule_GetPointer(obj),x,y,w,h); + + Py_INCREF(Py_None); + return Py_None; +} + /* --- Resources Library --- */ static PyObject* __CDECL py_rsrc_load(PyObject *self, PyObject *args) { @@ -209,3 +256,78 @@ int ret; Py_INCREF(Py_None); return Py_None; } + +static PyObject* __CDECL py_wind_update(PyObject *self, PyObject *args) +{ +int op; +int ret; + + if(!PyArg_ParseTuple(args,"i",&op)) + return NULL; + if(wind_update(op) == 0) { + PyErr_SetString(GEMError,"Window update failed"); + return NULL; + } + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* __CDECL py_wind_set(PyObject *self, PyObject *args) +{ +int id, sp; +int w1, w2, w3, w4; +int ret; +PyObject *tple; + + if(!PyArg_ParseTuple(args,"ii|O",&id,&sp,&tpl)) + return NULL; + + w1 = 0; w2 = 0; w3 = 0; w4 = 0; + + switch(gp) { + case WF_BEVENT: + case WF_BOTTOMALL: + case WF_HSLIDE: + case WF_HSLSIZE: + case WF_M_BACKDROP: + case WF_SHADE: + case WF_STACK: + case WF_TOPALL: + case WF_VSLIDE: + case WF_VSLSIZE: + case WF_WHEEL: + PyArg_ParseTuple(tpl,"i",&w1); + break; + case WF_COLOR: + case WF_INFO: + case WF_MENU: + case WF_NAME: + case WF_OPTS: + PyArg_ParseTuple(tpl,"ii",&w1,&w2); + break; + case WF_DCOLOR: + case WF_NEWDESK: + PyArg_ParseTuple(tpl,"iii",&w1,&w2,&w3); + break; + case WF_CURRXYWH: + case WF_DDELAY: + case WF_FULLXYWH: + case WF_ICONIFY: + case WF_PREVXYWH: + case WF_UNICONIFYXYWH: + case WF_WIDGETS: + case WF_WINXCFG: + PyArg_ParseTuple(tpl,"iiii",&w1,&w2,&w3,&w4); + break; + } + + ret = wind_set(id,gp,w1,w2,w3,w4); + if(ret == 0) { + PyErr_SetString(GEMError,"Window set failed"); + return NULL; + } + + Py_INCREF(Py_None); + return Py_None; +} diff --git a/lib/py_aes.h b/lib/py_aes.h index 4603427..3f2942f 100644 --- a/lib/py_aes.h +++ b/lib/py_aes.h @@ -10,6 +10,9 @@ static PyObject* __CDECL py_appl_exit(PyObject *self, PyObject *args); static PyObject* __CDECL py_appl_write(PyObject *self, PyObject *args) static PyObject* __CDECL py_form_alert(PyObject *self, PyObject *args); +static PyObject* __CDECL py_form_dial(PyObject *self, PyObject *args); +static PyObject* __CDECL py_form_do(PyObject *self, PyObject *args); +static PyObject* __CDECL py_form_center(PyObject *self, PyObject *args); static void __CDECL py_rsrc_load(PyObject *self, PyObject *args); @@ -20,5 +23,7 @@ static PyObject* __CDECL py_wind_open(PyObject *self, PyObject *args); static PyObject* __CDECL py_wind_get(PyObject *self, PyObject *args); static PyObject* __CDECL py_wind_delete(PyObject *self, PyObject *args); static PyObject* __CDECL py_wind_close(PyObject *self, PyObject *args); +static PyObject* __CDECL py_wind_set(PyObject *self, PyObject *args); +static PyObject* __CDECL py_wind_update(PyObject *self, PyObject *args); #endif /* __PY_AES_HEADERS */ -- cgit v1.2.3