10#ifndef SETTINGENTRY_GUI_H
11#define SETTINGENTRY_GUI_H
63 virtual void FoldAll() {}
64 virtual void UnFoldAll() {}
65 virtual void ResetAll() = 0;
73 virtual uint Length()
const = 0;
74 virtual void GetFoldingState([[maybe_unused]]
bool &all_folded, [[maybe_unused]]
bool &all_unfolded)
const {}
77 virtual uint GetMaxHelpHeight([[maybe_unused]]
int maxw) {
return 0; }
85 virtual bool UpdateFilterState(
SettingFilter &filter,
bool force_visible) = 0;
87 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;
90 virtual void DrawSetting(
GameSettings *settings_ptr,
int left,
int right,
int y,
bool highlight)
const = 0;
101 void ResetAll()
override;
102 uint
Length()
const override;
117 typedef std::vector<BaseSettingEntry*> EntryVector;
120 template <
typename T>
123 this->entries.push_back(item);
127 void Init(uint8_t level = 0);
140 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;
155 uint
Length()
const override;
156 void GetFoldingState(
bool &all_folded,
bool &all_unfolded)
const override;
163 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 override;
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
constexpr Timpl & Set()
Set all bits.
Type (helpers) for enums.
#define DECLARE_INCREMENT_DECREMENT_OPERATORS(enum_type)
For some enums it is useful to have pre/post increment/decrement operators.
int SETTING_HEIGHT
Height of a single setting in the tree view in pixels.
RestrictionMode
How the list of advanced settings is filtered.
@ RM_CHANGED_AGAINST_DEFAULT
Show only settings which are different compared to default values.
@ RM_ADVANCED
Display settings associated to the "advanced" list.
@ RM_ALL
List all settings regardless of the default/newgame/... values.
@ RM_CHANGED_AGAINST_NEW
Show only settings which are different compared to the user's new game setting values.
@ RM_END
End for iteration.
@ RM_BASIC
Display settings associated to the "basic" list.
static constexpr SettingEntryFlags SEF_BUTTONS_MASK
Mask for button flags.
SettingEntryFlag
Flags for SettingEntry.
@ LeftDepressed
Of a numeric setting entry, the left button is depressed.
@ LastField
This entry is the last one in a (sub-)page.
@ RightDepressed
Of a numeric setting entry, the right button is depressed.
@ Filtered
Entry is hidden by the string filter.
Dimension _circle_size
Dimension of the circle +/- icon. This is here as not all users are within the class of the settings ...
SettingsContainer & GetSettingsTree()
Construct settings tree.
Functions and types used internally for the settings configurations.
SettingType
Type of settings for filtering.
Searching and filtering using a stringterm.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Data structure describing a single setting in a tab.
void SetLastField(bool last_field)
Set whether this is the last visible entry of the parent node.
bool IsFiltered() const
Check whether an entry is hidden due to filters.
virtual BaseSettingEntry * FindEntry(uint row, uint *cur_row)
Find setting entry at row row_num.
virtual void Init(uint8_t level=0)
Initialization of a setting entry.
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.
SettingEntryFlags flags
Flags of the setting entry.
virtual bool IsVisible(const BaseSettingEntry *item) const
Check whether an entry is visible and not folded or filtered away.
uint8_t level
Nesting level of this setting entry.
Dimensions (a width and height) of a rectangle in 2D.
All settings together for the game.
Base integer type, including boolean, settings.
uint Length() const override
Return number of rows needed to display the (filtered) entry.
void SetButtons(SettingEntryFlags new_val)
Set the button-depressed flags (#SettingsEntryFlag::LeftDepressed and #SettingsEntryFlag::RightDepres...
void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const override
Function to draw setting value (button + text + current value)
bool IsVisibleByRestrictionMode(RestrictionMode mode) const
Checks whether an entry shall be made visible based on the restriction mode.
uint GetMaxHelpHeight(int maxw) override
Get the biggest height of the help text(s), if the width is at least maxw.
void Init(uint8_t level=0) override
Initialization of a setting entry.
const IntSettingDesc * setting
Setting description of the setting.
bool UpdateFilterState(SettingFilter &filter, bool force_visible) override
Update the filter state.
const char * name
Name of the setting.
Filter for settings list.
SettingType type
Filter based on type.
bool type_hides
Whether the type hides filtered strings.
RestrictionMode mode
Filter based on category.
RestrictionMode min_cat
Minimum category needed to display all filtered strings (RM_BASIC, RM_ADVANCED, or RM_ALL).
StringFilter string
Filter string.
Containers for BaseSettingEntry.
bool UpdateFilterState(SettingFilter &filter, bool force_visible)
Update the filter state.
void GetFoldingState(bool &all_folded, bool &all_unfolded) const
Recursively accumulate the folding state of the tree.
uint GetMaxHelpHeight(int maxw)
Get the biggest height of the help texts, if the width is at least maxw.
void ResetAll()
Resets all settings to their default values.
bool IsVisible(const BaseSettingEntry *item) const
Check whether an entry is visible and not folded or filtered away.
void FoldAll()
Recursively close all folds of sub-pages.
void UnFoldAll()
Recursively open all folds of sub-pages.
BaseSettingEntry * FindEntry(uint row, uint *cur_row)
Find the setting entry at row number row_num.
EntryVector entries
Settings on this page.
uint Length() const
Return number of rows needed to display the whole page.
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.
void Init(uint8_t level=0)
Initialization of an entire setting page.
Data structure describing one page of settings in the settings window.
StringID title
Title of the sub-page.
bool IsVisible(const BaseSettingEntry *item) const override
Check whether an entry is visible and not folded or filtered away.
void UnFoldAll() override
Recursively open all (filtered) folds of sub-pages.
void FoldAll() override
Recursively close all (filtered) folds of sub-pages.
uint Length() const override
Return number of rows needed to display the (filtered) entry.
BaseSettingEntry * FindEntry(uint row, uint *cur_row) override
Find setting entry at row row_num.
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 override
Draw a row in the settings panel.
void Init(uint8_t level=0) override
Initialization of an entire setting page.
void GetFoldingState(bool &all_folded, bool &all_unfolded) const override
Recursively accumulate the folding state of the (filtered) tree.
void ResetAll() override
Resets all settings to their default values.
bool folded
Sub-page is folded (not visible except for its title)
bool UpdateFilterState(SettingFilter &filter, bool force_visible) override
Update the filter state.
void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const override
Function to draw setting value (button + text + current value)