OpenTTD Source 20250312-master-gcdcc6b491d
|
Data structure describing a single setting in a tab. More...
#include <settingentry_gui.h>
Public Member Functions | |
virtual void | Init (uint8_t level=0) |
Initialization of a setting entry. | |
virtual void | FoldAll () |
virtual void | UnFoldAll () |
virtual void | ResetAll ()=0 |
void | SetLastField (bool last_field) |
Set whether this is the last visible entry of the parent node. | |
virtual uint | Length () const =0 |
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. | |
virtual uint | GetMaxHelpHeight (int maxw) |
bool | IsFiltered () const |
Check whether an entry is hidden due to filters. | |
virtual bool | UpdateFilterState (SettingFilter &filter, bool force_visible)=0 |
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 | |
SettingEntryFlags | flags |
Flags of the setting entry. | |
uint8_t | level |
Nesting level of this setting entry. | |
Protected Member Functions | |
virtual void | DrawSetting (GameSettings *settings_ptr, int left, int right, int y, bool highlight) const =0 |
Data structure describing a single setting in a tab.
Definition at line 55 of file settingentry_gui.h.
|
inline |
Definition at line 59 of file settingentry_gui.h.
|
virtual |
Draw a row in the settings panel.
The scrollbar uses rows of the page, while the page data structure is a tree of SettingsPage and SettingEntry objects. As a result, the drawing routing traverses the tree from top to bottom, counting rows in cur_row until it reaches first_row. Then it enables drawing rows while traversing until max_row is reached, at which point drawing is terminated.
The parent_last parameter ensures that the vertical lines at the left are only drawn when another entry follows, that it prevents output like
* |-- setting * |-- (-) - Title * | |-- setting * | |-- setting *
The left-most vertical line is not wanted. It is prevented by setting the appropriate bit in the parent_last parameter.
settings_ptr | Pointer to current values of all settings |
left | Left-most position in window/panel to start drawing first_row |
right | Right-most x position to draw strings at. |
y | Upper-most position in window/panel to start drawing first_row |
first_row | First row number to draw |
max_row | Row-number to stop drawing (the row-number of the row below the last row to draw) |
selected | Selected entry by the user. |
cur_row | Current row number (internal variable) |
parent_last | Last-field booleans of parent page level (page level i sets bit i to 1 if it is its last field) |
Reimplemented in SettingsPage.
Definition at line 90 of file settingentry_gui.cpp.
References _circle_size, _current_text_dir, flags, GetColourGradient(), HasBit(), WidgetDimensions::hsep_indent, WidgetDimensions::hsep_normal, IsFiltered(), LastField, level, WidgetDimensions::scaled, SETTING_HEIGHT, TD_RTL, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().
Referenced by SettingsPage::Draw().
|
protectedpure virtual |
Implemented in SettingEntry, and SettingsPage.
|
virtual |
Find setting entry at row row_num.
row_num | Index of entry to return |
cur_row | Current row number |
nullptr
if it not found (folded or filtered) Reimplemented in SettingsPage.
Definition at line 53 of file settingentry_gui.cpp.
References IsFiltered().
Referenced by SettingsContainer::FindEntry().
|
inlinevirtual |
Reimplemented in SettingsPage.
Definition at line 63 of file settingentry_gui.h.
|
inlinevirtual |
Reimplemented in SettingsPage.
Definition at line 74 of file settingentry_gui.h.
|
inlinevirtual |
Reimplemented in SettingEntry.
Definition at line 77 of file settingentry_gui.h.
|
virtual |
Initialization of a setting entry.
level | Page nesting level of this entry |
Reimplemented in SettingEntry, and SettingsPage.
Definition at line 30 of file settingentry_gui.cpp.
References level.
Referenced by SettingEntry::Init(), and SettingsPage::Init().
|
inline |
Check whether an entry is hidden due to filters.
Definition at line 83 of file settingentry_gui.h.
References Filtered, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().
Referenced by Draw(), SettingsPage::Draw(), FindEntry(), SettingsPage::FindEntry(), SettingsPage::FoldAll(), SettingsPage::GetFoldingState(), IsVisible(), SettingsPage::IsVisible(), SettingEntry::Length(), SettingsPage::Length(), and SettingsPage::UnFoldAll().
|
virtual |
Check whether an entry is visible and not folded or filtered away.
Note: This does not consider the scrolling range; it might still require scrolling to make the setting really visible.
item | Entry to search for. |
Reimplemented in SettingsPage.
Definition at line 41 of file settingentry_gui.cpp.
References IsFiltered().
|
pure virtual |
Implemented in SettingEntry, and SettingsPage.
|
pure virtual |
Implemented in SettingsPage.
|
inline |
Set whether this is the last visible entry of the parent node.
last_field | Value to set |
Definition at line 71 of file settingentry_gui.h.
References LastField, and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set().
|
inlinevirtual |
Reimplemented in SettingsPage.
Definition at line 64 of file settingentry_gui.h.
|
pure virtual |
Implemented in SettingEntry, and SettingsPage.
SettingEntryFlags BaseSettingEntry::flags |
Flags of the setting entry.
Definition at line 56 of file settingentry_gui.h.
Referenced by Draw(), SettingsPage::Draw(), SettingEntry::DrawSetting(), GameSettingsWindow::OnClick(), SettingEntry::SetButtons(), SettingEntry::UpdateFilterState(), and SettingsPage::UpdateFilterState().
uint8_t BaseSettingEntry::level |
Nesting level of this setting entry.
Definition at line 57 of file settingentry_gui.h.
Referenced by Draw(), SettingsPage::Draw(), Init(), SettingEntry::Init(), SettingsPage::Init(), and GameSettingsWindow::OnClick().