class ffw::GuiScrollBar
Class List > ffw :: GuiScrollBar
Create a scroll bar widget. More...
Inherits the following classes: ffw::GuiWidget
Classes
Type | Name |
---|---|
class | ButtonBottom |
class | ButtonLeft |
class | ButtonRight |
class | ButtonTop |
class | Scroll |
struct | Style |
Public Functions
Type | Name |
---|---|
GuiScrollBar (GuiWindow * context, bool vertical) | |
virtual | ~GuiScrollBar () = default |
bool | isVertical () const |
GuiButton * | getButtonFirst () |
const GuiButton * | getButtonFirst () const |
GuiButton * | getButtonSecond () |
const GuiButton * | getButtonSecond () const |
GuiSlider * | getSlider () |
const GuiSlider * | getSlider () const |
void | setValue (const float val) |
float | getValue () const |
const ffw::Pointf & | getRange () const |
void | setRange (const float min, const float max) |
void | setInversed (const bool inversed) |
bool | getInversed () const |
void | setIncrements (float inc) |
float | getIncrements () const |
void | setButtonLength (GuiUnits length) |
GuiUnits | getButtonLength () const |
virtual ffw::Pointf | getMinimumWrapSize () override |
void | setStyle (const GuiScrollBar::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 scrollbar = new ffw::GuiScrollBar(&gui, false);
scrollbar->setSize(ffw::guiPercent(100.0f), ffw::guiPixels(30.0f));
scrollbar->setRange(50.0f, 100.0f);
scrollbar->setIncrements(5.0f); // Affects the left and right buttons
scrollbar->setValue(75.0f); // The scroll button will be in the middle
auto value = scrollbar->getValue(); // Returns 75.0f
scrollbar->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(scrollbar);
// Do not free the created widgets!
// They will be deleted by the gui window!
while(true){
// Render the gui
}
Public Functions Documentation
function GuiScrollBar
ffw::GuiScrollBar::GuiScrollBar (
GuiWindow * context,
bool vertical
)
function ~GuiScrollBar
virtual ffw::GuiScrollBar::~GuiScrollBar () = default
function isVertical
bool ffw::GuiScrollBar::isVertical () const
function getButtonFirst (1/2)
GuiButton * ffw::GuiScrollBar::getButtonFirst ()
function getButtonFirst (2/2)
const GuiButton * ffw::GuiScrollBar::getButtonFirst () const
function getButtonSecond (1/2)
GuiButton * ffw::GuiScrollBar::getButtonSecond ()
function getButtonSecond (2/2)
const GuiButton * ffw::GuiScrollBar::getButtonSecond () const
function getSlider (1/2)
GuiSlider * ffw::GuiScrollBar::getSlider ()
function getSlider (2/2)
const GuiSlider * ffw::GuiScrollBar::getSlider () const
function setValue
void ffw::GuiScrollBar::setValue (
const float val
)
function getValue
float ffw::GuiScrollBar::getValue () const
function getRange
const ffw::Pointf & ffw::GuiScrollBar::getRange () const
function setRange
void ffw::GuiScrollBar::setRange (
const float min,
const float max
)
function setInversed
void ffw::GuiScrollBar::setInversed (
const bool inversed
)
function getInversed
bool ffw::GuiScrollBar::getInversed () const
function setIncrements
void ffw::GuiScrollBar::setIncrements (
float inc
)
function getIncrements
float ffw::GuiScrollBar::getIncrements () const
function setButtonLength
void ffw::GuiScrollBar::setButtonLength (
GuiUnits length
)
function getButtonLength
GuiUnits ffw::GuiScrollBar::getButtonLength () const
function getMinimumWrapSize
virtual ffw::Pointf ffw::GuiScrollBar::getMinimumWrapSize ()
Implements GuiWidget::getMinimumWrapSize
function setStyle
void ffw::GuiScrollBar::setStyle (
const GuiScrollBar::Style * style,
bool defaults = false
)
The documentation for this class was generated from the following file: include/ffw/gui/guiscrollbar.h