From 0755f5ac88fa3ea3074e1d1e46b5e101de59abdb Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 26 Sep 2006 23:47:27 +0000 Subject: Add TXT_AddWidgets for adding multiple widgets to a table. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 672 --- textscreen/txt_table.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'textscreen/txt_table.c') diff --git a/textscreen/txt_table.c b/textscreen/txt_table.c index f6f38e53..e23ff843 100644 --- a/textscreen/txt_table.c +++ b/textscreen/txt_table.c @@ -164,6 +164,33 @@ void TXT_AddWidget(TXT_UNCAST_ARG(table), TXT_UNCAST_ARG(widget)) ++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; -- cgit v1.2.3