]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
add setHeight to Textbox class
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 11 Jul 2008 13:13:07 +0000 (15:13 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 11 Jul 2008 13:13:07 +0000 (15:13 +0200)
snack.py
snackmodule.c

index 7e7cdc03a4aaa75168fc5adcad0a1e64b343c453..7fa1d8bebc37355b00884f322bb91634b6f5fbe5 100644 (file)
--- a/snack.py
+++ b/snack.py
@@ -212,11 +212,15 @@ class Textbox(Widget):
      - Textbox(self, width, height, scroll = 0, wrap = 0): scroll, wrap are flags
                                    include scroll bars, or text wrap.
      - setText(text) : set text.
+     - setHeight(height): set height.
     """
     
     def setText(self, text):
         self.w.textboxText(text)
 
+    def setHeight(self, height):
+        self.w.textboxHeight(height)
+
     def __init__(self, width, height, text, scroll = 0, wrap = 0):
         self.w = _snack.textbox(width, height, text, scroll, wrap)
 
index 0f5628eddfa0dc6e8316ea6612d9582606f143dc..456add89c6815c13b65defa2241e0fbf5dbcc4f5 100644 (file)
@@ -204,6 +204,7 @@ static PyObject * widgetListboxGetSel(snackWidget * s, PyObject * args);
 static PyObject * widgetListboxSet(snackWidget * s, PyObject * args);
 static PyObject * widgetListboxClear(snackWidget * s, PyObject * args);
 static PyObject * widgetTextboxText(snackWidget * s, PyObject * args);
+static PyObject * widgetTextboxHeight(snackWidget * s, PyObject * args);
 static PyObject * widgetCheckboxTreeAddItem(snackWidget * s, PyObject * args);
 static PyObject * widgetCheckboxTreeGetSel(snackWidget * s, PyObject * args);
 static PyObject * widgetCheckboxTreeGetCur(snackWidget * s, PyObject * args);
@@ -220,6 +221,7 @@ static PyMethodDef widgetMethods[] = {
     { "setCallback", (PyCFunction) widgetAddCallback, METH_VARARGS, NULL },
     { "labelText", (PyCFunction) widgetLabelText, METH_VARARGS, NULL },
     { "textboxText", (PyCFunction) widgetTextboxText, METH_VARARGS, NULL },
+    { "textboxHeight", (PyCFunction) widgetTextboxHeight, METH_VARARGS, NULL },
     { "entrySetValue", (PyCFunction) widgetEntrySetValue, METH_VARARGS, NULL },
     { "listboxAddItem", (PyCFunction) widgetListboxAdd, METH_VARARGS, NULL },
     { "listboxInsertItem", (PyCFunction) widgetListboxIns, METH_VARARGS, NULL },
@@ -653,6 +655,17 @@ static PyObject * widgetTextboxText(snackWidget * s, PyObject * args) {
     return Py_None;
 }
 
+static PyObject * widgetTextboxHeight(snackWidget * s, PyObject * args) {
+    int height;
+
+    if (!PyArg_ParseTuple(args, "i", &height)) return NULL;
+
+    newtTextboxSetHeight(s->co, height);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
 static snackWidget * listboxWidget(PyObject * s, PyObject * args) {
     snackWidget * widget;
     int height;