# 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 | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
virtual void | OnPaint ()
| The window must be 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 | 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).
## 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 1489 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 1532 of file settings_gui.cpp.

References SettingsPage::Draw(), Scrollbar::GetCapacity(), Scrollbar::GetPosition(), SETTINGSEL_OPTIONSPANEL, SETTINGTREE_LEFT_OFFSET, SETTINGTREE_RIGHT_OFFSET, SETTINGTREE_TOP_OFFSET, and Window::vscroll.

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

References _dynlang, _left_button_clicked, _network_server, _networking, clicked_entry, SettingDescBase::cmd, SaveLoad::conv, CS_NUMERAL, SettingEntry::d, SettingDesc::desc, SettingEntry::entry, SettingsPage::FindEntry(), SettingDescBase::flags, SettingEntry::flags, Window::flags4, SettingEntrySubtree::folded, Scrollbar::GetPosition(), SettingEntrySetting::index, SettingDescBase::interval, SettingsPage::Length(), SettingEntry::level, SettingDescBase::max, min(), SettingDescBase::min, QSF_ENABLE_DEFAULT, ReadValue(), Window::resize, SettingDesc::save, SDT_BOOLX, SDT_NUMX, SDT_ONEOFMANY, SEF_KIND_MASK, SEF_LEFT_DEPRESSED, SEF_RIGHT_DEPRESSED, SEF_SETTING_KIND, SEF_SUBTREE_KIND, SettingEntry::SetButtons(), SetCompanySetting(), Scrollbar::SetCount(), Window::SetDirty(), SetDParam(), SetSettingValue(), SettingEntrySetting::setting, SETTINGSEL_OPTIONSPANEL, SETTINGTREE_LEFT_OFFSET, SETTINGTREE_TOP_OFFSET, SGF_0ISDISABLED, SGF_CURRENCY, SGF_MULTISTRING, SGF_NETWORK_ONLY, SGF_NO_NETWORK, SGF_PER_COMPANY, ShowQueryString(), SLF_NETWORK_NO, ResizeInfo::step_height, SettingEntry::sub, TD_RTL, DynamicLanguages::text_dir, valuewindow_entry, Window::vscroll, WF_TIMEOUT_BEGIN, WF_TIMEOUT_MASK, WF_TIMEOUT_TRIGGER, and Window::width.

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

References Window::DrawWidgets().

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

References Scrollbar::SetCapacityFromWidget(), SETTINGSEL_OPTIONSPANEL, SETTINGTREE_BOTTOM_OFFSET, SETTINGTREE_TOP_OFFSET, and Window::vscroll.

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

References FONT_HEIGHT_NORMAL, max(), SETTINGSEL_OPTIONSPANEL, SETTINGTREE_BOTTOM_OFFSET, and SETTINGTREE_TOP_OFFSET.

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

- src/settings_gui.cpp