Public Member Functions | |
GameOptionsWindow (const WindowDesc *desc) | |
DropDownList * | BuildDropDownList (int widget, int *selected_index) const |
Build the dropdown list for a specific widget. | |
virtual void | SetStringParameters (int widget) const |
Initialize string parameters for a widget. | |
virtual void | DrawWidget (const Rect &r, int widget) const |
Draw the contents of a nested widget. | |
virtual void | UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
Update size and resize step of a widget in the window. | |
virtual void | OnClick (Point pt, int widget, int click_count) |
A click with the left mouse button has been made on the window. | |
template<class T > | |
void | SetMediaSet (int index) |
Set the base media set. | |
virtual void | OnDropdownSelect (int widget, int index) |
A dropdown option associated to this window has been selected. | |
virtual void | OnInvalidateData (int data=0, bool gui_scope=true) |
Some data on this window has become invalid. | |
Data Fields | |
GameSettings * | opt |
bool | reload |
Definition at line 143 of file settings_gui.cpp.
DropDownList* GameOptionsWindow::BuildDropDownList | ( | int | widget, | |
int * | selected_index | |||
) | const [inline] |
Build the dropdown list for a specific widget.
widget | Widget to build list for | |
selected_index | Currently selected item |
Definition at line 168 of file settings_gui.cpp.
References _current_language, _grf_names, _languages, _nb_grf_names, _nb_orig_names, _network_server, _networking, _num_resolutions, _settings_client, GUISettings::autosave, BuildCurrencyDropdown(), LocaleSettings::currency, GameSettings::game_creation, GetCurRes(), GetMaskOfAllowedCurrencies(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetNumItems(), GOW_AUTOSAVE_DROPDOWN, GOW_BASE_GRF_DROPDOWN, GOW_BASE_MUSIC_DROPDOWN, GOW_BASE_SFX_DROPDOWN, GOW_CURRENCY_DROPDOWN, GOW_DISTANCE_DROPDOWN, GOW_LANG_DROPDOWN, GOW_RESOLUTION_DROPDOWN, GOW_ROADSIDE_DROPDOWN, GOW_SCREENSHOT_DROPDOWN, GOW_TOWNNAME_DROPDOWN, ClientSettings::gui, HasBit(), INVALID_STRING_ID, SmallVector< T, S >::Length(), GameSettings::locale, DropDownListStringItem::NatSortFunc(), VehicleSettings::road_side, RoadVehiclesAreBuilt(), GameCreationSettings::town_name, LocaleSettings::units, and GameSettings::vehicle.
Referenced by OnClick(), and UpdateWidgetSize().
virtual void GameOptionsWindow::DrawWidget | ( | const Rect & | r, | |
int | widget | |||
) | const [inline, virtual] |
Draw the contents of a nested widget.
r | Rectangle occupied by the widget. | |
widget | Number of the widget to draw. |
Reimplemented from Window.
Definition at line 328 of file settings_gui.cpp.
References DrawStringMultiLine(), GetCurrentLanguageIsoCode(), BaseMedia< MusicSet >::GetUsedSet(), BaseMedia< SoundsSet >::GetUsedSet(), BaseMedia< GraphicsSet >::GetUsedSet(), GOW_BASE_GRF_DESCRIPTION, GOW_BASE_MUSIC_DESCRIPTION, GOW_BASE_SFX_DESCRIPTION, and SetDParamStr().
virtual void GameOptionsWindow::OnClick | ( | Point | pt, | |
int | widget, | |||
int | click_count | |||
) | [inline, virtual] |
A click with the left mouse button has been made on the window.
pt | the point inside the window that has been clicked. | |
widget | the clicked widget. | |
click_count | Number of fast consecutive clicks at same position |
Reimplemented from Window.
Definition at line 417 of file settings_gui.cpp.
References BuildDropDownList(), GOW_FULLSCREEN_BUTTON, INVALID_STRING_ID, Window::SetDirty(), Window::SetWidgetLoweredState(), ShowDropDownList(), ShowErrorMessage(), and WL_ERROR.
virtual void GameOptionsWindow::OnDropdownSelect | ( | int | widget, | |
int | index | |||
) | [inline, virtual] |
A dropdown option associated to this window has been selected.
widget | the widget (button) that the dropdown is associated with. | |
index | the element in the dropdown that is selected. |
Reimplemented from Window.
Definition at line 460 of file settings_gui.cpp.
References _languages, _num_resolutions, _resolutions, _settings_client, GUISettings::autosave, CheckForMissingGlyphsInLoadedLanguagePack(), LocaleSettings::currency, DeleteWindowByClass(), GameSettings::game_creation, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetNumItems(), GetSettingFromName(), GOW_AUTOSAVE_DROPDOWN, GOW_BASE_GRF_DROPDOWN, GOW_BASE_MUSIC_DROPDOWN, GOW_BASE_SFX_DROPDOWN, GOW_CURRENCY_DROPDOWN, GOW_DISTANCE_DROPDOWN, GOW_LANG_DROPDOWN, GOW_RESOLUTION_DROPDOWN, GOW_ROADSIDE_DROPDOWN, GOW_SCREENSHOT_DROPDOWN, GOW_TOWNNAME_DROPDOWN, ClientSettings::gui, Window::height, GameSettings::locale, MarkWholeScreenDirty(), ReadLanguagePack(), ReInitAllWindows(), VehicleSettings::road_side, Window::SetDirty(), SetSettingValue(), SetWindowDirty(), ShowCustCurrency(), GameCreationSettings::town_name, LocaleSettings::units, UpdateAllVirtCoords(), GameSettings::vehicle, and Window::width.
virtual void GameOptionsWindow::OnInvalidateData | ( | int | data = 0 , |
|
bool | gui_scope = true | |||
) | [inline, virtual] |
Some data on this window has become invalid.
data | Information about the changed data. | |
gui_scope | Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See InvalidateWindowData() for details. |
Reimplemented from Window.
Definition at line 533 of file settings_gui.cpp.
References BaseSet< T, Tnum_files, Tsubdir >::GetNumInvalid(), BaseSet< T, Tnum_files, Tsubdir >::GetNumMissing(), BaseMedia< MusicSet >::GetUsedSet(), BaseMedia< GraphicsSet >::GetUsedSet(), GOW_BASE_GRF_STATUS, GOW_BASE_MUSIC_STATUS, GOW_FULLSCREEN_BUTTON, SetDataTip(), and Window::SetWidgetLoweredState().
void GameOptionsWindow::SetMediaSet | ( | int | index | ) | [inline] |
Set the base media set.
index | the index of the media set |
T | class of media set |
Definition at line 446 of file settings_gui.cpp.
References Window::InvalidateData().
virtual void GameOptionsWindow::SetStringParameters | ( | int | widget | ) | const [inline, virtual] |
Initialize string parameters for a widget.
Calls to this function are made during initialization to measure the size (that is as part of InitNested()), during drawing, and while re-initializing the window. Only for widgets that render text initializing is requested.
widget | Widget number. |
Reimplemented from Window.
Definition at line 309 of file settings_gui.cpp.
References _currency_specs, _current_language, _num_resolutions, _settings_client, GUISettings::autosave, LocaleSettings::currency, GameSettings::game_creation, GetCurRes(), BaseMedia< MusicSet >::GetUsedSet(), BaseMedia< SoundsSet >::GetUsedSet(), BaseMedia< GraphicsSet >::GetUsedSet(), GOW_AUTOSAVE_DROPDOWN, GOW_BASE_GRF_DROPDOWN, GOW_BASE_GRF_STATUS, GOW_BASE_MUSIC_DROPDOWN, GOW_BASE_MUSIC_STATUS, GOW_BASE_SFX_DROPDOWN, GOW_CURRENCY_DROPDOWN, GOW_DISTANCE_DROPDOWN, GOW_LANG_DROPDOWN, GOW_RESOLUTION_DROPDOWN, GOW_ROADSIDE_DROPDOWN, GOW_SCREENSHOT_DROPDOWN, GOW_TOWNNAME_DROPDOWN, ClientSettings::gui, GameSettings::locale, LanguagePackHeader::own_name, VehicleSettings::road_side, SetDParam(), SetDParamStr(), GameCreationSettings::town_name, TownName(), LocaleSettings::units, and GameSettings::vehicle.
virtual void GameOptionsWindow::UpdateWidgetSize | ( | int | widget, | |
Dimension * | size, | |||
const Dimension & | padding, | |||
Dimension * | fill, | |||
Dimension * | resize | |||
) | [inline, virtual] |
Update size and resize step of a widget in the window.
After retrieval of the minimal size and the resize-steps of a widget, this function is called to allow further refinement, typically by computing the real maximal size of the content. Afterwards, size is taken to be the minimal size of the widget and resize is taken to contain the resize steps. For the convenience of the callee, padding contains the amount of padding between the content and the edge of the widget. This should be added to the returned size.
widget | Widget number. | |
size | Size of the widget. | |
padding | Recommended amount of space between the widget content and the widget edge. | |
fill | Fill step of the widget. | |
resize | Resize step of the widget. |
Reimplemented from Window.
Definition at line 348 of file settings_gui.cpp.
References BuildDropDownList(), GetCurrentLanguageIsoCode(), BaseSet< T, Tnum_files, Tsubdir >::GetNumInvalid(), BaseMedia< MusicSet >::GetNumSets(), BaseMedia< SoundsSet >::GetNumSets(), BaseMedia< GraphicsSet >::GetNumSets(), BaseMedia< MusicSet >::GetSet(), BaseMedia< SoundsSet >::GetSet(), BaseMedia< GraphicsSet >::GetSet(), GetStringBoundingBox(), GetStringHeight(), GOW_BASE_GRF_DESCRIPTION, GOW_BASE_GRF_STATUS, GOW_BASE_MUSIC_DESCRIPTION, GOW_BASE_MUSIC_STATUS, GOW_BASE_SFX_DESCRIPTION, max(), maxdim(), SetDParam(), SetDParamStr(), WD_DROPDOWNTEXT_BOTTOM, WD_DROPDOWNTEXT_LEFT, WD_DROPDOWNTEXT_RIGHT, WD_DROPDOWNTEXT_TOP, and Window::width.