From: ewt Date: Wed, 17 Sep 1997 02:12:45 +0000 (+0000) Subject: added buttonbars X-Git-Tag: r0-12~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9193219029dc58d9cd432feb0400c94ea9cad8d3;p=thirdparty%2Fnewt.git added buttonbars --- diff --git a/Makefile b/Makefile index ac786b2..a38fa35 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ LIBNEWT = libnewt.a LIBNEWTSH = libnewt.so.$(VERSION) LIBNEWTSONAME = libnewt.so.$(SONAME) LIBOBJS = newt.o button.o form.o checkbox.o entry.o label.o listbox.o \ - scrollbar.o textbox.o scale.o grid.o windows.o + scrollbar.o textbox.o scale.o grid.o windows.o buttonbar.o SHCFLAGS = -fPIC diff --git a/buttonbar.c b/buttonbar.c new file mode 100644 index 0000000..d36a7f9 --- /dev/null +++ b/buttonbar.c @@ -0,0 +1,38 @@ +#include +#include + +newtGrid newtButtonBar(char * button1, newtComponent * b1comp, ...) { + va_list args; + char * name; + newtGrid grid; + newtComponent * compPtr; + int num; + + va_start(args, b1comp); + + name = button1, num = 0; + while (name) { + name = va_arg(args, char *); + compPtr = va_arg(args, newtComponent *); + num++; + } + + va_end(args); + + grid = newtCreateGrid(num, 1); + + va_start(args, b1comp); + + name = button1, compPtr = b1comp, num = 0; + while (name) { + *compPtr = newtButton(-1, -1, name); + newtGridSetField(grid, num, 0, NEWT_GRID_COMPONENT, *compPtr, + num ? 1 : 0, 0, 0, 0, 0, 0); + + name = va_arg(args, char *); + compPtr = va_arg(args, newtComponent *); + num++; + } + + return grid; +} diff --git a/newt.h b/newt.h index 7c1fbad..7a0a327 100644 --- a/newt.h +++ b/newt.h @@ -247,6 +247,9 @@ void newtGridFree(newtGrid grid, int recurse); void newtGridGetSize(newtGrid grid, int * width, int * height); void newtGridWrappedWindow(newtGrid grid, char * title); +/* convienve */ +newtGrid newtButtonBar(char * button1, newtComponent * b1comp, ...); + /* automatically centered and shrink wrapped */ void newtWinMessage(char * title, char * buttonText, char * text, ...); void newtWinMessagev(char * title, char * buttonText, char * text,