Changeset - r19394:5a518b2f2b4a
[Not reviewed]
master
0 2 0
frosch - 12 years ago 2012-06-01 14:41:47
frosch@openttd.org
(svn r24311) -Add: DrawDropDownButton() to draw dropdown buttons independent of actual widgets.
2 files changed with 23 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/settings_gui.cpp
Show inline comments
 
@@ -2006,6 +2006,28 @@ void DrawArrowButtons(int x, int y, Colo
 
}
 

	
 
/**
 
 * 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
src/settings_gui.h
Show inline comments
 
@@ -18,6 +18,7 @@ static const int SETTING_BUTTON_WIDTH  =
 
static const int SETTING_BUTTON_HEIGHT = 10; ///< Height of setting buttons
 

	
 
void DrawArrowButtons(int x, int y, Colours button_colour, byte state, bool clickable_left, bool clickable_right);
 
void DrawDropDownButton(int x, int y, Colours button_colour, bool state, bool clickable);
 
void DrawBoolButton(int x, int y, bool state, bool clickable);
 

	
 
#endif /* SETTING_GUI_H */
0 comments (0 inline, 0 general)