summaryrefslogtreecommitdiff
path: root/src/settings_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-06-01 14:41:47 +0000
committerfrosch <frosch@openttd.org>2012-06-01 14:41:47 +0000
commitb71b4015a2ca4bdda71ffa1c0f8400afb660142a (patch)
tree405f6df59d001bf2f0b02a7f48bfd37a00e8c201 /src/settings_gui.cpp
parent056f779334baf1857686453a8b382daf079311de (diff)
downloadopenttd-b71b4015a2ca4bdda71ffa1c0f8400afb660142a.tar.xz
(svn r24311) -Add: DrawDropDownButton() to draw dropdown buttons independent of actual widgets.
Diffstat (limited to 'src/settings_gui.cpp')
-rw-r--r--src/settings_gui.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 55dcf9b8f..b9a1d974a 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -2006,6 +2006,28 @@ void DrawArrowButtons(int x, int y, Colours button_colour, byte state, bool clic
}
/**
+ * Draw a dropdown button.
+ * @param x the x position to draw
+ * @param y the y position to draw
+ * @param button_colour the colour of the button
+ * @param state true = lowered
+ * @param clickable is the button clickable?
+ */
+void DrawDropDownButton(int x, int y, Colours button_colour, bool state, bool clickable)
+{
+ static const char *DOWNARROW = "\xEE\x8A\xAA";
+
+ int colour = _colour_gradient[button_colour][2];
+
+ DrawFrameRect(x, y, x + SETTING_BUTTON_WIDTH - 1, y + SETTING_BUTTON_HEIGHT - 1, button_colour, state ? FR_LOWERED : FR_NONE);
+ DrawString(x + (state ? 1 : 0), x + SETTING_BUTTON_WIDTH - (state ? 0 : 1), y + (state ? 2 : 1), DOWNARROW, TC_BLACK, SA_HOR_CENTER);
+
+ if (!clickable) {
+ GfxFillRect(x + 1, y, x + SETTING_BUTTON_WIDTH - 1, y + SETTING_BUTTON_HEIGHT - 2, colour, FILLRECT_CHECKER);
+ }
+}
+
+/**
* Draw a toggle button.
* @param x the x position to draw
* @param y the y position to draw