Changeset - r11757:6b732499803a
[Not reviewed]
master
0 1 0
alberth - 15 years ago 2009-04-26 07:43:19
alberth@openttd.org
(svn r16152) -Codechange: Added nested widgets for advanced settings and for custom currency windows.
1 file changed with 64 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/settings_gui.cpp
Show inline comments
 
@@ -1521,17 +1521,31 @@ static const Widget _settings_selection_
 
{      WWT_PANEL,     RESIZE_RB,  COLOUR_MAUVE,     0,   399,    14,   187, 0x0,                             STR_NULL},                             // SETTINGSEL_OPTIONSPANEL
 
{  WWT_SCROLLBAR,    RESIZE_LRB,  COLOUR_MAUVE,   400,   411,    14,   175, 0x0,                             STR_TOOLTIP_VSCROLL_BAR_SCROLLS_LIST}, // SETTINGSEL_SCROLLBAR
 
{  WWT_RESIZEBOX,   RESIZE_LRTB,  COLOUR_MAUVE,   400,   411,   176,   187, 0x0,                             STR_RESIZE_BUTTON},                    // SETTINGSEL_RESIZE
 
{   WIDGETS_END},
 
};
 

	
 
static const NWidgetPart _nested_settings_selection_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_MAUVE, SETTINGSEL_CLOSEBOX),
 
		NWidget(WWT_CAPTION, COLOUR_MAUVE, SETTINGSEL_CAPTION), SetDataTip(STR_CONFIG_SETTING_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_PANEL, COLOUR_MAUVE, SETTINGSEL_OPTIONSPANEL), SetMinimalSize(400, 174), SetResize(1, SETTING_HEIGHT), EndContainer(),
 
		NWidget(NWID_VERTICAL),
 
			NWidget(WWT_SCROLLBAR, COLOUR_MAUVE, SETTINGSEL_SCROLLBAR),
 
			NWidget(WWT_RESIZEBOX, COLOUR_MAUVE, SETTINGSEL_RESIZE),
 
		EndContainer(),
 
	EndContainer(),
 
};
 

	
 
static const WindowDesc _settings_selection_desc(
 
	WDP_CENTER, WDP_CENTER, 412, 188, 450, 397,
 
	WC_GAME_OPTIONS, WC_NONE,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
 
	_settings_selection_widgets
 
	_settings_selection_widgets, _nested_settings_selection_widgets, lengthof(_nested_settings_selection_widgets)
 
);
 

	
 
void ShowGameSettings()
 
{
 
	DeleteWindowById(WC_GAME_OPTIONS, 0);
 
	new GameSettingsWindow(&_settings_selection_desc);
 
@@ -1761,17 +1775,65 @@ static const Widget _cust_currency_widge
 

	
 
{      WWT_LABEL,   RESIZE_NONE,  COLOUR_BLUE,       2,   227,    93,   101, STR_CURRENCY_PREVIEW,        STR_TOOLTIP_CUSTOM_CURRENCY_PREVIEW},          // CUSTCURR_PREVIEW
 

	
 
{   WIDGETS_END},
 
};
 

	
 
