AScrollBar
- Module
- Arc
- Header
#include "Arc/Widgets/AScrollBox.h"- Namespace
Arcf
Type aliases
| Alias | Description |
|---|---|
using COnScrolled = ArcDelegate<void(float )> | Callback when user drags the scrollbar |
Properties
| Type | Name | Description |
|---|---|---|
static constexpr float | HIDE_DELAY | Seconds an AutoHide bar stays up after the last scroll. Default 0.8f. |
COnScrolled | OnScrolled | |
static constexpr float | MIN_THUMB_SIZE | Below this a thumb is a sliver nobody can hit, so paint and hit test both clamp to it — which is why the thumb's travel is derived from the clamped length and never from the raw fraction. Default 24.0f. |
Public functions
| Returns | Name | Description |
|---|---|---|
ARC_WIDGET_ARGS | ||
WidgetArgsType& | Visibility | |
ARC_WIDGET_ARGS_END | ||
ArcVec2 | ComputeDesiredSize | |
int32_t | OnPaint | |
CReply | OnMouseButtonDown | |
CReply | OnMouseButtonUp | |
CReply | OnMouseMove | |
void | OnMouseEnter | |
void | OnMouseLeave | |
void | OnMouseCaptureLost | |
EArcCursorType | OnCursorQuery | |
EHitTestResult | OnHitTest | A bar with nothing to scroll is out of the pointer path entirely. |
void | SetScrollState | Set scroll state (0..1 range) |
float | GetScrollOffset | |
float | GetThumbFraction | |
bool | IsDraggingThumb | |
bool | IsPagingTrack | |
void | AdvanceRepeat | Runs the hold-to-repeat page timer. |
void | AdvanceFade | Runs the AutoHide fade. |
float | GetFadeOpacity | 0 hidden, 1 fully shown; AlwaysVisible is always 1. |
bool | WantsToShow | True while something asks the bar to be shown: a recent scroll, the pointer over the bar or its scroll area, or a drag or page in hand. |
EScrollBarVisibility | GetVisibility | |
bool | CanCacheDesiredSize | Its thickness on one axis and nothing on the other; the thumb is a fraction of the track, not a size input. |
const char* | GetTypeName |
Function details
ARC_WIDGET_ARGS
ARC_WIDGET_ARGS(AScrollBar) ARC_ARG(EOrientation, Orientation) EScrollBarVisibility _Visibility = EScrollBarVisibility::AutoHideVisibility
WidgetArgsType& Visibility(EScrollBarVisibility value)ARC_WIDGET_ARGS_END
ARC_WIDGET_ARGS_END() void Construct(const CArguments& args)ComputeDesiredSize
ArcVec2 ComputeDesiredSize(float scale) const overrideOnPaint
int32_t OnPaint(const CArcPaintArgs& args, const CGeometry& geo, CArcUIRenderer& renderer, int32_t layerId) const overrideOnMouseButtonDown
CReply OnMouseButtonDown(const CGeometry& geo, const CPointerEvent& event) overrideOnMouseButtonUp
CReply OnMouseButtonUp(const CGeometry& geo, const CPointerEvent& event) overrideOnMouseMove
CReply OnMouseMove(const CGeometry& geo, const CPointerEvent& event) overrideOnMouseEnter
void OnMouseEnter(const CGeometry& geo, const CPointerEvent& event) overrideOnMouseLeave
void OnMouseLeave(const CPointerEvent& event) overrideOnMouseCaptureLost
void OnMouseCaptureLost() overrideOnCursorQuery
EArcCursorType OnCursorQuery(const CGeometry& geo, const CPointerEvent& event) const overrideOnHitTest
EHitTestResult OnHitTest(const CGeometry& geo, const ArcVec2& absolutePosition) const overrideA bar with nothing to scroll is out of the pointer path entirely. Its slot is a gutter reserved over the content, and claiming the hit there left the rightmost strip of every list dead to the mouse.
SetScrollState
void SetScrollState(float offset, float thumbFraction)Set scroll state (0..1 range)
GetScrollOffset
float GetScrollOffset() constGetThumbFraction
float GetThumbFraction() constIsDraggingThumb
bool IsDraggingThumb() constIsPagingTrack
bool IsPagingTrack() constAdvanceRepeat
void AdvanceRepeat(float deltaSeconds) constRuns the hold-to-repeat page timer. OnPaint feeds it the frame delta, which is the only clock a widget has here; a headless test drives it directly instead of pretending to paint.
AdvanceFade
void AdvanceFade(float deltaSeconds) constRuns the AutoHide fade. OnPaint feeds it the frame delta; a headless test drives it directly.
GetFadeOpacity
float GetFadeOpacity() const0 hidden, 1 fully shown; AlwaysVisible is always 1.
WantsToShow
bool WantsToShow() constTrue while something asks the bar to be shown: a recent scroll, the pointer over the bar or its scroll area, or a drag or page in hand.
GetVisibility
EScrollBarVisibility GetVisibility() constCanCacheDesiredSize
bool CanCacheDesiredSize() const overrideIts thickness on one axis and nothing on the other; the thumb is a fraction of the track, not a size input.
GetTypeName
const char* GetTypeName() const override