]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
added buttonbars
authorewt <ewt>
Wed, 17 Sep 1997 02:12:45 +0000 (02:12 +0000)
committerewt <ewt>
Wed, 17 Sep 1997 02:12:45 +0000 (02:12 +0000)
Makefile
buttonbar.c [new file with mode: 0644]
newt.h

index ac786b2ed706023ec3dc43c5b151d48e219fdbd8..a38fa35c7c78230fa69b69e73d361e9065a03239 100644 (file)
--- 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 (file)
index 0000000..d36a7f9
--- /dev/null
@@ -0,0 +1,38 @@
+#include <newt.h>
+#include <stdarg.h>
+
+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 7c1fbad4749addb0b4a9752465a45bc8af8f3d77..7a0a327dabe21623fbc7bd53ec9dc4e8ecd2c57a 100644 (file)
--- 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,