diff options
author | Simon Howard | 2009-02-08 17:52:08 +0000 |
---|---|---|
committer | Simon Howard | 2009-02-08 17:52:08 +0000 |
commit | 67fbcdce28b89b24f8fb27d5f25393ad775af719 (patch) | |
tree | 5c739d8bef1fda59a7553aa97889ff50f3048049 /textscreen/txt_table.c | |
parent | 08bc270bb911feacb1607a8d7672e35d458df773 (diff) | |
parent | 39b7cb7bb2e14169af5dc07c7d429fc939200639 (diff) | |
download | chocolate-doom-67fbcdce28b89b24f8fb27d5f25393ad775af719.tar.gz chocolate-doom-67fbcdce28b89b24f8fb27d5f25393ad775af719.tar.bz2 chocolate-doom-67fbcdce28b89b24f8fb27d5f25393ad775af719.zip |
Merge from trunk.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1442
Diffstat (limited to 'textscreen/txt_table.c')
-rw-r--r-- | textscreen/txt_table.c | 26 |
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. |