TGUI  1.5
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.
 
TGUI_NODISCARD 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.
 
TGUI_NODISCARD 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.
 
TGUI_NODISCARD Scrollbar::Policy getPolicy () const
 Returns when the scrollbar should be displayed.
 
TGUI_NODISCARD unsigned int getMaximum () const
 Returns the current maximum of the scrollbar.
 
TGUI_NODISCARD unsigned int getViewportSize () const
 Returns the current viewport size of the scrollbar.
 
TGUI_NODISCARD unsigned int getMaxValue () const
 Returns the current maximum value of the scrollbar.
 
TGUI_NODISCARD bool isShown () const
 Returns whether the scrollbar is currently visible.
 
TGUI_NODISCARD 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()

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

Returns the current maximum of the scrollbar.

Returns
The current maximum
See also
Scrollbar::getMaximum

◆ getMaxValue()

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

Returns the current maximum value of the scrollbar.

Returns
The current maximum value
See also
Scrollbar::getMaxValue

◆ getPolicy()

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

Returns when the scrollbar should be displayed.

Returns
The policy for displaying the scrollbar

◆ getScrollAmount()

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

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()

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

Returns the current value of the scrollbar.

Returns
The current value
See also
Scrollbar::getValue

◆ getViewportSize()

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

Returns the current viewport size of the scrollbar.

Returns
The current viewport size
See also
Scrollbar::getViewportSize

◆ getWidth()

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

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()

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

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: