diff options
author | Darkvater <darkvater@openttd.org> | 2006-10-24 14:15:17 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2006-10-24 14:15:17 +0000 |
commit | d303ef94b3e4bd19ab21ba49a70dd626e763f275 (patch) | |
tree | 51fafb2220dd4dc447ee00655e96ff8b9666708b /widget.c | |
parent | 605036dbb45fa41f39d7fff7f30faddcc9c48a41 (diff) | |
download | openttd-d303ef94b3e4bd19ab21ba49a70dd626e763f275.tar.xz |
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
WWT_IMGBTN must contain an image for drawing. Renamed WWT_PANEL_2 to WWT_IMGBTN_2
because that is what it is. Added WWT_PUSHBTN that is either just a pushable button,
or a textbutton, which text's drawn dynamically independent of widget.
Diffstat (limited to 'widget.c')
-rw-r--r-- | widget.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -203,18 +203,21 @@ void DrawWindowWidgets(const Window *w) } switch (wi->type & WWT_MASK) { - case WWT_PANEL: /* WWT_IMGBTN */ - case WWT_PANEL_2: { + case WWT_IMGBTN: + case WWT_IMGBTN_2: { int img = wi->data; - + assert(img != 0); DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0); - if (img != 0) { // has an image - // show diff image when clicked - if ((wi->type & WWT_MASK) == WWT_PANEL_2 && clicked) img++; + /* show different image when clicked for WWT_IMGBTN_2 */ + if ((wi->type & WWT_MASK) == WWT_IMGBTN_2 && clicked) img++; + DrawSprite(img, r.left + 1 + clicked, r.top + 1 + clicked); + goto draw_default; + } - DrawSprite(img, r.left + 1 + clicked, r.top + 1 + clicked); - } + case WWT_PANEL: { + assert(wi->data == 0); + DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0); goto draw_default; } @@ -471,7 +474,7 @@ draw_default:; } static const Widget _dropdown_menu_widgets[] = { -{ WWT_IMGBTN, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, +{ WWT_PANEL, RESIZE_NONE, 0, 0, 0, 0, 0, 0x0, STR_NULL}, { WIDGETS_END}, }; |