Public Member Functions | Data Fields | Static Public Attributes

# GameSettingsWindow Struct Reference

Inheritance diagram for GameSettingsWindow:

## Public Member Functions
| GameSettingsWindow (const WindowDesc *desc)
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 | OnPaint ()
| The window must be repainted.
virtual void | SetStringParameters (int widget) const
| Initialize string parameters for a widget.
DropDownList * | BuildDropDownList (int widget) const
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
void | SetDisplayedHelpText (SettingEntry *pe)
| Set the entry that should have its help text displayed, and mark the window dirty so it gets repainted.
virtual void | OnClick (Point pt, int widget, int click_count)
| A click with the left mouse button has been made on the window.
virtual void | OnTimeout ()
| Called when this window's timeout has been reached.
virtual void | OnQueryTextFinished (char *str)
| The query window opened from this window has closed.
virtual void | OnDropdownSelect (int widget, int index)
| A dropdown option associated to this window has been selected.
virtual void | OnDropdownClose (Point pt, int widget, int index, bool instant_close)
| A dropdown window associated to this window has been closed.
virtual void | OnInvalidateData (int data=0, bool gui_scope=true)
| Some data on this window has become invalid.
virtual void | OnEditboxChanged (int wid)
| The text in an editbox has been edited.
virtual void | OnResize ()
| Called after the window got resized.
## Data Fields
SettingEntry * | valuewindow_entry
| If non-NULL, pointer to setting for which a value-entering window has been opened.
SettingEntry * | clicked_entry
| If non-NULL, pointer to a clicked numeric setting (with a depressed left or right button).
SettingEntry * | last_clicked
| If non-NULL, pointer to the last clicked setting.
SettingEntry * | valuedropdown_entry
| If non-NULL, pointer to the value for which a dropdown window is currently opened.
bool | closing_dropdown
| True, if the dropdown list is currently closing.
SettingFilter | filter
| Filter for the list.
QueryString | filter_editbox
| Filter editbox;.
bool | manually_changed_folding
| Whether the user expanded/collapsed something manually.
Scrollbar * | vscroll
## Static Public Attributes
static const int | SETTINGTREE_LEFT_OFFSET = 5
| Position of left edge of setting values.
static const int | SETTINGTREE_RIGHT_OFFSET = 5
| Position of right edge of setting values.
static const int | SETTINGTREE_TOP_OFFSET = 5
| Position of top edge of setting values.
static const int | SETTINGTREE_BOTTOM_OFFSET = 5
| Position of bottom edge of setting values.
static GameSettings * | settings_ptr = NULL
| Pointer to the game settings being displayed and modified.

## Detailed Description

Definition at line 1722 of file settings_gui.cpp.

## Member Function Documentation

virtual void GameSettingsWindow::DrawWidget | ( | const Rect & | r,
|  | int | widget |
| ) |  |  | const`[inline, virtual]`

Draw the contents of a nested widget.

Parameters:

  | r | Rectangle occupied by the widget.
  | widget | Number of the widget to draw.

Note:
  This method may not change any state, it may only use drawing functions.

Reimplemented from Window.

Definition at line 1862 of file settings_gui.cpp.

References SaveLoad::conv, SettingEntry::d, SettingDescBase::def, SettingDesc::desc, SettingsPage::Draw(), DrawString(), DrawStringMultiLine(), SettingEntry::entry, FONT_HEIGHT_NORMAL, Scrollbar::GetCapacity(), Scrollbar::GetPosition(), SettingDesc::GetType(), last_clicked, ReadValue(), SettingDesc::save, SetDParam(), SettingEntrySetting::setting, SETTINGTREE_LEFT_OFFSET, SETTINGTREE_RIGHT_OFFSET, SETTINGTREE_TOP_OFFSET, SettingEntry::SetValueDParams(), ST_CLIENT, ST_COMPANY, ST_GAME, WID_GS_HELP_TEXT, and WID_GS_OPTIONSPANEL.

virtual void GameSettingsWindow::OnClick | ( | Point | pt,
|  | int | widget,
|  | int | click_count |
| ) |  |  | `[inline, virtual]`

A click with the left mouse button has been made on the window.

