From: msf Date: Tue, 15 May 2001 18:44:00 +0000 (+0000) Subject: added compact buttons to python binding X-Git-Tag: r0-50-24~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f954a19bd4e8936d6788a7762c12b09807955bc1;p=thirdparty%2Fnewt.git added compact buttons to python binding --- diff --git a/snack.py b/snack.py index b8927c8..6c509aa 100644 --- a/snack.py +++ b/snack.py @@ -24,6 +24,11 @@ class Button(Widget): def __init__(self, text): self.w = _snack.button(text) +class CompactButton(Widget): + + def __init__(self, text): + self.w = _snack.compactbutton(text) + class Checkbox(Widget): def value(self): diff --git a/snackmodule.c b/snackmodule.c index 6f84a1a..ca430ac 100644 --- a/snackmodule.c +++ b/snackmodule.c @@ -24,6 +24,7 @@ static struct callbackStruct helpCallback; static void emptyDestructor(PyObject * s); static snackWidget * buttonWidget(PyObject * s, PyObject * args); +static snackWidget * compactbuttonWidget(PyObject * s, PyObject * args); static PyObject * centeredWindow(PyObject * s, PyObject * args); static snackWidget * checkboxWidget(PyObject * s, PyObject * args); static PyObject * choiceWindow(PyObject * s, PyObject * args); @@ -58,6 +59,7 @@ static snackWidget * checkboxTreeWidget(PyObject * s, PyObject * args); static PyMethodDef snackModuleMethods[] = { { "button", (PyCFunction) buttonWidget, METH_VARARGS, NULL }, + { "compactbutton", (PyCFunction) compactbuttonWidget, METH_VARARGS, NULL }, { "checkbox", (PyCFunction) checkboxWidget, METH_VARARGS, NULL }, { "choice", choiceWindow, METH_VARARGS, NULL }, { "centeredwindow", centeredWindow, METH_VARARGS, NULL }, @@ -566,6 +568,18 @@ static snackWidget * buttonWidget(PyObject * s, PyObject * args) { return widget; } +static snackWidget * compactbuttonWidget(PyObject * s, PyObject * args) { + snackWidget * widget; + char * label; + + if (!PyArg_ParseTuple(args, "s", &label)) return NULL; + + widget = snackWidgetNew (); + widget->co = newtCompactButton(-1, -1, label); + + return widget; +} + static snackWidget * labelWidget(PyObject * s, PyObject * args) { char * label; snackWidget * widget;