Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
GUIScrollBar Class Reference

#include <guiScrollBar.h>

+ Inheritance diagram for GUIScrollBar:
+ Collaboration diagram for GUIScrollBar:

Public Types

enum  ArrowVisibility { HIDE , SHOW , DEFAULT }
 

Public Member Functions

 GUIScrollBar (IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect< s32 > rectangle, bool horizontal, bool auto_scale, ISimpleTextureSource *tsrc)
 
virtual void draw () override
 
virtual void updateAbsolutePosition () override
 
virtual bool OnEvent (const SEvent &event) override
 
virtual void OnPostRender (u32 time_ms) override
 
s32 getMax () const
 
s32 getMin () const
 
s32 getLargeStep () const
 
s32 getSmallStep () const
 
s32 getPos () const
 
s32 getTargetPos () const
 
bool isHorizontal () const
 
void setMax (const s32 &max)
 
void setMin (const s32 &min)
 
void setSmallStep (const s32 &step)
 
void setLargeStep (const s32 &step)
 
void setPos (const s32 &pos)
 Sets a position immediately, aborting any ongoing interpolation.
 
void setPosAndSend (const s32 &pos)
 The same as setPos, but it takes care of sending EGET_SCROLL_BAR_CHANGED events.
 
void setPosInterpolated (const s32 &pos)
 Sets a target position for interpolation.
 
void setPageSize (const s32 &size)
 
void setArrowsVisible (ArrowVisibility visible)
 

Private Member Functions

void refreshControls ()
 
s32 getPosFromMousePos (const core::position2di &p) const
 
f32 range () const
 
void setPosRaw (const s32 &pos)
 
void updatePos ()
 
void interpolatePos ()
 

Private Attributes

IGUIButton * up_button
 
IGUIButton * down_button
 
ArrowVisibility arrow_visibility = DEFAULT
 
bool is_dragging
 
bool is_horizontal
 
bool is_auto_scaling
 
bool dragged_by_slider
 
bool tray_clicked
 
s32 scroll_pos
 
s32 draw_center
 
s32 thumb_size
 
s32 min_pos
 
s32 max_pos
 
s32 small_step
 
s32 large_step
 
s32 drag_offset
 
s32 page_size
 
s32 border_size
 
core::rect< s32 > slider_rect
 
video::SColor current_icon_color
 
ISimpleTextureSourcem_tsrc
 
std::optional< s32 > target_pos
 
u32 last_time_ms = 0
 
u32 last_delta_ms = 17
 

Member Enumeration Documentation

◆ ArrowVisibility

Enumerator
HIDE 
SHOW 
DEFAULT 

Constructor & Destructor Documentation

◆ GUIScrollBar()

GUIScrollBar::GUIScrollBar ( IGUIEnvironment * environment,
IGUIElement * parent,
s32 id,
core::rect< s32 > rectangle,
bool horizontal,
bool auto_scale,
ISimpleTextureSource * tsrc )

References refreshControls(), and setPos().

+ Here is the call graph for this function:

Member Function Documentation

◆ draw()

void GUIScrollBar::draw ( )
overridevirtual

References current_icon_color, draw_center, is_horizontal, range(), refreshControls(), slider_rect, and thumb_size.

+ Here is the call graph for this function:

◆ getLargeStep()

s32 GUIScrollBar::getLargeStep ( ) const
inline

References large_step.

◆ getMax()

s32 GUIScrollBar::getMax ( ) const
inline

References max_pos.

Referenced by GUIEditBox::updateVScrollBar().

+ Here is the caller graph for this function:

◆ getMin()

s32 GUIScrollBar::getMin ( ) const
inline

References min_pos.

◆ getPos()

s32 GUIScrollBar::getPos ( ) const

References scroll_pos.

Referenced by GUIFormSpecMenu::acceptInput(), GUITable::autoScroll(), GUITable::draw(), GUITable::getDynamicData(), GUITable::getRowAt(), GUIHyperText::OnEvent(), GUIScrollContainer::updateScrolling(), and GUIEditBox::updateVScrollBar().

+ Here is the caller graph for this function:

◆ getPosFromMousePos()

s32 GUIScrollBar::getPosFromMousePos ( const core::position2di & p) const
private

References border_size, drag_offset, dragged_by_slider, is_horizontal, min_pos, p(), range(), and thumb_size.

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSmallStep()