Parameters:

  | 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 1908 of file settings_gui.cpp.

References _current_text_dir, _left_button_clicked, clicked_entry, closing_dropdown, SettingDescBase::cmd, SaveLoad::conv, CS_NUMERAL, SettingEntry::d, SettingDesc::desc, SettingEntry::entry, filter, SettingsPage::FindEntry(), Window::flags, SettingDescBase::flags, SettingEntry::flags, SettingsPage::FoldAll(), SettingEntrySubtree::folded, Scrollbar::GetScrolledRowFromWidget(), HideDropDownMenu(), SettingEntrySetting::index, SettingDescBase::interval, Window::InvalidateData(), SettingDesc::IsEditable(), last_clicked, SettingEntry::level, manually_changed_folding, SettingDescBase::max, min(), SettingDescBase::min, SettingFilter::mode, NWidgetBase::pos_y, QSF_ENABLE_DEFAULT, ReadValue(), NWidgetBase::resize_y, SettingDesc::save, SDT_BOOLX, SDT_NUMX, SDT_ONEOFMANY, SEF_KIND_MASK, SEF_LEFT_DEPRESSED, SEF_RIGHT_DEPRESSED, SEF_SETTING_KIND, SettingEntry::SetButtons(), SetCompanySetting(), Window::SetDirty(), SetDisplayedHelpText(), SetDParam(), SetSettingValue(), Window::SetTimeout(), SettingEntrySetting::setting, SETTING_BUTTON_HEIGHT, SETTING_BUTTON_WIDTH, SETTINGTREE_LEFT_OFFSET, SETTINGTREE_TOP_OFFSET, SGF_CURRENCY, SGF_MULTISTRING, SGF_PER_COMPANY, ShowDropDownList(), ShowDropDownListAt(), ShowQueryString(), SettingDescBase::str_val, SettingEntry::sub, TD_RTL, Window::timeout_timer, SettingFilter::type, SettingsPage::UnFoldAll(), valuedropdown_entry, valuewindow_entry, WF_TIMEOUT, WID_GS_COLLAPSE_ALL, WID_GS_EXPAND_ALL, WID_GS_OPTIONSPANEL, WID_GS_RESTRICT_DROPDOWN, WID_GS_TYPE_DROPDOWN, and Window::width.

virtual void GameSettingsWindow::OnDropdownClose | ( | Point | pt,
|  | int | widget,
|  | int | index,
|  | bool | instant_close |
| ) |  |  | `[inline, virtual]`

A dropdown window associated to this window has been closed.

Parameters:

  | pt | the point inside the window the mouse resides on after closure.
  | widget | the widget (button) that the dropdown is associated with.
  | index | the element in the dropdown that is selected.
  | instant_close | whether the dropdown was configured to close on mouse up.

Reimplemented from Window.

Definition at line 2168 of file settings_gui.cpp.

References closing_dropdown, Window::SetDirty(), and valuedropdown_entry.

virtual void GameSettingsWindow::OnDropdownSelect | ( | int | widget,
|  | int | index |
| ) |  |  | `[inline, virtual]`

A dropdown option associated to this window has been selected.

Parameters:

  | 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 2124 of file settings_gui.cpp.

References _settings_client, SettingEntry::d, SettingDesc::desc, SettingEntry::entry, filter, SettingDescBase::flags, ClientSettings::gui, SettingEntrySetting::index, Window::InvalidateData(), manually_changed_folding, SettingFilter::mode, RM_CHANGED_AGAINST_DEFAULT, RM_CHANGED_AGAINST_NEW, SetCompanySetting(), Window::SetDirty(), SetSettingValue(), SettingEntrySetting::setting, GUISettings::settings_restriction_mode, SGF_MULTISTRING, SGF_PER_COMPANY, SettingFilter::type, SettingsPage::UnFoldAll(), SettingsPage::UpdateFilterState(), valuedropdown_entry, WID_GS_RESTRICT_DROPDOWN, and WID_GS_TYPE_DROPDOWN.

virtual void GameSettingsWindow::OnEditboxChanged | ( | int | widget | ) | `[inline, virtual]`

The text in an editbox has been edited.

