summaryrefslogtreecommitdiff
path: root/textscreen/txt_table.c
diff options
context:
space:
mode:
authorSimon Howard2009-01-30 23:53:47 +0000
committerSimon Howard2009-01-30 23:53:47 +0000
commit39b7cb7bb2e14169af5dc07c7d429fc939200639 (patch)
tree3dec16991e926a3eeb448d22e156acec85b0347d /textscreen/txt_table.c
parenta6be65e608b72b3e08ea66278e3972864c085495 (diff)
downloadchocolate-doom-39b7cb7bb2e14169af5dc07c7d429fc939200639.tar.gz
chocolate-doom-39b7cb7bb2e14169af5dc07c7d429fc939200639.tar.bz2
chocolate-doom-39b7cb7bb2e14169af5dc07c7d429fc939200639.zip
Fix layout of widgets within scroll panes. Scroll scroll panes in
response to keyboard events. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1440
Diffstat (limited to 'textscreen/txt_table.c')
-rw-r--r--textscreen/txt_table.c26
1 files changed, 26 insertions, 0 deletions
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.