TGUI  1.7
Loading...
Searching...
No Matches
tgui::ScrollbarAccessor Class Reference

Class returned by widgets that have a scrollbar to let the user access scrollbar properties. More...

#include <TGUI/Widgets/Scrollbar.hpp>

Public Member Functions

 ScrollbarAccessor (ScrollbarChildWidget &scrollbar, std::function< void()> valueChangedCallback, std::function< void()> policyChangedCallback, std::function< void()> scrollAmountChangedCallback)
 Constructor.
 
void setValue (unsigned int value)
 Changes the current value of the scrollbar.
 
unsigned int getValue () const
 Returns the current value of the scrollbar.
 
void setScrollAmount (unsigned int scrollAmount)
 Changes how much the value changes when scrolling or pressing one of the arrows of the scrollbar.
 
unsigned int getScrollAmount () const
 Returns how much the value changes when scrolling or pressing one of the arrows of the scrollbar.
 
void setPolicy (Scrollbar::Policy policy)
 Changes when the scrollbar should be displayed.
 
Scrollbar::Policy getPolicy () const
 Returns when the scrollbar should be displayed.
 
unsigned int getMaximum () const
 Returns the current maximum of the scrollbar.
 
unsigned int getViewportSize () const
 Returns the current viewport size of the scrollbar.
 
unsigned int getMaxValue () const
 Returns the current maximum value of the scrollbar.
 
bool isShown () const
 Returns whether the scrollbar is currently visible.
 
float getWidth () const
 Returns the width of the scrollbar.
 

Detailed Description

Class returned by widgets that have a scrollbar to let the user access scrollbar properties.

Since
TGUI 1.5

Constructor & Destructor Documentation

◆ ScrollbarAccessor()

tgui::ScrollbarAccessor::ScrollbarAccessor ( ScrollbarChildWidget & scrollbar,
std::function< void()> valueChangedCallback,
std::function< void()> policyChangedCallback,
std::function< void()> scrollAmountChangedCallback )

Constructor.

Parameters
scrollbarThe scrollbar to which this class provides access
valueChangedCallbackFunction to be called when setValue is called on this class
policyChangedCallbackFunction to be called when setPolicy is called on this class
scrollAmountChangedCallbackFunction to be called when setScrollAmount is called on this class

Member Function Documentation

◆ getMaximum()

unsigned int tgui::ScrollbarAccessor::getMaximum ( ) const
nodiscard

Returns the current maximum of the scrollbar.

Returns
The current maximum
See also
Scrollbar::getMaximum

◆ getMaxValue()

unsigned int tgui::ScrollbarAccessor::getMaxValue ( ) const
nodiscard

Returns the current maximum value of the scrollbar.

Returns
The current maximum value
See also
Scrollbar::getMaxValue

◆ getPolicy()

Scrollbar::Policy tgui::ScrollbarAccessor::getPolicy ( ) const
nodiscard

Returns when the scrollbar should be displayed.

Returns
The policy for displaying the scrollbar

◆ getScrollAmount()

unsigned int tgui::ScrollbarAccessor::getScrollAmount ( ) const
nodiscard

Returns how much the value changes when scrolling or pressing one of the arrows of the scrollbar.

Returns
How far should the scrollbar scroll when an arrow is clicked?

◆ getValue()

unsigned int tgui::ScrollbarAccessor::getValue ( ) const
nodiscard

Returns the current value of the scrollbar.

Returns
The current value
See also
Scrollbar::getValue

◆ getViewportSize()

unsigned int tgui::ScrollbarAccessor::getViewportSize ( ) const
nodiscard

Returns the current viewport size of the scrollbar.

Returns
The current viewport size
See also
Scrollbar::getViewportSize

◆ getWidth()

float tgui::ScrollbarAccessor::getWidth ( ) const
nodiscard

Returns the width of the scrollbar.

Returns
Scrollbar width. This is size.x for a vertical scrollbar, but size.y for a horizontal scrollbar.

The width of the scrollbar can be changed via the renderer of the widget that contains the scrollbar:

widget->getRenderer()->setScrollbarWidth(width);

◆ isShown()

bool tgui::ScrollbarAccessor::isShown ( ) const
nodiscard

Returns whether the scrollbar is currently visible.

Returns
Is the scrollbar visible?
See also
Scrollbar::isShown

◆ setPolicy()

void tgui::ScrollbarAccessor::setPolicy ( Scrollbar::Policy policy)

Changes when the scrollbar should be displayed.

Parameters
policyThe policy for displaying the scrollbar

◆ setScrollAmount()

void tgui::ScrollbarAccessor::setScrollAmount ( unsigned int scrollAmount)

Changes how much the value changes when scrolling or pressing one of the arrows of the scrollbar.

Parameters
scrollAmountHow far should the scrollbar scroll when an arrow is clicked?
Warning
Widgets may overwrite this value when e.g. the text size changes

◆ setValue()

void tgui::ScrollbarAccessor::setValue ( unsigned int value)

Changes the current value of the scrollbar.

Parameters
valueThe new value
See also
Scrollbar::setValue

The documentation for this class was generated from the following file: