Public Member Functions | Data Fields | Static Public Attributes

GameSettingsWindow Struct Reference

Inheritance diagram for GameSettingsWindow:
Window ZeroedMemoryAllocator

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 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 OnResize ()
 Called after the window got resized.

Data Fields

SettingEntryvaluewindow_entry
 If non-NULL, pointer to setting for which a value-entering window has been opened.
SettingEntryclicked_entry
 If non-NULL, pointer to a clicked numeric setting (with a depressed left or right button).
SettingEntrylast_clicked
 If non-NULL, pointer to the last clicked setting.
SettingEntryvaluedropdown_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.
Scrollbarvscroll

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 GameSettingssettings_ptr = NULL
 Pointer to the game settings being displayed and modified.

Detailed Description

Definition at line 1707 of file settings_gui.cpp.


Member Function Documentation

virtual void GameSettingsWindow::DrawWidget ( const Rect r,
int  widget 
) const [inline, virtual]
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 1838 of file settings_gui.cpp.

References _current_text_dir, _left_button_clicked, _network_server, _networking, clicked_entry, closing_dropdown, SettingDescBase::cmd, SaveLoad::conv, CS_NUMERAL, SettingEntry::d, SettingDesc::desc, SettingEntry::entry, SettingsPage::FindEntry(), Window::flags, SettingDescBase::flags, SettingEntry::flags, SettingEntrySubtree::folded, Scrollbar::GetScrolledRowFromWidget(), HideDropDownMenu(), SettingEntrySetting::index, SettingDescBase::interval, last_clicked, SettingsPage::Length(), SettingEntry::level, SettingDescBase::max, min(), SettingDescBase::min, 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(), Scrollbar::SetCount(), 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_NETWORK_ONLY, SGF_NO_NETWORK, SGF_PER_COMPANY, ShowDropDownListAt(), ShowQueryString(), SLF_NO_NETWORK_SYNC, SettingDescBase::str_val, SettingEntry::sub, TD_RTL, Window::timeout_timer, valuedropdown_entry, valuewindow_entry, WF_TIMEOUT, WID_GS_OPTIONSPANEL, 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 2039 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 2024 of file settings_gui.cpp.

References SettingEntry::d, SettingDesc::desc, SettingEntry::entry, SettingDescBase::flags, SettingEntrySetting::index, SetCompanySetting(), Window::SetDirty(), SetSettingValue(), SettingEntrySetting::setting, SGF_MULTISTRING, SGF_PER_COMPANY, and valuedropdown_entry.

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 1780 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 1997 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 2050 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 1832 of file settings_gui.cpp.

References last_clicked, and Window::SetDirty().

Referenced by OnClick().

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 1750 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: