OpenTTD Source
20241108-master-g80f628063a
|
Implementation of the horizontal slider widget. More...
#include "stdafx.h"
#include "gfx_func.h"
#include "palette_func.h"
#include "slider_func.h"
#include "strings_func.h"
#include "window_gui.h"
#include "zoom_func.h"
#include "safeguards.h"
Go to the source code of this file.
Functions | |
void | DrawSliderWidget (Rect r, int min_value, int max_value, int nmarks, int value, SliderMarkFunc *mark_func) |
Draw a slider widget with knob at given value. More... | |
bool | ClickSliderWidget (Rect r, Point pt, int min_value, int max_value, int nmarks, int &value) |
Handle click on a slider widget to change the value. More... | |
Variables | |
static const int | SLIDER_WIDTH = 3 |
Implementation of the horizontal slider widget.
Definition in file slider.cpp.
Handle click on a slider widget to change the value.
r | Rectangle of the widget |
pt | Clicked point |
min_value | Minimum value of slider |
max_value | Maximum value of slider |
nmarks | Number of marks displayed. Value will be rounded to nearest mark. |
value[in,out] | Value to modify |
Definition at line 91 of file slider.cpp.
References ScaleGUITrad().
void DrawSliderWidget | ( | Rect | r, |
int | min_value, | ||
int | max_value, | ||
int | nmarks, | ||
int | value, | ||
SliderMarkFunc * | mark_func | ||
) |
Draw a slider widget with knob at given value.
r | Rectangle to draw the widget in |
min_value | Minimum value of slider |
max_value | Maximum value of slider |
nmarks | Number of marks to display (when mark_func is provided.) |
value | Value to put the slider at |
mark_func | Callback function to get the StringID to draw on a mark. |
Definition at line 31 of file slider.cpp.
References FS_SMALL, GetCharacterHeight(), WidgetDimensions::hsep_normal, WidgetDimensions::scaled, and ScaleGUITrad().