summaryrefslogtreecommitdiff
path: root/textscreen/txt_dropdown.c
diff options
context:
space:
mode:
authorSimon Howard2011-06-13 22:21:37 +0000
committerSimon Howard2011-06-13 22:21:37 +0000
commit391e7466b1efb7cbede4a1c356a210d9e7ee616b (patch)
tree90d13346d9cd3636df44290ded13d59ae3712543 /textscreen/txt_dropdown.c
parentfa328faf056affa216f2f3a8764ca0d56262efe9 (diff)
parent822664b4ff873d462370e9e96a9d91e6066c221d (diff)
downloadchocolate-doom-391e7466b1efb7cbede4a1c356a210d9e7ee616b.tar.gz
chocolate-doom-391e7466b1efb7cbede4a1c356a210d9e7ee616b.tar.bz2
chocolate-doom-391e7466b1efb7cbede4a1c356a210d9e7ee616b.zip
Merge from trunk.
Subversion-branch: /branches/raven-branch Subversion-revision: 2347
Diffstat (limited to 'textscreen/txt_dropdown.c')
-rw-r--r--textscreen/txt_dropdown.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/textscreen/txt_dropdown.c b/textscreen/txt_dropdown.c
index c8103302..c9a5d015 100644
--- a/textscreen/txt_dropdown.c
+++ b/textscreen/txt_dropdown.c
@@ -99,6 +99,22 @@ static int SelectorWindowListener(txt_window_t *window, int key, void *user_data
return 0;
}
+static int SelectorMouseListener(txt_window_t *window, int x, int y, int b,
+ void *unused)
+{
+ txt_widget_t *win;
+
+ win = (txt_widget_t *) window;
+
+ if (x < win->x || x > win->x + win->w || y < win->y || y > win->y + win->h)
+ {
+ TXT_CloseWindow(window);
+ return 1;
+ }
+
+ return 0;
+}
+
// Open the dropdown list window to select an item
static void OpenSelectorWindow(txt_dropdown_list_t *list)
@@ -158,6 +174,7 @@ static void OpenSelectorWindow(txt_dropdown_list_t *list)
// Catch presses of escape in this window and close it.
TXT_SetKeyListener(window, SelectorWindowListener, NULL);
+ TXT_SetMouseListener(window, SelectorMouseListener, NULL);
}
static int DropdownListWidth(txt_dropdown_list_t *list)
@@ -197,15 +214,7 @@ static void TXT_DropdownListDrawer(TXT_UNCAST_ARG(list), int selected)
// Set bg/fg text colors.
- if (selected)
- {
- TXT_BGColor(TXT_COLOR_GREY, 0);
- }
- else
- {
- TXT_BGColor(TXT_COLOR_BLUE, 0);
- }
-
+ TXT_SetWidgetBG(list, selected);
TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
// Select a string to draw from the list, if the current value is