class ffw::GuiSlider
Class List > ffw :: GuiSlider
Create a slider widget. More...
Inherits the following classes: ffw::GuiWidget
Inherited by the following classes: ffw::GuiScrollBar::Scroll
Classes
| Type | Name |
|---|---|
| struct | Style |
Protected Attributes
| Type | Name |
|---|---|
| const GuiWidget::Style * | styleButton |
| const GuiWidget::Style * | styleBar |
| Point< GuiUnits > | buttonSize |
| Point< GuiUnits > | barSize |
Public Functions
| Type | Name |
|---|---|
| GuiSlider (GuiWindow * context, bool vertical) | |
| virtual | ~GuiSlider () = default |
| bool | isVertical () const |
| void | setValue (float val) |
| float | getValue () const |
| void | setBarSize (const Point< GuiUnits > & s) |
| const Point< GuiUnits > & | getBarSize () const |
| const ffw::Pointf & | getRange () const |
| void | setRange (float min, float max) |
| void | setButtonSize (const Point< GuiUnits > & s) |
| const Point< GuiUnits > & | getButtonSize () const |
| void | setInversed (bool inversed) |
| bool | getInversed () const |
| virtual ffw::Pointf | getMinimumWrapSize () override |
| void | setBarStyleGroup (const GuiWidget::Style * style) |
| const GuiWidget::Style * | getBarStyleGroup () const |
| void | setButtonStyleGroup (const GuiWidget::Style * style) |
| const GuiWidget::Style * | getButtonStyleGroup () const |
| void | setStyle (const GuiSlider::Style * style, bool defaults = false) |
Detailed Description
auto gui = ffw::GuiWindowNanoVG(nvg);
auto root = gui.getLayout();
// To make it vertical, change the second parameter to true
auto slider = new ffw::GuiSlider(&gui, false);
slider->setSize(ffw::guiPercent(100.0f), ffw::guiPixels(30.0f));
slider->setRange(50.0f, 100.0f);
slider->setValue(75.0f); // The scroll button will be in the middle
auto value = slider->getValue(); // Returns 75.0f
slider->addEventCallback([](ffw::GuiEvent e) {
// The value is between the 50.0 and 100.0 range
std::cout << "Value changed: " << e.data.action.value << std::endl;
}, ffw::GuiEventType::ACTION);
root->addWidget(slider);
// Do not free the created widgets! They will be deleted by the gui window!
while(true){
// Render the gui
}
Protected Attributes Documentation
variable styleButton
const GuiWidget::Style* ffw::GuiSlider::styleButton;
variable styleBar
const GuiWidget::Style* ffw::GuiSlider::styleBar;
variable buttonSize
Point<GuiUnits> ffw::GuiSlider::buttonSize;
variable barSize
Point<GuiUnits> ffw::GuiSlider::barSize;
Public Functions Documentation
function GuiSlider
ffw::GuiSlider::GuiSlider (
GuiWindow * context,
bool vertical
)
function ~GuiSlider
virtual ffw::GuiSlider::~GuiSlider () = default
function isVertical
bool ffw::GuiSlider::isVertical () const
function setValue
void ffw::GuiSlider::setValue (
float val
)
function getValue
float ffw::GuiSlider::getValue () const
function setBarSize
void ffw::GuiSlider::setBarSize (
const Point< GuiUnits > & s
)
function getBarSize
const Point< GuiUnits > & ffw::GuiSlider::getBarSize () const
function getRange
const ffw::Pointf & ffw::GuiSlider::getRange () const
function setRange
void ffw::GuiSlider::setRange (
float min,
float max
)
function setButtonSize
void ffw::GuiSlider::setButtonSize (
const Point< GuiUnits > & s
)
function getButtonSize
const Point< GuiUnits > & ffw::GuiSlider::getButtonSize () const
function setInversed
void ffw::GuiSlider::setInversed (
bool inversed
)
function getInversed
bool ffw::GuiSlider::getInversed () const
function getMinimumWrapSize
virtual ffw::Pointf ffw::GuiSlider::getMinimumWrapSize ()
Implements GuiWidget::getMinimumWrapSize
function setBarStyleGroup
void ffw::GuiSlider::setBarStyleGroup (
const GuiWidget::Style * style
)
function getBarStyleGroup
const GuiWidget::Style * ffw::GuiSlider::getBarStyleGroup () const
function setButtonStyleGroup
void ffw::GuiSlider::setButtonStyleGroup (
const GuiWidget::Style * style
)
function getButtonStyleGroup
const GuiWidget::Style * ffw::GuiSlider::getButtonStyleGroup () const
function setStyle
void ffw::GuiSlider::setStyle (
const GuiSlider::Style * style,
bool defaults = false
)
The documentation for this class was generated from the following file: include/ffw/gui/guislider.h