lecui 1.0.0-alpha.20
lecui C++ user interface library
|
Slider widget. To instantiate and add to a container use the add static method. More...
#include <slider.h>
Classes | |
struct | slider_events |
Events specific to this widget. More... | |
struct | slider_range |
Slider range. More... | |
Public Member Functions | |
slider () | |
Constructor. | |
slider_events & | events () |
Get or set slider events. More... | |
bool | operator== (const slider ¶m) |
Check whether widget specs are equal. Only those properties that require the widget resources to be re-created are considered. More... | |
bool | operator!= (const slider ¶m) |
Check whether widget specs are NOT equal. Only those properties that require the widget resources to be re-created are considered. More... | |
std::string & | text () override |
Get or set the widget text. More... | |
slider & | text (const std::string &text) |
Set the widget's text. More... | |
std::string & | tooltip () override |
Get or set the widget's tooltip text. More... | |
slider & | tooltip (const std::string &tooltip) |
Set the tooltip text. More... | |
lecui::rect & | rect () override |
Get or set the position and dimensions of the widget. More... | |
slider & | rect (const lecui::rect &rect) |
Set the position and dimensions of the widget. More... | |
resize_params & | on_resize () override |
Get or set the behaviour of the widget when its container is resized. More... | |
slider & | on_resize (const resize_params &on_resize) |
Set the behaviour of the widget when its container is resized. More... | |
cursor_type & | cursor () override |
Get or set the mouse cursor to use then over the widget. More... | |
slider & | cursor (const cursor_type cursor) |
Set the mouse cursor to use when over the widget. More... | |
std::string & | font () override |
Get or set the default widget font, e.g. "Georgia". More... | |
slider & | font (const std::string &font) |
Set the default widget font. More... | |
float & | font_size () override |
Get or set the default widget font size in points, e.g. 9.0f. More... | |
slider & | font_size (const float &font_size) |
Set the widget's font size. More... | |
color & | color_text () override |
Get or set the color of the widget's text. More... | |
slider & | color_text (const color &color_text) |
Set the color of the widget's text. More... | |
color & | color_fill () override |
Get or set the fill color of the widget. More... | |
slider & | color_fill (const color &color_fill) |
Set the fill color of the widget. More... | |
color & | color_hot () override |
Get or set the widget's color when the mouse is hovered over it. More... | |
slider & | color_hot (const color &color_hot) |
Set the widget's color when the mouse is hovered over it. More... | |
color & | color_selected () override |
Get or set the widget's color when selected. More... | |
slider & | color_selected (const color &color_selected) |
Set the widget's color when selected. More... | |
color & | color_disabled () override |
Get or set the widget's color when it is disabled. More... | |
slider & | color_disabled (const color &color_disabled) |
Set the widget's color when it is disabled. More... | |
float & | border () |
Get or set the thickness of the border. More... | |
slider & | border (const float &border) |
Set the thickness of the border. More... | |
color & | color_border () |
Get or set the color of the border. More... | |
slider & | color_border (const color &color_border) |
Set the color of the border. More... | |
color & | color_knob () |
Get or set the color of the knob. More... | |
slider & | color_knob (const color &color_knob) |
Set the color of the knob. More... | |
color & | color_knob_hot () |
Get or set the color of the knob when the mouse is over the slider. More... | |
slider & | color_knob_hot (const color &color_knob_hot) |
Set the color of the knob when the mouse is over the slider. More... | |
color & | color_knob_border () |
Get or set the color of the knob's border. More... | |
slider & | color_knob_border (const color &color_knob_border) |
Set the color of the knob's border. More... | |
color & | color_tick () |
Get or set the color of the slider ticks. More... | |
slider & | color_tick (const color &color_tick) |
Set the color of the slider ticks. More... | |
bool & | snap_to_ticks () |
Get or set the property for whether to snap slider movements to the ticks. More... | |
slider & | snap_to_ticks (const bool &snap_to_ticks) |
Set the property for whether to snap slider movements to the ticks. More... | |
bool & | show_tick_marks () |
Get or set the property for whether to show ticks marks on the slider. More... | |
slider & | show_tick_marks (const bool &show_tick_marks) |
Set the property for whether to show ticks marks on the slider. More... | |
bool & | show_tick_labels () |
Get or set the property for whether to show tick labels on the slider. More... | |
slider & | show_tick_labels (const bool &show_tick_labels) |
Set the property for whether to show tick labels on the slider. More... | |
slider_range & | range () |
Get or set the slider's range. More... | |
slider & | range (const slider_range &range) |
Set the slider's range. More... | |
float & | knob_radius () |
Get or set the radius of the knob. More... | |
slider & | knob_radius (const float &knob_radius) |
Set the radius of the knob. More... | |
float & | slide_thickness () |
Get or set the thickness of the slide. More... | |
slider & | slide_thickness (const float &slide_thickness) |
Set the thickness of the slide. More... | |
float & | major_tick_unit () |
Get or set the unit intervals for placing major ticks. More... | |
slider & | major_tick_unit (const float &major_tick_unit) |
Set the unit intervals for placing major ticks, e.g. 25.f. More... | |
long & | minor_tick_count () |
Get or set the number of minor ticks to place between successive major ticks. More... | |
slider & | minor_tick_count (const long &minor_tick_count) |
Set the number of minor ticks to place between successive major ticks, e.g. 4. More... | |
float & | value () |
Get or set the position of the knob along the slide. More... | |
slider & | value (const float &value) |
Set the position of the knob along the slide, e.g. 63.5f. More... | |
![]() | |
widget () | |
Widget constructor. | |
virtual | ~widget () |
Widget descructor. | |
bool | operator== (const widget ¶m) |
Check whether widget's basic specifications are equal. Only those properties that require the widget's basic resources to be re-created are considered. More... | |
bool | operator!= (const widget ¶m) |
Check whether widget's basic specifications are NOT equal. Only those properties that require the widget's basic resources to be re-created are considered. More... | |
virtual std::string & | text ()=0 |
Get or set the widget text. More... | |
virtual std::string & | tooltip ()=0 |
Get or set the widget's tooltip text. More... | |
virtual lecui::rect & | rect ()=0 |
Get or set the position and dimensions of the widget. More... | |
virtual resize_params & | on_resize ()=0 |
Get or set the behaviour of the widget when its container is resized. More... | |
virtual cursor_type & | cursor ()=0 |
Get or set the mouse cursor to use then over the widget. More... | |
virtual std::string & | font ()=0 |
Get or set the default widget font, e.g. "Georgia". More... | |
virtual float & | font_size ()=0 |
Get or set the default widget font size in points, e.g. 9.0f. More... | |
virtual color & | color_text ()=0 |
Get or set the color of the widget's text. More... | |
virtual color & | color_fill ()=0 |
Get or set the fill color of the widget. More... | |
virtual color & | color_hot ()=0 |
Get or set the widget's color when the mouse is hovered over it. More... | |
virtual color & | color_selected ()=0 |
Get or set the widget's color when selected. More... | |
virtual color & | color_disabled ()=0 |
Get or set the widget's color when it's disabled. More... | |
basic_events & | events () |
Widget events. More... | |
const std::string & | alias () |
The widget's alias, either user defined or automatically generated by the library. More... | |
Static Public Member Functions | |
static slider & | add (containers::page &page, const std::string &alias=std::string()) |
Add a slider to a container. More... | |
static slider & | get (form &fm, const std::string &path) |
Get the specifications of a slider. More... | |
Additional Inherited Members | |
![]() | |
enum class | cursor_type { arrow , hand , caret } |
Mouse cursor type. More... | |
![]() | |
std::string | _text |
The widget's text. | |
std::string | _tooltip |
The widget's tooltip text. | |
lecui::rect | _rect |
The widget's rectangle. | |
resize_params | _on_resize = { 0.f, 0.f, 0.f, 0.f } |
The widget's behaviour when container is resized. | |
cursor_type | _cursor = cursor_type::arrow |
The widget's cursor. | |
std::string | _font = "Segoe UI" |
The widget's font. | |
float | _font_size = 9.f |
The widget's font size. | |
color | _color_text = { 0, 0, 0, 255 } |
The color of the widget's text. | |
color | _color_fill = { 0, 120, 170, 255 } |
The fill color of the widget. | |
color | _color_hot = { 0, 120, 170, 255 } |
The color to indicate when the mouse hovers over the widget. | |
color | _color_selected = { 0, 120, 170, 30 } |
The color to indicate when the widget is selected. | |
color | _color_disabled = { 180, 180, 180, 255 } |
The color to indicate when the widget is disabled. | |
Slider widget. To instantiate and add to a container use the add static method.
The slider's orientation is computed automatically based on the its size. If the width is greater than the height it's oriented horizontally, else vertically. With the defaults, the recommended minimum height for horizontal orientation is 35px and the recommended minimum with for vertical orientation is 40px.
|
static |
Add a slider to a container.
page | The container to place the widget in. |
alias | The in-page unique alias, e.g. "volume". |
If an empty alias is given an internally generated random alias will be assigned.
float & liblec::lecui::widgets::slider::border | ( | ) |
Get or set the thickness of the border.
slider & liblec::lecui::widgets::slider::border | ( | const float & | border | ) |
Set the thickness of the border.
border | The border thickness, in pixels. |
color & liblec::lecui::widgets::slider::color_border | ( | ) |
Get or set the color of the border.
Set the color of the border.
color_border | The border color, as defined in color. |
|
overridevirtual |
Get or set the widget's color when it is disabled.
Implements liblec::lecui::widgets::widget.
Set the widget's color when it is disabled.
color_disabled | The color of the widget when it is disabled, as defined in color. |
|
overridevirtual |
Get or set the fill color of the widget.
Implements liblec::lecui::widgets::widget.
Set the fill color of the widget.
color_fill | The fill color. |
|
overridevirtual |
Get or set the widget's color when the mouse is hovered over it.
Implements liblec::lecui::widgets::widget.
Set the widget's color when the mouse is hovered over it.
color_hot | The color. |
color & liblec::lecui::widgets::slider::color_knob | ( | ) |
Get or set the color of the knob.
Set the color of the knob.
color_knob | The color. |
color & liblec::lecui::widgets::slider::color_knob_border | ( | ) |
Get or set the color of the knob's border.
Set the color of the knob's border.
color_knob_border | The color. |
color & liblec::lecui::widgets::slider::color_knob_hot | ( | ) |
Get or set the color of the knob when the mouse is over the slider.
Set the color of the knob when the mouse is over the slider.
color_knob_hot | The color. |
|
overridevirtual |
Get or set the widget's color when selected.
Implements liblec::lecui::widgets::widget.
Set the widget's color when selected.
color_selected | The widget's color when selected. |
|
overridevirtual |
Get or set the color of the widget's text.
Implements liblec::lecui::widgets::widget.
Set the color of the widget's text.
color_text | The color of the widget's text. |
color & liblec::lecui::widgets::slider::color_tick | ( | ) |
Get or set the color of the slider ticks.
Set the color of the slider ticks.
color_tick | The color. |
|
overridevirtual |
Get or set the mouse cursor to use then over the widget.
Implements liblec::lecui::widgets::widget.
slider & liblec::lecui::widgets::slider::cursor | ( | const cursor_type | cursor | ) |
Set the mouse cursor to use when over the widget.
cursor | The cursor type as defined in cursor_type. |
|
inline |
Get or set slider events.
|
overridevirtual |
Get or set the default widget font, e.g. "Georgia".
Implements liblec::lecui::widgets::widget.
slider & liblec::lecui::widgets::slider::font | ( | const std::string & | font | ) |
Set the default widget font.
font | The font's name, e.g. "Georgia". |
|
overridevirtual |
Get or set the default widget font size in points, e.g. 9.0f.
Implements liblec::lecui::widgets::widget.
slider & liblec::lecui::widgets::slider::font_size | ( | const float & | font_size | ) |
Set the widget's font size.
font_size | The font size in points, e.g. 9.0f. |
Get the specifications of a slider.
fm | A reference to the form. |
path | The full path to the widget, e.g. "sample_page/tools_tab_pane/options_tab/volume". |
Throws on failure. For faster coding and more readable code consider calling this static method through the helper macro provided.
float & liblec::lecui::widgets::slider::knob_radius | ( | ) |
Get or set the radius of the knob.
slider & liblec::lecui::widgets::slider::knob_radius | ( | const float & | knob_radius | ) |
Set the radius of the knob.
knob_radius | The knob's radius, in pixels. |
float & liblec::lecui::widgets::slider::major_tick_unit | ( | ) |
Get or set the unit intervals for placing major ticks.
slider & liblec::lecui::widgets::slider::major_tick_unit | ( | const float & | major_tick_unit | ) |
Set the unit intervals for placing major ticks, e.g. 25.f.
major_tick_unit | The unit interval. |
long & liblec::lecui::widgets::slider::minor_tick_count | ( | ) |
Get or set the number of minor ticks to place between successive major ticks.
slider & liblec::lecui::widgets::slider::minor_tick_count | ( | const long & | minor_tick_count | ) |
Set the number of minor ticks to place between successive major ticks, e.g. 4.
minor_tick_count | The number of ticks. |
|
overridevirtual |
Get or set the behaviour of the widget when its container is resized.
Implements liblec::lecui::widgets::widget.
slider & liblec::lecui::widgets::slider::on_resize | ( | const resize_params & | on_resize | ) |
Set the behaviour of the widget when its container is resized.
on_resize | The resize parameters as defined in resize_params. |
bool liblec::lecui::widgets::slider::operator!= | ( | const slider & | param | ) |
Check whether widget specs are NOT equal. Only those properties that require the widget resources to be re-created are considered.
param | The specs to compare to. |
bool liblec::lecui::widgets::slider::operator== | ( | const slider & | param | ) |
Check whether widget specs are equal. Only those properties that require the widget resources to be re-created are considered.
param | The specs to compare to. |
slider_range & liblec::lecui::widgets::slider::range | ( | ) |
Get or set the slider's range.
slider & liblec::lecui::widgets::slider::range | ( | const slider_range & | range | ) |
Set the slider's range.
range | The range. |
|
overridevirtual |
Get or set the position and dimensions of the widget.
The position is in reference to the widget's container.
Implements liblec::lecui::widgets::widget.
slider & liblec::lecui::widgets::slider::rect | ( | const lecui::rect & | rect | ) |
Set the position and dimensions of the widget.
rect | The widget's rectangle. |
bool & liblec::lecui::widgets::slider::show_tick_labels | ( | ) |
Get or set the property for whether to show tick labels on the slider.
slider & liblec::lecui::widgets::slider::show_tick_labels | ( | const bool & | show_tick_labels | ) |
Set the property for whether to show tick labels on the slider.
show_tick_labels | Whether to show tick labels on the slider. |
bool & liblec::lecui::widgets::slider::show_tick_marks | ( | ) |
Get or set the property for whether to show ticks marks on the slider.
slider & liblec::lecui::widgets::slider::show_tick_marks | ( | const bool & | show_tick_marks | ) |
Set the property for whether to show ticks marks on the slider.
show_tick_marks | Whether to show tick marks on the slider. |
float & liblec::lecui::widgets::slider::slide_thickness | ( | ) |
Get or set the thickness of the slide.
slider & liblec::lecui::widgets::slider::slide_thickness | ( | const float & | slide_thickness | ) |
Set the thickness of the slide.
slide_thickness | The thickness of the slide, in pixels. |
bool & liblec::lecui::widgets::slider::snap_to_ticks | ( | ) |
Get or set the property for whether to snap slider movements to the ticks.
slider & liblec::lecui::widgets::slider::snap_to_ticks | ( | const bool & | snap_to_ticks | ) |
Set the property for whether to snap slider movements to the ticks.
snap_to_ticks | Whether to snap slider movements to the ticks. |
|
overridevirtual |
Get or set the widget text.
Implements liblec::lecui::widgets::widget.
slider & liblec::lecui::widgets::slider::text | ( | const std::string & | text | ) |
Set the widget's text.
text | The text. |
|
overridevirtual |
Get or set the widget's tooltip text.
Implements liblec::lecui::widgets::widget.
slider & liblec::lecui::widgets::slider::tooltip | ( | const std::string & | tooltip | ) |
Set the tooltip text.
tooltip | The tooltip text. |
float & liblec::lecui::widgets::slider::value | ( | ) |
Get or set the position of the knob along the slide.
slider & liblec::lecui::widgets::slider::value | ( | const float & | value | ) |
Set the position of the knob along the slide, e.g. 63.5f.
value | The position of the knob. |