|
OpenTTD Source 20261112-master-gbcbec5e63f
|
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, Colours wedge_colour, Colours handle_colour, TextColour text_colour, int min_value, int max_value, int nmarks, int value, SliderMarkFunc *mark_func, int soft_min, int soft_max) |
| Draw a slider widget with knob at given value. | |
| 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. | |
Variables | |
| static const int | SLIDER_WIDTH = 5 |
| Width of the slider handle. | |
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. | |
| [in,out] | value | Value to modify |
Definition at line 123 of file slider.cpp.
References _current_text_dir, Clamp(), Point, Rect, ScaleGUITrad(), SLIDER_WIDTH, TD_RTL, and Coord2D< T >::x.
Referenced by GameOptionsWindow::OnClick(), and MusicWindow::OnClick().
| void DrawSliderWidget | ( | Rect | r, |
| Colours | wedge_colour, | ||
| Colours | handle_colour, | ||
| TextColour | text_colour, | ||
| int | min_value, | ||
| int | max_value, | ||
| int | nmarks, | ||
| int | value, | ||
| SliderMarkFunc * | mark_func, | ||
| int | soft_min, | ||
| int | soft_max ) |
Draw a slider widget with knob at given value.
| r | Rectangle to draw the widget in |
| wedge_colour | Colour to draw wedge. |
| handle_colour | Colour to draw handle. |
| text_colour | Colour of text. |
| 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. |
| soft_min | Soft minimum value. |
| soft_max | Soft maximum value. |
Definition at line 36 of file slider.cpp.
References _current_text_dir, Checker, Clamp(), Dark, DrawFrameRect(), DrawString(), GetCharacterHeight(), GetColourGradient(), GetStringBoundingBox(), GfxFillPolygon(), GfxFillRect(), Rect::Height(), Rect::Indent(), Light, Lighter, Lightest, Point, Rect, WidgetDimensions::scaled, ScaleGUITrad(), SLIDER_WIDTH, Small, TD_RTL, Dimension::width, Rect::WithWidth(), and Rect::WithX().
Referenced by GameOptionsWindow::DrawWidget(), and MusicWindow::DrawWidget().
|
static |
Width of the slider handle.
Definition at line 20 of file slider.cpp.
Referenced by ClickSliderWidget(), and DrawSliderWidget().