diff options
author | Simon Howard | 2011-04-04 20:07:07 +0000 |
---|---|---|
committer | Simon Howard | 2011-04-04 20:07:07 +0000 |
commit | 9f3f6683d929d118b18e21b06a0b729586569e1a (patch) | |
tree | 1a30dd5d65b9b371eb7beb66273ba134f2a38319 /textscreen/txt_window_action.c | |
parent | f596cfcd76c8c03c41c0691561c9b3c9c4419393 (diff) | |
download | chocolate-doom-9f3f6683d929d118b18e21b06a0b729586569e1a.tar.gz chocolate-doom-9f3f6683d929d118b18e21b06a0b729586569e1a.tar.bz2 chocolate-doom-9f3f6683d929d118b18e21b06a0b729586569e1a.zip |
Change the background color when hovering over widgets.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2320
Diffstat (limited to 'textscreen/txt_window_action.c')
-rw-r--r-- | textscreen/txt_window_action.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/textscreen/txt_window_action.c b/textscreen/txt_window_action.c index e593b7b6..81d3e94d 100644 --- a/textscreen/txt_window_action.c +++ b/textscreen/txt_window_action.c @@ -37,9 +37,10 @@ static void TXT_WindowActionSizeCalc(TXT_UNCAST_ARG(action)) TXT_GetKeyDescription(action->key, buf); - // Minimum width is the string length + two spaces for padding + // Width is label length, plus key description length, plus '=' + // and two surrounding spaces. - action->widget.w = strlen(action->label) + strlen(buf) + 1; + action->widget.w = strlen(action->label) + strlen(buf) + 3; action->widget.h = 1; } @@ -50,12 +51,24 @@ static void TXT_WindowActionDrawer(TXT_UNCAST_ARG(action), int selected) TXT_GetKeyDescription(action->key, buf); + if (TXT_HoveringOverWidget(action)) + { + TXT_BGColor(TXT_COLOR_BLACK, 0); + } + else + { + TXT_BGColor(TXT_WINDOW_BACKGROUND, 0); + } + + TXT_DrawString(" "); TXT_FGColor(TXT_COLOR_BRIGHT_GREEN); TXT_DrawString(buf); TXT_FGColor(TXT_COLOR_BRIGHT_CYAN); TXT_DrawString("="); + TXT_FGColor(TXT_COLOR_BRIGHT_WHITE); TXT_DrawString(action->label); + TXT_DrawString(" "); } static void TXT_WindowActionDestructor(TXT_UNCAST_ARG(action)) |