summaryrefslogtreecommitdiff
path: root/src/settings_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-09-25 19:36:09 +0000
committerrubidium <rubidium@openttd.org>2009-09-25 19:36:09 +0000
commit2080c0990c3db7ceac1c11375e2f9190e46e7320 (patch)
tree96cf23a2bb4e6d5a74e47d7cab78af4a95d9561d /src/settings_gui.cpp
parent3f600bba242f91e308e2ed25b9abff83175e577e (diff)
downloadopenttd-2080c0990c3db7ceac1c11375e2f9190e46e7320.tar.xz
(svn r17636) -Codechange: make the difficulty setting window nested
Diffstat (limited to 'src/settings_gui.cpp')
-rw-r--r--src/settings_gui.cpp23
1 files changed, 4 insertions, 19 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 3adf3542f..14e05edd9 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -523,22 +523,6 @@ enum GameDifficultyWidgets {
GDW_CANCEL,
};
-/* Widget definition for the game difficulty settings window */
-static const Widget _game_difficulty_widgets[] = {
-{ WWT_CAPTION, RESIZE_NONE, COLOUR_MAUVE, 0, 369, 0, 13, STR_DIFFICULTY_LEVEL_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // GDW_CAPTION
-{ WWT_PANEL, RESIZE_NONE, COLOUR_MAUVE, 0, 369, 14, 41, 0x0, STR_NULL}, // GDW_UPPER_BG
-{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 10, 96, 16, 27, STR_DIFFICULTY_LEVEL_EASY, STR_NULL}, // GDW_LVL_EASY
-{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 97, 183, 16, 27, STR_DIFFICULTY_LEVEL_MEDIUM, STR_NULL}, // GDW_LVL_MEDIUM
-{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 184, 270, 16, 27, STR_DIFFICULTY_LEVEL_HARD, STR_NULL}, // GDW_LVL_HARD
-{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 271, 357, 16, 27, STR_DIFFICULTY_LEVEL_CUSTOM, STR_NULL}, // GDW_LVL_CUSTOM
-{ WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREEN, 10, 357, 28, 39, STR_DIFFICULTY_LEVEL_HIGH_SCORE_BUTTON, STR_NULL}, // GDW_HIGHSCORE
-{ WWT_PANEL, RESIZE_NONE, COLOUR_MAUVE, 0, 369, 42, 262, 0x0, STR_NULL}, // GDW_SETTING_BG
-{ WWT_PANEL, RESIZE_NONE, COLOUR_MAUVE, 0, 369, 263, 278, 0x0, STR_NULL}, // GDW_LOWER_BG
-{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 105, 185, 265, 276, STR_DIFFICULTY_LEVEL_SAVE, STR_NULL}, // GDW_ACCEPT
-{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_YELLOW, 186, 266, 265, 276, STR_BUTTON_CANCEL, STR_NULL}, // GDW_CANCEL
-{ WIDGETS_END},
-};
-
static const NWidgetPart _nested_game_difficulty_widgets[] = {
NWidget(WWT_CAPTION, COLOUR_MAUVE, GDW_CAPTION), SetMinimalSize(370, 14), SetDataTip(STR_DIFFICULTY_LEVEL_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_PANEL, COLOUR_MAUVE, GDW_UPPER_BG),
@@ -577,7 +561,7 @@ static const WindowDesc _game_difficulty_desc(
WDP_CENTER, WDP_CENTER, 370, 279, 370, 279,
WC_GAME_OPTIONS, WC_NONE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
- _game_difficulty_widgets, _nested_game_difficulty_widgets, lengthof(_nested_game_difficulty_widgets)
+ NULL, _nested_game_difficulty_widgets, lengthof(_nested_game_difficulty_widgets)
);
void SetDifficultyLevel(int mode, DifficultySettings *gm_opt);
@@ -599,8 +583,10 @@ private:
};
public:
- GameDifficultyWindow() : Window(&_game_difficulty_desc)
+ GameDifficultyWindow() : Window()
{
+ this->InitNested(&_game_difficulty_desc);
+
/* Copy current settings (ingame or in intro) to temporary holding place
* change that when setting stuff, copy back on clicking 'OK' */
this->opt_mod_temp = (_game_mode == GM_MENU) ? _settings_newgame : _settings_game;
@@ -618,7 +604,6 @@ public:
this->SetWidgetDisabledState(GDW_HIGHSCORE, _game_mode == GM_EDITOR || _networking); // highscore chart in multiplayer
this->SetWidgetDisabledState(GDW_ACCEPT, _networking && !_network_server); // Save-button in multiplayer (and if client)
this->LowerWidget(GDW_LVL_EASY + this->opt_mod_temp.difficulty.diff_level);
- this->FindWindowPlacementAndResize(&_game_difficulty_desc);
}
virtual void OnPaint()