OpenTTD Source 20241224-master-gee860a5c8e
|
Standard setting. More...
Public Member Functions | |
SettingEntry (const char *name) | |
Constructor for a single setting in the 'advanced settings' window. | |
void | Init (uint8_t level=0) override |
Initialization of a setting entry. | |
void | ResetAll () override |
uint | Length () const override |
Return number of rows needed to display the (filtered) entry. | |
uint | GetMaxHelpHeight (int maxw) override |
Get the biggest height of the help text(s), if the width is at least maxw. | |
bool | UpdateFilterState (SettingFilter &filter, bool force_visible) override |
Update the filter state. | |
void | SetButtons (uint8_t new_val) |
Set the button-depressed flags (SEF_LEFT_DEPRESSED and SEF_RIGHT_DEPRESSED) to a specified value. | |
Public Member Functions inherited from BaseSettingEntry | |
virtual void | FoldAll () |
virtual void | UnFoldAll () |
void | SetLastField (bool last_field) |
Set whether this is the last visible entry of the parent node. | |
virtual void | GetFoldingState (bool &all_folded, bool &all_unfolded) const |
virtual bool | IsVisible (const BaseSettingEntry *item) const |
Check whether an entry is visible and not folded or filtered away. | |
virtual BaseSettingEntry * | FindEntry (uint row, uint *cur_row) |
Find setting entry at row row_num. | |
bool | IsFiltered () const |
Check whether an entry is hidden due to filters. | |
virtual uint | Draw (GameSettings *settings_ptr, int left, int right, int y, uint first_row, uint max_row, BaseSettingEntry *selected, uint cur_row=0, uint parent_last=0) const |
Draw a row in the settings panel. | |
Data Fields | |
const char * | name |
Name of the setting. | |
const IntSettingDesc * | setting |
Setting description of the setting. | |
Data Fields inherited from BaseSettingEntry | |
uint8_t | flags |
Flags of the setting entry. | |
uint8_t | level |
Nesting level of this setting entry. | |
Protected Member Functions | |
void | DrawSetting (GameSettings *settings_ptr, int left, int right, int y, bool highlight) const override |
Function to draw setting value (button + text + current value) | |
Private Member Functions | |
bool | IsVisibleByRestrictionMode (RestrictionMode mode) const |
Checks whether an entry shall be made visible based on the restriction mode. | |
Standard setting.
Definition at line 1281 of file settings_gui.cpp.
SettingEntry::SettingEntry | ( | const char * | name | ) |
Constructor for a single setting in the 'advanced settings' window.
name | Name of the setting in the setting table |
Definition at line 1462 of file settings_gui.cpp.
|
overrideprotectedvirtual |
Function to draw setting value (button + text + current value)
settings_ptr | Pointer to current values of all settings |
left | Left-most position in window/panel to start drawing |
right | Right-most position in window/panel to draw |
y | Upper-most position in window/panel to start drawing |
highlight | Highlight entry. |
Implements BaseSettingEntry.
Definition at line 1609 of file settings_gui.cpp.
References _current_text_dir, DrawArrowButtons(), DrawBoolButton(), DrawDropDownButton(), DrawString(), BaseSettingEntry::flags, SettingDesc::flags, FS_NORMAL, GetCharacterHeight(), IntSettingDesc::GetTitle(), WidgetDimensions::hsep_wide, IntSettingDesc::IsBoolSetting(), SettingDesc::IsEditable(), IntSettingDesc::max, IntSettingDesc::min, IntSettingDesc::Read(), WidgetDimensions::scaled, SEF_BUTTONS_MASK, SetDParam(), setting, SETTING_BUTTON_HEIGHT, SETTING_BUTTON_WIDTH, SETTING_HEIGHT, IntSettingDesc::SetValueDParams(), SF_GUI_0_IS_SPECIAL, SF_GUI_DROPDOWN, and TD_RTL.
|
overridevirtual |
Get the biggest height of the help text(s), if the width is at least maxw.
Help text gets wrapped if needed.
maxw | Maximal width of a line help text. |
Reimplemented from BaseSettingEntry.
Definition at line 1506 of file settings_gui.cpp.
References IntSettingDesc::GetHelp(), GetStringHeight(), and setting.
|
overridevirtual |
Initialization of a setting entry.
level | Page nesting level of this entry |
Reimplemented from BaseSettingEntry.
Definition at line 1472 of file settings_gui.cpp.
References SettingDesc::AsIntSetting(), GetSettingFromName(), BaseSettingEntry::Init(), BaseSettingEntry::level, name, and setting.
|
private |
Checks whether an entry shall be made visible based on the restriction mode.
mode | The current status of the restriction drop down box. |
Definition at line 1516 of file settings_gui.cpp.
References _settings_newgame, IntSettingDesc::cat, IntSettingDesc::def, GetGameSettings(), IntSettingDesc::Read(), RM_ADVANCED, RM_ALL, RM_BASIC, RM_CHANGED_AGAINST_DEFAULT, RM_CHANGED_AGAINST_NEW, SC_ADVANCED_LIST, SC_BASIC_LIST, and setting.
Referenced by UpdateFilterState().
|
overridevirtual |
Return number of rows needed to display the (filtered) entry.
Implements BaseSettingEntry.
Definition at line 1496 of file settings_gui.cpp.
References BaseSettingEntry::IsFiltered().
|
overridevirtual |
Implements BaseSettingEntry.
Definition at line 1479 of file settings_gui.cpp.
void SettingEntry::SetButtons | ( | uint8_t | new_val | ) |
Set the button-depressed flags (SEF_LEFT_DEPRESSED and SEF_RIGHT_DEPRESSED) to a specified value.
new_val | New value for the button flags |
Definition at line 1489 of file settings_gui.cpp.
References BaseSettingEntry::flags, and SEF_BUTTONS_MASK.
Referenced by GameSettingsWindow::OnClick(), GameSettingsWindow::OnPaint(), and GameSettingsWindow::OnTimeout().
|
overridevirtual |
Update the filter state.
filter | Filter |
force_visible | Whether to force all items visible, no matter what (due to filter text; not affected by restriction drop down box). |
Implements BaseSettingEntry.
Definition at line 1557 of file settings_gui.cpp.
References StringFilter::AddLine(), CLRBITS, BaseSettingEntry::flags, IntSettingDesc::GetHelp(), StringFilter::GetState(), IntSettingDesc::GetTitle(), SettingDesc::GetType(), StringFilter::IsEmpty(), IsVisibleByRestrictionMode(), SettingFilter::min_cat, SettingFilter::mode, StringFilter::ResetState(), RM_ALL, SEF_FILTERED, SETBITS, SetDParam(), setting, ST_ALL, SettingFilter::string, SettingFilter::type, and SettingFilter::type_hides.
const char* SettingEntry::name |
Name of the setting.
Definition at line 1282 of file settings_gui.cpp.
Referenced by Init(), and SettingEntry().
const IntSettingDesc* SettingEntry::setting |
Setting description of the setting.
Definition at line 1283 of file settings_gui.cpp.
Referenced by DrawSetting(), GameSettingsWindow::DrawWidget(), GetMaxHelpHeight(), Init(), IsVisibleByRestrictionMode(), GameSettingsWindow::OnClick(), GameSettingsWindow::OnDropdownSelect(), GameSettingsWindow::OnQueryTextFinished(), SettingEntry(), and UpdateFilterState().