|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
How far the content of an entity is scrolled, how large that content is, and how fast the mouse wheel scrolls it. More...
#include <headers/guillaume/components/scrollable.hpp>


Public Member Functions | |
| Scrollable (void)=default | |
| Construct a component scrolled to the origin, with an empty content and a scroll step of 1 on both axes. | |
| ~Scrollable (void)=default | |
| Default destructor. | |
| utility::math::Vector2F | getContentOffset (void) const |
| Get how far the content is scrolled. | |
| Scrollable & | setContentOffset (const utility::math::Vector2F &offset) |
| Scroll the content to an offset. | |
| utility::math::Vector2F | getContentSize (void) const |
| Get the full size of the scrollable content. | |
| Scrollable & | setContentSize (const utility::math::Vector2F &size) |
| Set the full size of the scrollable content. | |
| utility::math::Vector2F | getScrollStep (void) const |
| Get how much one unit of wheel movement scrolls. | |
| Scrollable & | setScrollStep (const utility::math::Vector2F &step) |
| Set how much one unit of wheel movement scrolls. | |
| utility::math::Vector2F | getMaxOffset (const utility::graphic::SizeF &viewport) const |
| Get the largest offset that still shows content, for a viewport size. | |
| Scrollable & | clampOffset (const utility::graphic::SizeF &viewport) |
| Bring the offset back between 0 and getMaxOffset(). | |
| Public Member Functions inherited from guillaume::ecs::Component | |
| bool | hasChanged (void) const |
| Tell whether a value of the component changed since the flags were last reset (the end of the previous frame). | |
| void | setHasChanged (bool hasChanged) |
| Raise or lower the changed flag. | |
| Component (void)=default | |
| Create a component that is not marked as changed. | |
| virtual | ~Component (void)=default |
| Virtual destructor, so components can be destroyed through the base class. | |
How far the content of an entity is scrolled, how large that content is, and how fast the mouse wheel scrolls it.
The entity's Bound is the viewport: the visible window onto content that may be larger. The owner of the content sets the content size. systems::Scroll writes the offset in the Event phase: on each mouse wheel event it adds the wheel offset times the scroll step, then clamps the result between 0 and contentSize - viewportSize on each axis.
This component only holds the offset: no system of the library moves the children by it, the code that places the content reads getContentOffset(). Sizes and offsets are in dp, like Bound. The setters store what they are given and always mark the component changed; only clampOffset() keeps the offset in range.
Definition at line 57 of file scrollable.hpp.
| Scrollable & guillaume::components::Scrollable::clampOffset | ( | const utility::graphic::SizeF & | viewport | ) |
Bring the offset back between 0 and getMaxOffset().
Always marks the component changed, even when the offset was already in range.
| viewport | The size of the visible window, in dp; usually the entity's Bound. |
Definition at line 74 of file scrollable.cpp.

| utility::math::Vector2F guillaume::components::Scrollable::getContentOffset | ( | void | ) | const |
Get how far the content is scrolled.
Definition at line 29 of file scrollable.cpp.
| utility::math::Vector2F guillaume::components::Scrollable::getContentSize | ( | void | ) | const |
Get the full size of the scrollable content.
Definition at line 42 of file scrollable.cpp.
| utility::math::Vector2F guillaume::components::Scrollable::getMaxOffset | ( | const utility::graphic::SizeF & | viewport | ) | const |
Get the largest offset that still shows content, for a viewport size.
| viewport | The size of the visible window, in dp; usually the entity's Bound. |
Definition at line 67 of file scrollable.cpp.

| utility::math::Vector2F guillaume::components::Scrollable::getScrollStep | ( | void | ) | const |
Get how much one unit of wheel movement scrolls.
Definition at line 54 of file scrollable.cpp.
| Scrollable & guillaume::components::Scrollable::setContentOffset | ( | const utility::math::Vector2F & | offset | ) |
Scroll the content to an offset.
The value is stored as given: call clampOffset() afterwards to keep it in range. Always marks the component changed.
| offset | The offset from the top-left of the content, in dp. |
Definition at line 35 of file scrollable.cpp.

| Scrollable & guillaume::components::Scrollable::setContentSize | ( | const utility::math::Vector2F & | size | ) |
Set the full size of the scrollable content.
The offset is not clamped again. Always marks the component changed.
| size | The content size, in dp. A content smaller than the viewport cannot scroll. |
Definition at line 47 of file scrollable.cpp.

| Scrollable & guillaume::components::Scrollable::setScrollStep | ( | const utility::math::Vector2F & | step | ) |
Set how much one unit of wheel movement scrolls.
Always marks the component changed.
| step | The factor applied to the wheel offset, per axis: 0 locks an axis, a negative value reverses it. |
Definition at line 59 of file scrollable.cpp.
