OpenTTD

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

- Data Structures
- Class Hierarchy
- Data Fields

Public Types | Public Member Functions | Data Fields
SettingsContainer Struct Reference

Containers for BaseSettingEntry. More...

Inheritance diagram for SettingsContainer:

## Public Types
typedef std::vector < BaseSettingEntry * > | EntryVector

## Public Member Functions
template<typename T >
T * | Add (T *item)
void | Init (byte level=0)
| Initialization of an entire setting page.
void | FoldAll ()
| Recursively close all folds of sub-pages.
void | UnFoldAll ()
| Recursively open all folds of sub-pages.
uint | Length () const
| Return number of rows needed to display the whole page.
void | GetFoldingState (bool &all_folded, bool &all_unfolded) const
| Recursively accumulate the folding state of the tree.
bool | IsVisible (const BaseSettingEntry *item) const
| Check whether an entry is visible and not folded or filtered away.
BaseSettingEntry * | FindEntry (uint row, uint *cur_row)
| Find the setting entry at row number row_num.
uint | GetMaxHelpHeight (int maxw)
| Get the biggest height of the help texts, if the width is at least maxw.
bool | UpdateFilterState (SettingFilter &filter, bool force_visible)
| Update the filter state.
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
EntryVector | entries
| Settings on this page.

## Detailed Description

Containers for BaseSettingEntry.

Definition at line 779 of file settings_gui.cpp.

## Member Function Documentation

uint SettingsContainer::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.

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 in SettingsPage.

Definition at line 1275 of file settings_gui.cpp.

References entries.

Referenced by GameSettingsWindow::DrawWidget().

BaseSettingEntry * SettingsContainer::FindEntry | ( | uint | row_num,
|  | uint * | cur_row
| ) |  |

Find the setting entry at row number row_num.

Parameters

  row_num | Index of entry to return
  cur_row | Variable used for keeping track of the current row number. Should point to memory initialized to `0` when first called.

Returns
  The requested setting entry or `NULL` if it does not exist

Reimplemented in SettingsPage.

Definition at line 1234 of file settings_gui.cpp.

References entries, and BaseSettingEntry::FindEntry().

Referenced by GameSettingsWindow::OnClick().

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

Recursively accumulate the folding state of the 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 in SettingsPage.

Definition at line 1178 of file settings_gui.cpp.

References entries.

Referenced by GameSettingsWindow::OnInvalidateData().

uint SettingsContainer::GetMaxHelpHeight | ( | int | maxw | ) |

Get the biggest height of the help texts, if the width is at least maxw.

Help text gets wrapped if needed.

Parameters

  maxw | Maximal width of a line help text.

Returns
  Biggest height needed to display any help text of this (sub-)tree.

Definition at line 1251 of file settings_gui.cpp.

References entries, and max().

void SettingsContainer::Init | ( | byte | level = `0` | ) |

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 in SettingsPage.

Definition at line 1150 of file settings_gui.cpp.

References entries.

Referenced by GetSettingsTree().

bool SettingsContainer::IsVisible | ( | const BaseSettingEntry * | item | ) | const

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 in SettingsPage.

Definition at line 1210 of file settings_gui.cpp.

References entries.

bool SettingsContainer::UpdateFilterState | ( | SettingFilter & | filter,
|  | bool | force_visible
| ) |  |

Update the filter state.

Parameters

  filter | Filter
  force_visible | Whether to force all items visible, no matter what

Returns
  true if item remains visible

Reimplemented in SettingsPage.

Definition at line 1191 of file settings_gui.cpp.

References entries.

Referenced by GameSettingsWindow::OnDropdownSelect(), and GameSettingsWindow::OnInvalidateData().

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

- src/settings_gui.cpp