2012-06-01 11:44:45 +01:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
|
|
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @file settings_gui.h Functions for setting GUIs. */
|
|
|
|
|
|
|
|
#ifndef SETTING_GUI_H
|
|
|
|
#define SETTING_GUI_H
|
|
|
|
|
|
|
|
#include "gfx_type.h"
|
2024-03-31 19:37:16 +01:00
|
|
|
#include "dropdown_type.h"
|
2012-06-01 11:44:45 +01:00
|
|
|
|
2014-10-04 21:34:43 +01:00
|
|
|
/** Width of setting buttons */
|
|
|
|
#define SETTING_BUTTON_WIDTH ((int)NWidgetScrollbar::GetHorizontalDimension().width * 2)
|
|
|
|
/** Height of setting buttons */
|
|
|
|
#define SETTING_BUTTON_HEIGHT ((int)NWidgetScrollbar::GetHorizontalDimension().height)
|
2012-06-01 15:41:09 +01:00
|
|
|
|
2024-03-16 22:59:32 +00:00
|
|
|
void DrawArrowButtons(int x, int y, Colours button_colour, uint8_t state, bool clickable_left, bool clickable_right);
|
2012-06-01 15:41:47 +01:00
|
|
|
void DrawDropDownButton(int x, int y, Colours button_colour, bool state, bool clickable);
|
2012-06-01 11:44:45 +01:00
|
|
|
void DrawBoolButton(int x, int y, bool state, bool clickable);
|
|
|
|
|
2023-07-01 12:57:06 +01:00
|
|
|
template <class T>
|
|
|
|
DropDownList BuildSetDropDownList(int *selected_index)
|
|
|
|
{
|
|
|
|
int n = T::GetNumSets();
|
|
|
|
*selected_index = T::GetIndexOfUsedSet();
|
|
|
|
DropDownList list;
|
|
|
|
for (int i = 0; i < n; i++) {
|
2023-11-10 12:25:56 +00:00
|
|
|
list.push_back(std::make_unique<DropDownListStringItem>(T::GetSet(i)->GetListLabel(), i, false));
|
2023-07-01 12:57:06 +01:00
|
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2018-03-20 16:06:39 +00:00
|
|
|
|
|
|
|
/* Actually implemented in music_gui.cpp */
|
|
|
|
void ChangeMusicSet(int index);
|
|
|
|
|
2012-06-01 11:44:45 +01:00
|
|
|
#endif /* SETTING_GUI_H */
|
|
|
|
|