Update: Translations from eints
[openttd-github.git] / src / slider_func.h
blobcb5b97fe06d237b69e1910b340fd6831557e4929
1 /*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
6 */
8 /** @file slider_type.h Types related to the horizontal slider widget. */
10 #ifndef SLIDER_TYPE_H
11 #define SLIDER_TYPE_H
13 #include "core/geometry_type.hpp"
14 #include "strings_type.h"
16 using SliderMarkFunc = StringID(int nmarks, int mark, int value);
17 void DrawSliderWidget(Rect r, int min_value, int max_value, int nmarks, int value, SliderMarkFunc *mark_func);
18 bool ClickSliderWidget(Rect r, Point pt, int min_value, int max_value, int nmarks, int &value);
20 inline bool ClickSliderWidget(Rect r, Point pt, int min_value, int max_value, int nmarks, uint8_t &value)
22 int tmp_value = value;
23 if (!ClickSliderWidget(r, pt, min_value, max_value, nmarks, tmp_value)) return false;
24 value = tmp_value;
25 return true;
28 #endif /* SLIDER_TYPE_H */