s32 GUIScrollBar::getSmallStep ( ) const
inline

References small_step.

Referenced by GUIHyperText::OnEvent(), and GUIEditBox::processMouse().

+ Here is the caller graph for this function:

◆ getTargetPos()

s32 GUIScrollBar::getTargetPos ( ) const

References max_pos, min_pos, scroll_pos, and target_pos.

Referenced by GUIHyperText::OnEvent(), OnEvent(), GUITable::OnEvent(), and GUIEditBox::processMouse().

+ Here is the caller graph for this function:

◆ interpolatePos()

void GUIScrollBar::interpolatePos ( )
private

References interpolate_scroll(), last_delta_ms, scroll_pos, setPosRaw(), and target_pos.

Referenced by OnPostRender(), and setPosInterpolated().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isHorizontal()

bool GUIScrollBar::isHorizontal ( ) const
inline

References is_horizontal.

Referenced by GUIScrollContainer::setScrollBar().

+ Here is the caller graph for this function:

◆ OnEvent()

bool GUIScrollBar::OnEvent ( const SEvent & event)
overridevirtual

References down_button, drag_offset, dragged_by_slider, getPosFromMousePos(), getTargetPos(), is_dragging, is_horizontal, large_step, max_pos, min_pos, p(), setPosAndSend(), setPosInterpolated(), slider_rect, small_step, thumb_size, tray_clicked, and up_button.

Referenced by GUIScrollContainer::OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OnPostRender()

void GUIScrollBar::OnPostRender ( u32 time_ms)
overridevirtual

References porting::getDeltaMs(), interpolatePos(), last_delta_ms, and last_time_ms.

+ Here is the call graph for this function:

◆ range()

f32 GUIScrollBar::range ( ) const
inlineprivate

References max_pos, and min_pos.

Referenced by draw(), getPosFromMousePos(), setMax(), setMin(), and setPosRaw().

+ Here is the caller graph for this function:

◆ refreshControls()

void GUIScrollBar::refreshControls ( )
private

References GUIButton::addButton(), arrow_visibility, border_size, current_icon_color, DEFAULT, down_button, HIDE, is_horizontal, m_tsrc, and up_button.

Referenced by GUIScrollBar(), draw(), setArrowsVisible(), and updateAbsolutePosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setArrowsVisible()

void GUIScrollBar::setArrowsVisible ( ArrowVisibility visible)

References arrow_visibility, and refreshControls().

Referenced by GUIFormSpecMenu::parseScrollBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLargeStep()

void GUIScrollBar::setLargeStep ( const s32 & step)

References large_step.

Referenced by GUIEditBoxWithScrollBar::createVScrollBar(), GUIHyperText::draw(), GUIFormSpecMenu::parseScrollBar(), and GUITable::updateScrollBar().

+ Here is the caller graph for this function:

◆ setMax()

void GUIScrollBar::setMax ( const s32 & max)

References down_button, max_pos, min_pos, range(), up_button, and updatePos().

Referenced by GUIHyperText::draw(), GUIFormSpecMenu::parseScrollBar(), GUIScrollContainer::setScrollBar(), GUITable::updateScrollBar(), and GUIEditBox::updateVScrollBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMin()

void GUIScrollBar::setMin ( const s32 & min)

References down_button, max_pos, min_pos, range(), up_button, and updatePos().

Referenced by GUIFormSpecMenu::parseScrollBar(), and GUIScrollContainer::setScrollBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPageSize()

void GUIScrollBar::setPageSize ( const s32 & size)

References page_size, and updatePos().

Referenced by GUIHyperText::draw(), GUIFormSpecMenu::parseScrollBar(), GUIScrollContainer::setScrollBar(), GUITable::updateScrollBar(), and GUIEditBox::updateVScrollBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPos()

void GUIScrollBar::setPos ( const s32 & pos)

Sets a position immediately, aborting any ongoing interpolation.

References setPosRaw(), and target_pos.

Referenced by GUIScrollBar(), GUITable::GUITable(), GUITable::autoScroll(), GUIEditBoxWithScrollBar::calculateScrollPos(), GUIHyperText::draw(), GUIFormSpecMenu::parseScrollBar(), GUITable::setDynamicData(), setPosAndSend(), and GUIEditBox::updateVScrollBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPosAndSend()