Parameters:

  | widget | The widget of the editbox.

Reimplemented from Window.

Definition at line 2206 of file settings_gui.cpp.

References Textbuf::buf, filter, filter_editbox, Window::InvalidateData(), StringFilter::IsEmpty(), manually_changed_folding, StringFilter::SetFilterTerm(), SettingFilter::string, SettingsPage::UnFoldAll(), and WID_GS_FILTER.

virtual void GameSettingsWindow::OnInvalidateData | ( | int | data = `0`,
|  | bool | gui_scope = `true` |
| ) |  |  | `[inline, virtual]`

Some data on this window has become invalid.

Parameters:

  | 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 2187 of file settings_gui.cpp.

References filter, SettingsPage::GetFoldingState(), SettingsPage::IsVisible(), last_clicked, SettingsPage::Length(), Scrollbar::SetCount(), SetDisplayedHelpText(), Window::SetWidgetDisabledState(), SettingsPage::UpdateFilterState(), WID_GS_COLLAPSE_ALL, and WID_GS_EXPAND_ALL.

virtual void GameSettingsWindow::OnPaint | ( |  | ) | `[inline, virtual]`

The window must be repainted.

Note:
  This method should not change any state, it should only use drawing functions.

Reimplemented from Window.

Definition at line 1806 of file settings_gui.cpp.

References closing_dropdown, Window::DrawWidgets(), SettingEntry::SetButtons(), and valuedropdown_entry.

virtual void GameSettingsWindow::OnQueryTextFinished | ( | char * | str | ) | `[inline, virtual]`

The query window opened from this window has closed.

Parameters:

  | str | the new value of the string, NULL if the window was cancelled or an empty string when the default button was pressed, i.e. StrEmpty(str).

Reimplemented from Window.

Definition at line 2097 of file settings_gui.cpp.

References SettingEntry::d, SettingDescBase::def, SettingDesc::desc, SettingEntry::entry, SettingDescBase::flags, SettingEntry::flags, SettingEntrySetting::index, SEF_KIND_MASK, SEF_SETTING_KIND, SetCompanySetting(), Window::SetDirty(), SetSettingValue(), SettingEntrySetting::setting, SGF_CURRENCY, SGF_PER_COMPANY, StrEmpty(), and valuewindow_entry.

virtual void GameSettingsWindow::OnResize | ( |  | ) | `[inline, virtual]`

Called after the window got resized.

For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.

Reimplemented from Window.

Definition at line 2219 of file settings_gui.cpp.

References Scrollbar::SetCapacityFromWidget(), SETTINGTREE_BOTTOM_OFFSET, SETTINGTREE_TOP_OFFSET, and WID_GS_OPTIONSPANEL.

void GameSettingsWindow::SetDisplayedHelpText | ( | SettingEntry * | pe | ) | `[inline]`

Set the entry that should have its help text displayed, and mark the window dirty so it gets repainted.

Parameters:

  | pe | Setting to display help text of, use `NULL` to stop displaying help of the currently displayed setting.

Definition at line 1902 of file settings_gui.cpp.

References last_clicked, and Window::SetDirty().

Referenced by OnClick(), and OnInvalidateData().

virtual void GameSettingsWindow::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.

Parameters:

  | widget | Widget number.

Reimplemented from Window.

Definition at line 1817 of file settings_gui.cpp.

References filter, SettingFilter::mode, SetDParam(), ST_CLIENT, ST_COMPANY, ST_GAME, SettingFilter::type, WID_GS_RESTRICT_DROPDOWN, and WID_GS_TYPE_DROPDOWN.

virtual void GameSettingsWindow::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.

Parameters:

  | 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 1776 of file settings_gui.cpp.

References FONT_HEIGHT_NORMAL, SettingsPage::GetMaxHelpHeight(), GetStringBoundingBox(), lengthof, max(), SetDParam(), SETTINGTREE_BOTTOM_OFFSET, SETTINGTREE_TOP_OFFSET, WD_PAR_VSEP_NORMAL, WID_GS_HELP_TEXT, WID_GS_OPTIONSPANEL, and Window::width.

The documentation for this struct was generated from the following file:

- src/settings_gui.cpp