From 39b7cb7bb2e14169af5dc07c7d429fc939200639 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 30 Jan 2009 23:53:47 +0000 Subject: Fix layout of widgets within scroll panes. Scroll scroll panes in response to keyboard events. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1440 --- textscreen/txt_table.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'textscreen/txt_table.c') diff --git a/textscreen/txt_table.c b/textscreen/txt_table.c index 29798906..0d4d1e35 100644 --- a/textscreen/txt_table.c +++ b/textscreen/txt_table.c @@ -674,6 +674,32 @@ txt_table_t *TXT_NewHorizBox(TXT_UNCAST_ARG(first_widget), ...) return result; } +// Get the currently-selected widget in a table, recursively searching +// through sub-tables if necessary. + +txt_widget_t *TXT_GetSelectedWidget(TXT_UNCAST_ARG(table)) +{ + TXT_CAST_ARG(txt_table_t, table); + txt_widget_t *result; + int index; + + index = table->selected_y * table->columns + table->selected_x; + + result = NULL; + + if (index >= 0 && index < table->num_widgets) + { + result = table->widgets[index]; + } + + if (result != NULL && result->widget_class == &txt_table_class) + { + result = TXT_GetSelectedWidget(result); + } + + return result; +} + // Selects a given widget in a table, recursively searching any tables // within this table. Returns 1 if successful, 0 if unsuccessful. -- cgit v1.2.3