void GUIScrollBar::setPosAndSend ( const s32 & pos)

The same as setPos, but it takes care of sending EGET_SCROLL_BAR_CHANGED events.

References scroll_pos, and setPos().

Referenced by OnEvent(), and setPosInterpolated().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPosInterpolated()

void GUIScrollBar::setPosInterpolated ( const s32 & pos)

Sets a target position for interpolation.

References g_settings, Settings::getBool(), interpolatePos(), max_pos, min_pos, scroll_pos, setPosAndSend(), and target_pos.

Referenced by GUIHyperText::OnEvent(), OnEvent(), GUITable::OnEvent(), and GUIEditBox::processMouse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPosRaw()

void GUIScrollBar::setPosRaw ( const s32 & pos)
private

References border_size, draw_center, is_auto_scaling, is_horizontal, max_pos, min_pos, page_size, range(), S32_MAX, scroll_pos, and thumb_size.

Referenced by interpolatePos(), setPos(), and updatePos().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSmallStep()

void GUIScrollBar::setSmallStep ( const s32 & step)

References small_step.

Referenced by GUIEditBoxWithScrollBar::createVScrollBar(), GUIHyperText::draw(), GUIFormSpecMenu::parseScrollBar(), and GUITable::updateScrollBar().

+ Here is the caller graph for this function:

◆ updateAbsolutePosition()

void GUIScrollBar::updateAbsolutePosition ( )
overridevirtual

References refreshControls(), and updatePos().

+ Here is the call graph for this function:

◆ updatePos()

void GUIScrollBar::updatePos ( )
private

References scroll_pos, and setPosRaw().

Referenced by setMax(), setMin(), setPageSize(), and updateAbsolutePosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ arrow_visibility

ArrowVisibility GUIScrollBar::arrow_visibility = DEFAULT
private

◆ border_size

s32 GUIScrollBar::border_size
private

◆ current_icon_color

video::SColor GUIScrollBar::current_icon_color
private

Referenced by draw(), and refreshControls().

◆ down_button

IGUIButton* GUIScrollBar::down_button
private

◆ drag_offset

s32 GUIScrollBar::drag_offset
private

Referenced by getPosFromMousePos(), and OnEvent().

◆ dragged_by_slider

bool GUIScrollBar::dragged_by_slider
private

Referenced by getPosFromMousePos(), and OnEvent().

◆ draw_center

s32 GUIScrollBar::draw_center
private

Referenced by draw(), and setPosRaw().

◆ is_auto_scaling

bool GUIScrollBar::is_auto_scaling
private

Referenced by setPosRaw().

◆ is_dragging

bool GUIScrollBar::is_dragging
private

Referenced by OnEvent().

◆ is_horizontal

bool GUIScrollBar::is_horizontal
private

◆ large_step

s32 GUIScrollBar::large_step
private

Referenced by getLargeStep(), OnEvent(), and setLargeStep().

◆ last_delta_ms

u32 GUIScrollBar::last_delta_ms = 17
private

Referenced by interpolatePos(), and OnPostRender().

◆ last_time_ms

u32 GUIScrollBar::last_time_ms = 0
private

Referenced by OnPostRender().

◆ m_tsrc

ISimpleTextureSource* GUIScrollBar::m_tsrc
private

Referenced by refreshControls().

◆ max_pos

s32 GUIScrollBar::max_pos
private

◆ min_pos

s32 GUIScrollBar::min_pos
private

◆ page_size

s32 GUIScrollBar::page_size
private

Referenced by setPageSize(), and setPosRaw().

◆ scroll_pos

s32 GUIScrollBar::scroll_pos
private

◆ slider_rect

core::rect<s32> GUIScrollBar::slider_rect
private

Referenced by draw(), and OnEvent().

◆ small_step

s32 GUIScrollBar::small_step
private

Referenced by getSmallStep(), OnEvent(), and setSmallStep().

◆ target_pos

std::optional<s32> GUIScrollBar::target_pos
private

◆ thumb_size

s32 GUIScrollBar::thumb_size
private

◆ tray_clicked

bool GUIScrollBar::tray_clicked
private

Referenced by OnEvent().

◆ up_button

IGUIButton* GUIScrollBar::up_button
private

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