OpenTTD Source 20260208-master-g43af8e94d0
settings_gui.h File Reference

Functions for setting GUIs. More...

#include "gfx_type.h"
#include "dropdown_type.h"

Go to the source code of this file.

Macros

#define SETTING_BUTTON_WIDTH   ((int)NWidgetScrollbar::GetHorizontalDimension().width * 2)
 Width of setting buttons.
#define SETTING_BUTTON_HEIGHT   ((int)NWidgetScrollbar::GetHorizontalDimension().height)
 Height of setting buttons.

Functions

void DrawArrowButtons (int x, int y, Colours button_colour, uint8_t state, bool clickable_left, bool clickable_right)
 Draw [<][>] boxes.
void DrawUpDownButtons (int x, int y, Colours button_colour, uint8_t state, bool clickable_up, bool clickable_down)
 Draw [^][v] buttons.
void DrawDropDownButton (int x, int y, Colours button_colour, bool state, bool clickable)
 Draw a dropdown button.
void DrawBoolButton (int x, int y, Colours button_colour, Colours background, bool state, bool clickable)
 Draw a toggle button.
template<class T>
DropDownList BuildSetDropDownList (int *selected_index)
void ChangeMusicSet (int index)
 Change the configured music set and reset playback.

Detailed Description

Functions for setting GUIs.

Definition in file settings_gui.h.

Macro Definition Documentation

◆ SETTING_BUTTON_HEIGHT

◆ SETTING_BUTTON_WIDTH

Function Documentation

◆ BuildSetDropDownList()

template<class T>
DropDownList BuildSetDropDownList ( int * selected_index)

Definition at line 148 of file settings_gui.cpp.

◆ ChangeMusicSet()

void ChangeMusicSet ( int index)

Change the configured music set and reset playback.

Parameters
indexIndex of music set to switch to

Definition at line 462 of file music_gui.cpp.

References _music, BaseMedia< MusicSet >::GetIndexOfUsedSet(), and BaseMedia< MusicSet >::GetSet().

Referenced by GameOptionsWindow::OnDropdownSelect(), and MusicTrackSelectionWindow::OnDropdownSelect().

◆ DrawArrowButtons()

void DrawArrowButtons ( int x,
int y,
Colours button_colour,
uint8_t state,
bool clickable_left,
bool clickable_right )

Draw [<][>] boxes.

Parameters
xthe x position to draw
ythe y position to draw
button_colourthe colour of the button
state0 = none clicked, 1 = first clicked, 2 = second clicked
clickable_leftis the left button clickable?
clickable_rightis the right button clickable?

Definition at line 1867 of file settings_gui.cpp.

References _current_text_dir, DrawFrameRect(), FILLRECT_CHECKER, GetColourGradient(), GfxFillRect(), Lowered, Rect, SA_CENTER, WidgetDimensions::scaled, Rect::Shrink(), and TD_RTL.

Referenced by IndustryViewWindow::DrawInfo(), SettingEntry::DrawSetting(), GSConfigWindow::DrawWidget(), NewGRFParametersWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), and SelectCompanyManagerFaceWindow::DrawWidget().

◆ DrawBoolButton()

void DrawBoolButton ( int x,
int y,
Colours button_colour,
Colours background,
bool state,
bool clickable )

Draw a toggle button.

Parameters
xthe x position to draw
ythe y position to draw
button_colourthe colour of the button.
backgroundbackground colour.
statetrue = lowered
clickableis the button clickable?

Definition at line 1948 of file settings_gui.cpp.

References _current_text_dir, BorderOnly, DrawFrameRect(), FILLRECT_CHECKER, GetColourGradient(), GfxFillRect(), Lowered, Rect, WidgetDimensions::scaled, SETTING_BUTTON_HEIGHT, SETTING_BUTTON_WIDTH, Rect::Shrink(), TD_RTL, and Rect::WithWidth().

Referenced by NWidgetLeaf::Draw(), SettingEntry::DrawSetting(), GSConfigWindow::DrawWidget(), NewGRFParametersWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), and SelectCompanyManagerFaceWindow::DrawWidget().

◆ DrawDropDownButton()

void DrawDropDownButton ( int x,
int y,
Colours button_colour,
bool state,
bool clickable )

Draw a dropdown button.

Parameters
xthe x position to draw
ythe y position to draw
button_colourthe colour of the button
statetrue = lowered
clickableis the button clickable?

Definition at line 1925 of file settings_gui.cpp.

References DrawFrameRect(), FILLRECT_CHECKER, GetColourGradient(), GfxFillRect(), Lowered, Rect, SA_CENTER, WidgetDimensions::scaled, SETTING_BUTTON_HEIGHT, SETTING_BUTTON_WIDTH, and Rect::Shrink().

Referenced by SettingEntry::DrawSetting(), GSConfigWindow::DrawWidget(), NewGRFParametersWindow::DrawWidget(), and ScriptSettingsWindow::DrawWidget().

◆ DrawUpDownButtons()

void DrawUpDownButtons ( int x,
int y,
Colours button_colour,
uint8_t state,
bool clickable_up,
bool clickable_down )

Draw [^][v] buttons.

Parameters
xthe x position to draw
ythe y position to draw
button_colourthe colour of the button
state0 = none clicked, 1 = first clicked, 2 = second clicked
clickable_upis the up button clickable?
clickable_downis the down button clickable?

Definition at line 1899 of file settings_gui.cpp.

References _current_text_dir, DrawFrameRect(), FILLRECT_CHECKER, GetColourGradient(), GfxFillRect(), Lowered, Rect, SA_CENTER, WidgetDimensions::scaled, SETTING_BUTTON_HEIGHT, SETTING_BUTTON_WIDTH, Rect::Shrink(), TD_RTL, and Rect::WithWidth().