18#include <AUI/Util/ALayoutDirection.h>
19#include <AUI/Common/ATimer.h>
20#include "AViewContainer.h"
21#include "ASpacerExpanding.h"
25class AScrollbarButton:
public AView {
31class AScrollbarHandle:
public AView {
friend class API_AUI_VIEWS AScrollbar;
33 int mScrollOffset = 0;
34 bool mDragging =
false;
37 void setSize(glm::ivec2
size)
override;
41 void setOverridenSize(
int overridenSize) {
42 mOverridenSize = overridenSize;
46 explicit AScrollbarHandle(AScrollbar& scrollbar) : mScrollbar(scrollbar) {}
48 AScrollbar& mScrollbar;
52class AScrollbarOffsetSpacer:
public ASpacerExpanding {
54 AScrollbarOffsetSpacer(): ASpacerExpanding(0, 0) {
58 int getMinimumWidth()
override {
62 int getMinimumHeight()
override {
73class API_AUI_VIEWS AScrollbar:
public AViewContainerBase {
74 friend class AScrollbarHandle;
77 explicit AScrollbar(ALayoutDirection direction = ALayoutDirection::VERTICAL);
79 [[nodiscard]]
int getCurrentScroll()
const {
80 return mCurrentScroll;
83 void setScrollDimensions(
size_t viewportSize,
size_t fullSize);
84 void updateScrollHandleSize();
85 void setScroll(
int scroll);
87 void scroll(
int delta)
noexcept {
88 setScroll(mCurrentScroll + delta);
104 mStickToEnd = StickToEnd{
114 mAppearance = appearance;
117 void scrollToStart() {
123 float getAvailableSpaceForSpacer();
125 void updateScrollHandleOffset(
int max);
129 void setSize(glm::ivec2 size)
override;
131 static const _<ATimer>& buttonTimer();
141 if (mFullSize <= mViewportSize) {
145 return mFullSize - mViewportSize;
157 ALayoutDirection mDirection;
163 size_t mViewportSize = 0, mFullSize = 0;
164 int mCurrentScroll = 0;
166 void setOffset(
size_t o);
168 void scrollForward();
169 void scrollBackward();
171 void handleScrollbar(
int s);
188 AOptional<StickToEnd> mStickToEnd;
void onPointerPressed(const APointerPressedEvent &event) override
Called on pointer (mouse) released event.
Definition AViewContainerBase.cpp:289
void onScroll(const AScrollEvent &event) override
Definition AViewContainerBase.cpp:361
auto size() const
Size, including content area, border and padding.
Definition AView.h:114
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:178
ASignal< Args... > emits
A signal declaration.
Definition ASignal.h:348
Pointing method move event.
Definition APointerMoveEvent.h:21
Pointing method press event.
Definition APointerPressedEvent.h:21
Pointing method press event.
Definition APointerReleasedEvent.h:19