Public Member Functions | Data Fields | Static Public Attributes

GameSettingsWindow Struct Reference

Inheritance diagram for GameSettingsWindow:
Window ZeroedMemoryAllocator

Public Member Functions

 GameSettingsWindow (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.
DropDownListBuildDropDownList (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

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.
SettingFilter filter
 Filter for the list.
QueryString filter_editbox
 Filter editbox;.
bool manually_changed_folding
 Whether the user expanded/collapsed something manually.
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 1716 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 1902 of file settings_gui.cpp.

References _current_text_dir, _left_button_clicked, SmallVector< T, S >::Append(), 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 2162 of file settings_gui.cpp.

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

virtual void GameSettingsWindow::OnDropdownSelect ( int  widget,
int  index 
) [inline, virtual]
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 2200 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 2181 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 1800 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 2091 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 2213 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 1896 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 1811 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 1770 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: