15#include "AViewContainer.h"
16#include "AScrollAreaViewport.h"
17#include "AScrollbar.h"
37class API_AUI_VIEWS AScrollArea:
public AViewContainerBase {
44 void setSize(glm::ivec2
size)
override;
46 mInner->setContents(std::move(content));
55 void setScroll(glm::uvec2 scroll) {
60 void setScrollX(
unsigned scroll) {
61 AUI_NULLSAFE(mHorizontalScrollbar)->setScroll(
int(scroll));
62 else mInner->setScrollX(scroll);
65 void setScrollY(
unsigned scroll) {
66 AUI_NULLSAFE(mVerticalScrollbar)->setScroll(
int(scroll));
67 else mInner->setScrollY(scroll);
75 AUI_NULLSAFE(mHorizontalScrollbar)->setStickToEnd(stickToEnd);
76 AUI_NULLSAFE(mVerticalScrollbar)->setStickToEnd(stickToEnd);
79 void scroll(glm::ivec2 by)
noexcept {
83 void scroll(
int deltaByX,
int deltaByY)
noexcept {
84 AUI_NULLSAFE(mHorizontalScrollbar)->scroll(deltaByX);
85 else mInner->setScrollX(mInner->scroll().x + deltaByX);
86 AUI_NULLSAFE(mVerticalScrollbar)->scroll(deltaByY);
87 else mInner->setScrollY(mInner->scroll().y + deltaByY);
90 bool onGesture(
const glm::ivec2 &origin,
const AGestureEvent &event)
override;
92 void onScroll(
const AScrollEvent& event)
override;
94 void setScrollbarAppearance(ass::ScrollbarAppearance scrollbarAppearance) {
95 AUI_NULLSAFE(mHorizontalScrollbar)->setAppearance(scrollbarAppearance.getHorizontal());
96 AUI_NULLSAFE(mVerticalScrollbar)->setAppearance(scrollbarAppearance.getVertical());
111 scrollTo(ARect<int>::fromTopLeftPositionAndSize(target->getPositionInWindow(), target->getSize()), nearestBorder);
121 void scrollTo(
ARect<int> target,
bool nearestBorder =
true);
127 mIsWheelScrollable = value;
131 friend class AScrollArea;
136 bool mExpanding =
false;
141 Builder& withExternalVerticalScrollbar(
_<AScrollbar> externalVerticalScrollbar) {
142 mExternalVerticalScrollbar = std::move(externalVerticalScrollbar);
146 Builder& withExternalHorizontalScrollbar(
_<AScrollbar> externalHorizontalScrollbar) {
147 mExternalHorizontalScrollbar = std::move(externalHorizontalScrollbar);
151 Builder& withContents(
_<AView> contents) {
152 mContents = std::move(contents);
156 Builder& withExpanding() {
174 const _<AView>& contents() const noexcept {
175 return mInner->contents();
180 return mVerticalScrollbar;
184 const _<AScrollbar>& horizontalScrollbar() const noexcept {
185 return mHorizontalScrollbar;
189 glm::uvec2 scroll() const noexcept {
190 return mInner->scroll();
193 explicit AScrollArea(
const Builder& builder);
196 _<AScrollAreaViewport> mInner;
197 _<AScrollbar> mVerticalScrollbar;
198 _<AScrollbar> mHorizontalScrollbar;
203 bool mIsWheelScrollable =
true;
void onPointerPressed(const APointerPressedEvent &event) override
Called on pointer (mouse) released event.
Definition AViewContainerBase.cpp:289
bool onGesture(const glm::ivec2 &origin, const AGestureEvent &event) override
Definition AViewContainerBase.cpp:551
int getContentMinimumWidth() override
Definition AViewContainerBase.cpp:275
void onPointerReleased(const APointerReleasedEvent &event) override
Called on pointer (mouse) released event.
Definition AViewContainerBase.cpp:329
void onScroll(const AScrollEvent &event) override
Definition AViewContainerBase.cpp:361
void setContents(const _< AViewContainer > &container)
Moves (like via std::move) all children and layout of the specified container to this container.
Definition AViewContainerBase.cpp:515
int getContentMinimumHeight() override
Definition AViewContainerBase.cpp:282
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
Pointing method press event.
Definition APointerPressedEvent.h:21
Pointing method press event.
Definition APointerReleasedEvent.h:19
Axis aligned 2D rectangle.
Definition ARect.h:24
static _< T > manage(T *raw)
Delegates memory management of the raw pointer T* raw to the shared pointer, which is returned.
Definition SharedPtrTypes.h:372