Luanti 5.16.0-dev
Loading...
Searching...
No Matches
GUIScrollBar Class Referencefinal

#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 override
s32 getMin () const override
s32 getLargeStep () const override
s32 getSmallStep () const override
s32 getPos () const override
s32 getTargetPos () const override
bool isHorizontal () const
void setMax (s32 max) override
void setMin (s32 min) override
void setSmallStep (s32 step) override
void setLargeStep (s32 step) override
void setPos (const s32 pos) override
 Sets a position immediately, aborting any ongoing interpolation.
void setPosAndSend (s32 pos)
 The same as setPos, but it takes care of sending EGET_SCROLL_BAR_CHANGED events.
void setPosInterpolated (s32 pos) override
 Sets a target position for interpolation.
void setPageSize (s32 size) override
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
u32 m_arrow_counter = 0
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 border_size, down_button, drag_offset, dragged_by_slider, draw_center, is_auto_scaling, is_dragging, is_horizontal, large_step, m_tsrc, max_pos, min_pos, page_size, refreshControls(), scroll_pos, setPos(), small_step, thumb_size, tray_clicked, and up_button.

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
inlineoverride

References large_step.

◆ getMax()

s32 GUIScrollBar::getMax ( ) const
inlineoverride

References max_pos.

Referenced by GUIFormSpecMenu::autoScroll().

Here is the caller graph for this function:

◆ getMin()

s32 GUIScrollBar::getMin ( ) const
inlineoverride

References min_pos.

Referenced by GUIFormSpecMenu::autoScroll().

Here is the caller graph for this function:

◆ getPos()

s32 GUIScrollBar::getPos ( ) const
override

References scroll_pos.

Referenced by GUIFormSpecMenu::acceptInput(), and GUIFormSpecMenu::autoScroll().

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
inlineoverride

References small_step.

◆ getTargetPos()

s32 GUIScrollBar::getTargetPos ( ) const
override

References max_pos, min_pos, scroll_pos, and target_pos.

Referenced by OnEvent(), and OnPostRender().

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.

◆ OnEvent()

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

References 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, and tray_clicked.

Here is the call graph for this function:

◆ OnPostRender()

void GUIScrollBar::OnPostRender ( u32 time_ms)
overridevirtual

References down_button, porting::getDeltaMs(), getTargetPos(), interpolatePos(), last_delta_ms, last_time_ms, m_arrow_counter, setPosInterpolated(), small_step, and up_button.

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 ( s32 step)
override

References large_step.

Referenced by GUIFormSpecMenu::parseScrollBar().

Here is the caller graph for this function:

◆ setMax()

void GUIScrollBar::setMax ( s32 max)
override

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

Referenced by GUIFormSpecMenu::parseScrollBar().

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

◆ setMin()

void GUIScrollBar::setMin ( s32 min)
override

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

Referenced by GUIFormSpecMenu::parseScrollBar().

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

◆ setPageSize()

void GUIScrollBar::setPageSize ( s32 size)
override

References page_size, and updatePos().

Referenced by GUIFormSpecMenu::parseScrollBar().

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

◆ setPos()

void GUIScrollBar::setPos ( const s32 pos)
override

Sets a position immediately, aborting any ongoing interpolation.

References setPosRaw(), and target_pos.

Referenced by GUIScrollBar(), GUIFormSpecMenu::autoScroll(), GUIFormSpecMenu::parseScrollBar(), and setPosAndSend().

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

◆ setPosAndSend()

void GUIScrollBar::setPosAndSend ( 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 ( s32 pos)
override

Sets a target position for interpolation.

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

Referenced by OnEvent(), and OnPostRender().

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 ( s32 step)
override

References small_step.

Referenced by GUIFormSpecMenu::parseScrollBar().

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

◆ dragged_by_slider

bool GUIScrollBar::dragged_by_slider
private

◆ draw_center

s32 GUIScrollBar::draw_center
private

Referenced by GUIScrollBar(), draw(), and setPosRaw().

◆ is_auto_scaling

bool GUIScrollBar::is_auto_scaling
private

Referenced by GUIScrollBar(), and setPosRaw().

◆ is_dragging

bool GUIScrollBar::is_dragging
private

Referenced by GUIScrollBar(), and OnEvent().

◆ is_horizontal

bool GUIScrollBar::is_horizontal
private

◆ large_step

s32 GUIScrollBar::large_step
private

◆ 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_arrow_counter

u32 GUIScrollBar::m_arrow_counter = 0
private

Referenced by OnPostRender().

◆ m_tsrc

ISimpleTextureSource* GUIScrollBar::m_tsrc
private

Referenced by GUIScrollBar(), and refreshControls().

◆ max_pos

s32 GUIScrollBar::max_pos
private

◆ min_pos

◆ page_size

s32 GUIScrollBar::page_size
private

◆ scroll_pos

◆ slider_rect

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

Referenced by draw(), and OnEvent().

◆ small_step

s32 GUIScrollBar::small_step
private

◆ 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 GUIScrollBar(), and OnEvent().

◆ up_button

IGUIButton* GUIScrollBar::up_button
private

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