static const NWidgetPart _nested_cust_currency_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY, CUSTCURR_CLOSEBOX),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, CUSTCURR_CAPTION), SetDataTip(STR_CURRENCY_WINDOW, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, CUSTCURR_BACKGROUND),
 
		NWidget(NWID_SPACER), SetMinimalSize(0,7),
 
		NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 2),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, CUSTCURR_RATE_DOWN), SetMinimalSize(10, 9), SetDataTip(STR_ARROW_LEFT_SMALL, STR_TOOLTIP_DECREASE_EXCHANGE_RATE),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, CUSTCURR_RATE_UP), SetMinimalSize(10, 9), SetDataTip(STR_ARROW_RIGHT_SMALL, STR_TOOLTIP_INCREASE_EXCHANGE_RATE),
 
			NWidget(NWID_SPACER), SetMinimalSize(5, 0),
 
			NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_RATE), SetMinimalSize(193, 9), SetDataTip(STR_CURRENCY_EXCHANGE_RATE, STR_TOOLTIP_SET_EXCHANGE_RATE),
 
			NWidget(NWID_SPACER), SetFill(1, 0),
 
		EndContainer(),
 
		NWidget(NWID_SPACER), SetMinimalSize(0, 3),
 
		NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 2),
 
			NWidget(WWT_PUSHBTN, COLOUR_DARK_BLUE, CUSTCURR_SEPARATOR_EDIT), SetMinimalSize(20, 9), SetDataTip(0x0, STR_TOOLTIP_SET_CUSTOM_CURRENCY_SEPARATOR),
 
			NWidget(NWID_SPACER), SetMinimalSize(5, 0),
 
			NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_SEPARATOR), SetMinimalSize(193, 9), SetDataTip(STR_CURRENCY_SEPARATOR, STR_TOOLTIP_SET_CUSTOM_CURRENCY_SEPARATOR),
 
			NWidget(NWID_SPACER), SetFill(1, 0),
 
		EndContainer(),
 
		NWidget(NWID_SPACER), SetMinimalSize(0, 3),
 
		NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 2),
 
			NWidget(WWT_PUSHBTN, COLOUR_DARK_BLUE, CUSTCURR_PREFIX_EDIT), SetMinimalSize(20, 9), SetDataTip(0x0, STR_TOOLTIP_SET_CUSTOM_CURRENCY_PREFIX),
 
			NWidget(NWID_SPACER), SetMinimalSize(5, 0),
 
			NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_PREFIX), SetMinimalSize(193, 9), SetDataTip(STR_CURRENCY_PREFIX, STR_TOOLTIP_SET_CUSTOM_CURRENCY_PREFIX),
 
			NWidget(NWID_SPACER), SetFill(1, 0),
 
		EndContainer(),
 
		NWidget(NWID_SPACER), SetMinimalSize(0, 3),
 
		NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 2),
 
			NWidget(WWT_PUSHBTN, COLOUR_DARK_BLUE, CUSTCURR_SUFFIX_EDIT), SetMinimalSize(20, 9), SetDataTip(0x0, STR_TOOLTIP_SET_CUSTOM_CURRENCY_SUFFIX),
 
			NWidget(NWID_SPACER), SetMinimalSize(5, 0),
 
			NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_SUFFIX), SetMinimalSize(193, 9), SetDataTip(STR_CURRENCY_SUFFIX, STR_TOOLTIP_SET_CUSTOM_CURRENCY_SUFFIX),
 
			NWidget(NWID_SPACER), SetFill(1, 0),
 
		EndContainer(),
 
		NWidget(NWID_SPACER), SetMinimalSize(0, 3),
 
		NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 2),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, CUSTCURR_YEAR_DOWN), SetMinimalSize(10, 9), SetDataTip(STR_ARROW_LEFT_SMALL, STR_TOOLTIP_DECREASE_CUSTOM_CURRENCY_TO_EURO),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, CUSTCURR_YEAR_UP), SetMinimalSize(10, 9), SetDataTip(STR_ARROW_RIGHT_SMALL, STR_TOOLTIP_INCREASE_CUSTOM_CURRENCY_TO_EURO),
 
			NWidget(NWID_SPACER), SetMinimalSize(5, 0),
 
			NWidget(WWT_TEXT, COLOUR_BLUE, CUSTCURR_YEAR), SetMinimalSize(193, 9), SetDataTip(STR_CURRENCY_SWITCH_TO_EURO, STR_TOOLTIP_SET_CUSTOM_CURRENCY_TO_EURO),
 
			NWidget(NWID_SPACER), SetFill(1, 0),
 
		EndContainer(),
 
		NWidget(WWT_LABEL, COLOUR_BLUE, CUSTCURR_PREVIEW), SetMinimalSize(226, 9),
 
								SetDataTip(STR_CURRENCY_PREVIEW, STR_TOOLTIP_CUSTOM_CURRENCY_PREVIEW), SetPadding(15, 1, 18, 2),
 
	EndContainer(),
 
};
 

	
 
static const WindowDesc _cust_currency_desc(
 
	WDP_CENTER, WDP_CENTER, 230, 120, 230, 120,
 
	WC_CUSTOM_CURRENCY, WC_NONE,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
 
	_cust_currency_widgets
 
	_cust_currency_widgets, _nested_cust_currency_widgets, lengthof(_nested_cust_currency_widgets)
 
);
 

	
 
static void ShowCustCurrency()
 
{
 
	DeleteWindowById(WC_CUSTOM_CURRENCY, 0);
 
	new CustomCurrencyWindow(&_cust_currency_desc);
0 comments (0 inline, 0 general)