summaryrefslogtreecommitdiff
path: root/src/widget.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-01-17 18:09:15 +0000
committerpeter1138 <peter1138@openttd.org>2008-01-17 18:09:15 +0000
commit9fdb9a82a2b0e7696c47a07de99c50b392eb19ac (patch)
treefa083ad3eb559492f9ce334358aedfc49ec5d130 /src/widget.cpp
parent2c38d3066f409209bff6ac716a7446426c2b723c (diff)
downloadopenttd-9fdb9a82a2b0e7696c47a07de99c50b392eb19ac.tar.xz
(svn r11901) -Add: add two widgets for dropdowns, one raised and one inset, to eventually replace use of two widgets for each dropdown control.
Diffstat (limited to 'src/widget.cpp')
-rw-r--r--src/widget.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/widget.cpp b/src/widget.cpp
index 9ce132b44..9cb767149 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -472,6 +472,28 @@ void DrawWindowWidgets(const Window *w)
DrawStringCenteredTruncated(r.left + 2, r.right - 2, r.top + 2, wi->data, 0x84);
break;
}
+
+ case WWT_DROPDOWN: {
+ assert(r.bottom - r.top == 11); // ensure consistent size
+
+ StringID str = wi->data;
+ DrawFrameRect(r.left, r.top, r.right - 12, r.bottom, wi->color, FR_NONE);
+ DrawFrameRect(r.right - 11, r.top, r.right, r.bottom, wi->color, clicked ? FR_LOWERED : FR_NONE);
+ DrawString(r.right - (clicked ? 8 : 9), r.top + (clicked ? 2 : 1), STR_0225, TC_BLACK);
+ if (str != STR_NULL) DrawStringTruncated(r.left + 2, r.top + 1, str, TC_BLACK, r.right - r.left - 12);
+ break;
+ }
+
+ case WWT_DROPDOWNIN: {
+ assert(r.bottom - r.top == 11); // ensure consistent size
+
+ StringID str = wi->data;
+ DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, FR_LOWERED | FR_DARKENED);
+ DrawFrameRect(r.right - 11, r.top + 1, r.right - 1, r.bottom - 1, wi->color, clicked ? FR_LOWERED : FR_NONE);
+ DrawString(r.right - (clicked ? 8 : 9), r.top + (clicked ? 2 : 1), STR_0225, TC_BLACK);
+ if (str != STR_NULL) DrawStringTruncated(r.left + 2, r.top + 2, str, TC_BLACK, r.right - r.left - 12);
+ break;
+ }
}
if (w->IsWidgetDisabled(i)) {