class GUISliderHandle

A handle that can be dragged from its predefined minimum and maximum position, either horizontally or vertically.

Public

Methods

staticGetGuiTypeName

static const String &GetGuiTypeName()

Returns type name of the GUI element used for finding GUI element styles.

GetStyleSheetElement

const char *GetStyleSheetElement() const override

Returns the name of the GUI element type to be used for style lookup in the style sheet.

GetHandlePositionInPercent

float GetHandlePositionInPercent() const

Gets the current position of the handle, in percent ranging [0.0f, 1.0f].

GetMinimumStepIncrement

float GetMinimumStepIncrement() const

Gets the minimum percentual variation of the handle position

GetHandlePositionInPixels

GUIPhysicalUnit GetHandlePositionInPixels() const

Returns the position of the slider handle, in pixels.

Relative to this object.

GetScrollableLength

GUIPhysicalUnit GetScrollableLength() const

Returns remaining length of the scrollable area not covered by the handle, in pixels.

GetTotalLength

GUIPhysicalUnit GetTotalLength() const

Returns the total length of the area the handle can move in, in pixels.

SetMinimumStepIncrement

void SetMinimumStepIncrement(float step)

Sets a step that defines the minimal increment the value can be increased/decreased by.

Set to zero to have no step. In percent.

MoveOneStep

void MoveOneStep(bool forward)

Moves the slider handle one step forwards or backwards.

Step size is determined by step (if set) or handle size otherwise. If is true the handle is moved one step forward, otherwise one step backward.

staticCreate

static GUIElementType *Create(const ContentType &contents, const String &styleClass, const TInlineArray<GUIOption, 4> &options)

Creates a new GUI element.

contents
Structure describing the contents of the GUI element to create.
styleClass
Style class that will be used for determining GUI element visuals from the current style sheet. If no class is provided, default style is determined based on GUI element type.
options
Additional options that control GUI element size and position. This will override options set in the style sheet.

Fields

OnHandleMovedOrResized

Event<void (float, float)> OnHandleMovedOrResized

Triggered when the user drags the handle.

Internal

Constructors

GUISliderHandle

GUISliderHandle(PrivatelyConstruct, GUISliderHandleContent content, const String &styleName, const GUISizeConstraints &sizeConstraints)

Methods

GetHandleSizeInPercent

float GetHandleSizeInPercent() const

Returns the size of the slider handle, in percent of the total area.

GetHandleSizeInPixels

GUIPhysicalUnit GetHandleSizeInPixels() const

Returns the size of the handle button, in pixels.

SetHandleSizeInPercent

void SetHandleSizeInPercent(float percent)

Size of the handle in percent of the total draggable area, along the handle drag direction.

percent
Size of the handle, in percent ranging [0.0f, 1.0f]

SetHandlePositionInPercent

void SetHandlePositionInPercent(float percent)

Moves the handle the the specified position in the handle area.

percent
Position to move the handle to, in percent ranging [0.0f, 1.0f]

SetHandlePositionInPixels

void SetHandlePositionInPixels(GUIPhysicalUnit position)

Sets the position of the slider handle, in pixels.

Relative to this object.

CalculateUnconstrainedOptimalSize

GUILogicalSize CalculateUnconstrainedOptimalSize() const override

Calculates the optimal size for the GUI element, ignoring size constraints.

Protected

Methods

UpdateRenderElements

void UpdateRenderElements() override

Recreates the internal render elements.

Must be called before GetRenderElementVertexAndIndexData/FillBuffer if element is dirty. Marks the element as non dirty.

Private

Methods

DoOnMouseEvent

bool DoOnMouseEvent(const GUIMouseEvent &ev) override

Called when a mouse event is received on any GUI element the mouse is interacting with.

Return true if you have processed the event and don't want other elements to process it.

IsOnHandle

bool IsOnHandle(const GUIPhysicalPoint &position) const

Checks are the specified over the scroll handle.

Coordinates are relative to the parent widget.

Fields

mBackgroundSprite

GUIBackgroundSprite mBackgroundSprite

mFlags

GUISliderHandleFlags mFlags

mHandlePositionInPercent

float mHandlePositionInPercent

mHandleSizeInPercent

float mHandleSizeInPercent

mMinimumStepIncrement

float mMinimumStepIncrement

mDragStartPos

GUIPhysicalUnit mDragStartPos

mDragState

DragState mDragState

mMouseOverHandle

bool mMouseOverHandle

mHandleDragged

bool mHandleDragged

mState