# SettingsPage Struct Reference

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

## Public Member Functions
void | Init (byte level=0)
| Initialization of an entire setting page.
void | FoldAll ()
| Recursively close all folds of sub-pages.
uint | Length () const
| Return number of rows needed to display the whole page.
SettingEntry * | FindEntry (uint row, uint *cur_row) const
| Find the setting entry at row number row_num.
uint | Draw (GameSettings *settings_ptr, int base_x, int base_y, int max_x, uint first_row, uint max_row, uint cur_row=0, uint parent_last=0) const
| Draw a selected part of the settings page.
## Data Fields
SettingEntry * | entries
| Array of setting entries of the page.
byte | num
| Number of entries on the page (statically filled).

## Detailed Description

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

Definition at line 909 of file settings_gui.cpp.

## Member Function Documentation

uint SettingsPage::Draw | ( | GameSettings * | settings_ptr,
|  | int | left,
|  | int | right,
|  | int | base_y,
|  | uint | first_row,
|  | uint | max_row,
|  | uint | cur_row = `0`,
|  | uint | parent_last = `0` |
| ) |  |  | const

Draw a selected part of the settings page.

The scrollbar uses rows of the page, while the page data strucure 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.

Parameters:

  | settings_ptr | Pointer to current values of all settings
  | left | Left-most position in window/panel to start drawing of each setting row
  | right | Right-most position in window/panel to draw at
  | base_y | Upper-most position in window/panel to start drawing of row number first_row
  | first_row | Number of first row to draw
  | max_row | Row-number to stop drawing (the row-number of the row below the last row to draw)
  | 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

Definition at line 1264 of file settings_gui.cpp.

References SettingEntry::Draw(), entries, and num.

Referenced by GameSettingsWindow::DrawWidget().

SettingEntry * SettingsPage::FindEntry | ( | uint | row_num,
|  | uint * | cur_row |
| ) |  |  | const

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

Definition at line 1234 of file settings_gui.cpp.

References entries, SettingEntry::FindEntry(), and num.

Referenced by GameSettingsWindow::OnClick().

void SettingsPage::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)

Definition at line 1203 of file settings_gui.cpp.

References entries, SettingEntry::Init(), and num.

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

- src/settings_gui.cpp