OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Data Fields | Protected Member Functions
SettingsPage Struct Reference

Data structure describing one page of settings in the settings window. More...

Inheritance diagram for SettingsPage:

## Public Member Functions
| SettingsPage (StringID title)
| Constructor for a sub-page in the 'advanced settings' window.
virtual void | Init (byte level=0)
| Initialization of an entire setting page.
virtual void | FoldAll ()
| Recursively close all (filtered) folds of sub-pages.
virtual void | UnFoldAll ()
| Recursively open all (filtered) folds of sub-pages.
virtual uint | Length () const
| Return number of rows needed to display the (filtered) entry.
virtual void | GetFoldingState (bool &all_folded, bool &all_unfolded) const
| Recursively accumulate the folding state of the (filtered) tree.
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)
virtual bool | UpdateFilterState (SettingFilter &filter, bool force_visible)
| Update the filter state.
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.
Public Member Functions inherited from BaseSettingEntry
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.
Public Member Functions inherited from SettingsContainer
template<typename T >
T * | Add (T *item)

## Data Fields
StringID | title
| Title of the sub-page.
bool | folded
| Sub-page is folded (not visible except for its title)
Data Fields inherited from BaseSettingEntry
byte | flags
| Flags of the setting entry.
byte | level
| Nesting level of this setting entry.
Data Fields inherited from SettingsContainer
EntryVector | entries
| Settings on this page.

## Protected Member Functions
virtual void | DrawSetting (GameSettings *settings_ptr, int left, int right, int y, bool highlight) const
| Function to draw setting value (button + text + current value)

## Additional Inherited Members
Public Types inherited from SettingsContainer
typedef std::vector < BaseSettingEntry * > | EntryVector

## Detailed Description

Data structure describing one page of settings in the settings window.

Definition at line 805 of file settings_gui.cpp.

## Constructor & Destructor Documentation

SettingsPage::SettingsPage | ( | StringID | title | ) |

Constructor for a sub-page in the 'advanced settings' window.

Parameters

  title | Title of the sub-page

Definition at line 1291 of file settings_gui.cpp.

References folded, and title.

## Member Function Documentation

uint SettingsPage::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
| virtual

Draw a row in the settings panel.

Parameters

  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)

Returns
  Row number of the next row to draw

Reimplemented from BaseSettingEntry.

Definition at line 1420 of file settings_gui.cpp.

References BaseSettingEntry::flags, folded, BaseSettingEntry::IsFiltered(), BaseSettingEntry::level, SEF_LAST_FIELD, and SetBit().

void SettingsPage::DrawSetting | ( | GameSettings * | settings_ptr,
|  | int | left,
|  | int | right,
|  | int | y,
|  | bool | highlight
| ) |  | const
| protected virtual

Function to draw setting value (button + text + current value)

Parameters

  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 1447 of file settings_gui.cpp.

References _current_text_dir, DrawSprite(), DrawString(), folded, FONT_HEIGHT_NORMAL, and TD_RTL.

BaseSettingEntry * SettingsPage::FindEntry | ( | uint | row_num,
|  | uint * | cur_row
| ) |  |
| virtual

Find setting entry at row row_num.

Parameters

  row_num | Index of entry to return
  cur_row | Current row number

Returns
  The requested setting entry or `NULL` if it not found (folded or filtered)

Reimplemented from BaseSettingEntry.

Definition at line 1396 of file settings_gui.cpp.

References folded, and BaseSettingEntry::IsFiltered().

void SettingsPage::GetFoldingState | ( | bool & | all_folded,
|  | bool & | all_unfolded
| ) |  | const
| virtual

Recursively accumulate the folding state of the (filtered) tree.

Parameters

  [in,out] | all_folded | Set to false, if one entry is not folded.
  [in,out] | all_unfolded | Set to false, if one entry is folded.

Reimplemented from BaseSettingEntry.

Definition at line 1330 of file settings_gui.cpp.

References folded, and BaseSettingEntry::IsFiltered().

void SettingsPage::Init | ( | byte | level = `0` | ) |
| virtual

Initialization of an entire setting page.

Parameters

  level | Nesting level of this page (internal variable, do not provide a value for it when calling)

Reimplemented from BaseSettingEntry.

Definition at line 1301 of file settings_gui.cpp.

bool SettingsPage::IsVisible | ( | const BaseSettingEntry * | item | ) | const
| 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.

Parameters

  item | Entry to search for.

Returns
  true if entry is visible.

Reimplemented from BaseSettingEntry.

Definition at line 1372 of file settings_gui.cpp.

References folded, and BaseSettingEntry::IsFiltered().

bool SettingsPage::UpdateFilterState | ( | SettingFilter & | filter,
|  | bool | force_visible
| ) |  |
| virtual

Update the filter state.

Parameters

  filter | Filter
  force_visible | Whether to force all items visible, no matter what (due to filter text; not affected by restriction drop down box).

Returns
  true if item remains visible

Implements BaseSettingEntry.

Definition at line 1349 of file settings_gui.cpp.

References StringFilter::AddLine(), CLRBITS, BaseSettingEntry::flags, StringFilter::GetState(), StringFilter::IsEmpty(), StringFilter::ResetState(), SEF_FILTERED, SETBITS, SettingFilter::string, and title.

The documentation for this struct was generated from the following file:

- src/settings_gui.cpp