ref: 0755f5ac88fa3ea3074e1d1e46b5e101de59abdb
parent: 8ebd88a5ce9e8e5f41879e34311ba86c8b10c362
author: Simon Howard <[email protected]>
date: Tue Sep 26 19:47:27 EDT 2006
Add TXT_AddWidgets for adding multiple widgets to a table. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 672
--- a/textscreen/txt_table.c
+++ b/textscreen/txt_table.c
@@ -164,6 +164,33 @@
++table->num_widgets;
}
+// Add multiple widgets to a table.
+
+void TXT_AddWidgets(TXT_UNCAST_ARG(table), ...)
+{
+ TXT_CAST_ARG(txt_table_t, table);
+ va_list args;
+ txt_widget_t *widget;
+
+ va_start(args, TXT_UNCAST_ARG_NAME(table));
+
+ // Keep adding widgets until a NULL is reached.
+
+ for (;;)
+ {
+ widget = va_arg(args, txt_widget_t *);
+
+ if (widget == NULL)
+ {
+ break;
+ }
+
+ TXT_AddWidget(table, widget);
+ }
+
+ va_end(args);
+}
+
static int SelectableWidget(txt_table_t *table, int x, int y)
{
txt_widget_t *widget;
--- a/textscreen/txt_table.h
+++ b/textscreen/txt_table.h
@@ -50,6 +50,7 @@
txt_table_t *TXT_NewHorizBox(TXT_UNCAST_ARG(first_widget), ...);
void TXT_InitTable(txt_table_t *table, int columns);
void TXT_AddWidget(TXT_UNCAST_ARG(table), TXT_UNCAST_ARG(widget));
+void TXT_AddWidgets(TXT_UNCAST_ARG(table), ...);
int TXT_SelectWidget(TXT_UNCAST_ARG(table), TXT_UNCAST_ARG(widget));
void TXT_SetColumnWidths(TXT_UNCAST_ARG(table), ...);