-1.59 -> 0.50.10
+***************
+THIS FILE IS OBSOLETE -- UPDATE THE SPEC FILE INSTEAD
+***************
+
+0.59 -> 0.50.10
- added support for help
- added cusor on/off stuff
struct CheckboxTree {
newtComponent sb;
- int curWidth; /* size of text w/o scrollbar or border*/
- int curHeight; /* size of text w/o border */
struct items * itemlist;
struct items ** flatList, ** currItem, ** firstItem;
int flatCount;
ctDraw(co);
}
+
+void newtCheckboxTreeSetCurrent(newtComponent co, void * data) {
+ struct CheckboxTree * ct = co->data;
+ int * path;
+ int i, j, itemsAfter;
+ struct items * treeTop, * item;
+
+ path = newtCheckboxTreeFindItem(co, data);
+ if (!path) return;
+
+ /* traverse the path and turn on all of the branches to this point */
+ for (i = 0, treeTop = ct->itemlist; path[i + 1] != NEWT_ARG_LAST; i++) {
+ for (j = 0, item = treeTop; j < path[i]; j++)
+ item = item->next;
+
+ item->selected = 1;
+ treeTop = item->branch;
+ }
+
+ buildFlatList(co);
+
+ item = findItem(ct->itemlist, data);
+
+ i = 0;
+ while (ct->flatList[i] != item) i++;
+
+ /* choose the top item */
+ j = i - (co->height / 2);
+
+ if ((j + co->height) > ct->flatCount)
+ j = ct->flatCount - co->height;
+
+ if (j < 0)
+ j = 0;
+
+ ct->firstItem = ct->flatList + j;
+ ct->currItem = ct->flatList + i;
+
+ ctDraw(co);
+}
newtComponent newtCheckboxTreeMulti(int left, int top, int height, char *seq, int flags);
const void ** newtCheckboxTreeGetSelection(newtComponent co, int *numitems);
const void * newtCheckboxTreeGetCurrent(newtComponent co);
+void newtCheckboxTreeSetCurrent(newtComponent co, void * item);
const void ** newtCheckboxTreeGetMultiSelection(newtComponent co, int *numitems, char seqnum);
/* last item is NEWT_ARG_LAST for all of these */
int newtCheckboxTreeAddItem(newtComponent co,
Summary: A development library for text mode user interfaces.
Name: newt
-%define version 0.50.19
+%define version 0.50.20
Version: %{version}
Release: 3
Copyright: LGPL
%endif
%changelog
+* Thu Feb 01 2001 Erik Troan <ewt@redhat.com>
+- gave up on separate CHANGES file
+- added newtCheckboxTreeSetCurrent() and snack binding
+
* Mon Jan 22 2001 Than Ngo <than@redhat.com>
- don't build newt-python2 sub package.
def setEntry(self, item, text):
self.w.checkboxtreeSetEntry(self.item2key[item], text)
+ def setCurrent(self, item):
+ self.w.checkboxtreeSetCurrent(self.item2key[item])
+
def setEntryValue(self, item, selected = 1):
self.w.checkboxtreeSetEntryValue(self.item2key[item], selected)
static PyObject * widgetCheckboxTreeGetSel(snackWidget * s, PyObject * args);
static PyObject * widgetCheckboxTreeGetCur(snackWidget * s, PyObject * args);
static PyObject * widgetCheckboxTreeSetEntry(snackWidget * s, PyObject * args);
+static PyObject * widgetCheckboxTreeSetCurrent(snackWidget * s, PyObject * args);
static PyObject * widgetCheckboxTreeSetEntryValue(snackWidget * s, PyObject * args);
static PyObject * widgetCheckboxTreeGetEntryValue(snackWidget * s, PyObject * args);
static PyObject * widgetEntrySetFlags(snackWidget * s, PyObject * args);
METH_VARARGS, NULL },
{ "checkboxtreeSetEntry", (PyCFunction) widgetCheckboxTreeSetEntry,
METH_VARARGS, NULL },
+ { "checkboxtreeSetCurrent", (PyCFunction) widgetCheckboxTreeSetCurrent,
+ METH_VARARGS, NULL },
{ "checkboxtreeSetEntryValue", (PyCFunction) widgetCheckboxTreeSetEntryValue,
METH_VARARGS, NULL },
{ "checkboxtreeGetSelection", (PyCFunction) widgetCheckboxTreeGetSel,
return Py_None;
}
+static PyObject * widgetCheckboxTreeSetCurrent(snackWidget * s, PyObject * args) {
+ int data;
+
+ if (!PyArg_ParseTuple(args, "i", &data)) return NULL;
+
+ newtCheckboxTreeSetCurrent(s->co, (void *)data);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
static PyObject * widgetCheckboxTreeSetEntryValue(snackWidget * s, PyObject * args) {
int data;
int isOn = 1;
newtCheckboxTreeAddItem(checktree, "Donuts", (void *) 12,
NEWT_FLAG_SELECTED,
NEWT_ARG_APPEND, NEWT_ARG_LAST);
- newtCheckboxTreeAddItem(checktree, "Bavarian Cream", (void *) 12,
+
+ newtCheckboxTreeAddItem(checktree, "Bavarian Cream", (void *) 301,
NEWT_FLAG_SELECTED,
9, NEWT_ARG_APPEND, NEWT_ARG_LAST);
- newtCheckboxTreeAddItem(checktree, "Honey dipped", (void *) 12,
+ newtCheckboxTreeAddItem(checktree, "Honey dipped", (void *) 302,
NEWT_FLAG_SELECTED,
9, NEWT_ARG_APPEND, NEWT_ARG_LAST);
- newtCheckboxTreeAddItem(checktree, "Jelly", (void *) 12,
+ newtCheckboxTreeAddItem(checktree, "Jelly", (void *) 303,
NEWT_FLAG_SELECTED,
9, NEWT_ARG_APPEND, NEWT_ARG_LAST);
newtCheckboxTreeAddItem(checktree, "Thirteen", (void *) 213, 0,
1, 1, NEWT_ARG_APPEND, NEWT_ARG_LAST);
+ newtCheckboxTreeSetCurrent(checktree, (void *) 12);
+
button = newtButton(-1, -1, "Exit");
grid = newtCreateGrid(1, 2);