25#ifndef TGUI_SCROLLBAR_HPP
26#define TGUI_SCROLLBAR_HPP
28#include <TGUI/Widget.hpp>
29#include <TGUI/Renderers/ScrollbarRenderer.hpp>
30#include <TGUI/CopiedSharedPtr.hpp>
32#if !TGUI_EXPERIMENTAL_USE_STD_MODULE
38TGUI_MODULE_EXPORT
namespace tgui
47 using Ptr = std::shared_ptr<Scrollbar>;
48 using ConstPtr = std::shared_ptr<const Scrollbar>;
50 static constexpr const char StaticWidgetType[] =
"Scrollbar";
67 Scrollbar(
const char* typeName = StaticWidgetType,
bool initRenderer =
true);
108 using Widget::setSize;
190#ifndef TGUI_REMOVE_DEPRECATED_CODE
198 TGUI_DEPRECATED(
"Use setPolicy instead") void setAutoHide(
bool autoHide);
206 TGUI_DEPRECATED("Use getPolicy instead") TGUI_NODISCARD
bool getAutoHide() const;
245 TGUI_DEPRECATED(
"Use setOrientation instead") void setVerticalScroll(
bool vertical);
251 TGUI_DEPRECATED("Use getOrientation instead") TGUI_NODISCARD
bool getVerticalScroll() const;
276 TGUI_NODISCARD
float getDefaultWidth() const;
284 TGUI_NODISCARD
bool canGainFocus() const override;
291 TGUI_NODISCARD
bool isMouseOnWidget(
Vector2f pos) const override;
301 void leftMouseReleased(
Vector2f pos) override;
306 void mouseMoved(
Vector2f pos) override;
311 bool scrolled(
float delta,
Vector2f pos,
bool touch) override;
316 void leftMouseButtonNoLongerDown() override;
350 void rendererChanged(const
String& property) override;
355 TGUI_NODISCARD std::unique_ptr<DataIO::Node> save(SavingRenderersMap& renderers) const override;
360 void load(const std::unique_ptr<DataIO::Node>& node, const LoadingRenderersMap& renderers) override;
365 void updateThumbPosition();
389 Part m_mouseHoverOverPart = Part::Thumb;
392 bool m_mouseDownOnThumb =
false;
393 Vector2f m_mouseDownOnThumbPos;
395 unsigned int m_maximum = 10;
396 unsigned int m_value = 0;
399 unsigned int m_viewportSize = 1;
401 Orientation m_orientation = Orientation::Vertical;
402 Orientation m_imageOrientation = Orientation::Vertical;
403 bool m_orientationLocked =
false;
406 unsigned int m_scrollAmount = 1;
409 Scrollbar::Policy m_policy = Scrollbar::Policy::Automatic;
412 bool m_mouseDownOnArrow =
false;
414 bool m_sizeSet =
false;
416 std::chrono::steady_clock::time_point m_lastSuccessfulScrollTime;
417 Vector2f m_lastSuccessfulScrollPos;
422 FloatRect m_arrowDown;
424 Sprite m_spriteTrack;
425 Sprite m_spriteTrackHover;
426 Sprite m_spriteThumb;
427 Sprite m_spriteThumbHover;
428 Sprite m_spriteArrowUp;
429 Sprite m_spriteArrowUpHover;
430 Sprite m_spriteArrowDown;
431 Sprite m_spriteArrowDownHover;
434 Color m_thumbColorCached;
435 Color m_thumbColorHoverCached;
436 Color m_trackColorCached;
437 Color m_trackColorHoverCached;
438 Color m_arrowColorCached;
439 Color m_arrowColorHoverCached;
440 Color m_arrowBackgroundColorCached;
441 Color m_arrowBackgroundColorHoverCached;
490 std::function<
void()> valueChangedCallback,
491 std::function<
void()> policyChangedCallback,
492 std::function<
void()> scrollAmountChangedCallback);
574 std::function<void()> m_valueChangedCallback;
575 std::function<void()> m_policyChangedCallback;
576 std::function<void()> m_scrollAmountChangedCallback;
637 virtual
void scrollbarValueChanged();
642 virtual
void scrollbarPolicyChanged();
647 virtual
void scrollbarScrollAmountChanged();
652 void saveScrollbarPolicy(std::unique_ptr<DataIO::Node>& node) const;
657 void loadScrollbarPolicy(const std::unique_ptr<DataIO::Node>& node);
755 virtual
void scrollbarScrollAmountChanged(
Orientation orientation);
760 void saveScrollbarPolicies(std::unique_ptr<DataIO::Node>& node) const;
765 void loadScrollbarPolicies(const std::unique_ptr<DataIO::Node>& node);
Base class for render targets.
Definition BackendRenderTarget.hpp:46
Definition CopiedSharedPtr.hpp:42
Class to store the position or size of a widget.
Definition Layout.hpp:323
Signal to which the user can subscribe to get callbacks from.
Definition Signal.hpp:61
Wrapper class to store strings.
Definition String.hpp:96
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38
Orientation
Orientation of the object.
Definition Layout.hpp:52
States used for drawing.
Definition RenderStates.hpp:38