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>
41 class TGUI_API Scrollbar :
public Widget
45 using Ptr = std::shared_ptr<Scrollbar>;
46 using ConstPtr = std::shared_ptr<const Scrollbar>;
65 Scrollbar(
const char* typeName = StaticWidgetType,
bool initRenderer =
true);
188#ifndef TGUI_REMOVE_DEPRECATED_CODE
196 TGUI_DEPRECATED(
"Use setPolicy instead") void
setAutoHide(
bool autoHide);
204 TGUI_DEPRECATED(
"Use getPolicy instead") TGUI_NODISCARD
bool getAutoHide() const;
299 void leftMouseReleased(Vector2f pos) override;
304 void mouseMoved(Vector2f pos) override;
309 bool scrolled(
float delta, Vector2f pos,
bool touch) override;
314 void leftMouseButtonNoLongerDown() override;
353 TGUI_NODISCARD std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers) const override;
358 void load(const std::unique_ptr<DataIO::Node>& node, const LoadingRenderersMap& renderers) override;
363 void updateThumbPosition();
376 void callMousePressPeriodically(std::chrono::time_point<std::chrono::steady_clock> clickedTime,
bool repeatedCall);
396 Part m_mouseHoverOverPart = Part::None;
399 bool m_mouseDownOnThumb =
false;
400 Vector2f m_mouseDownOnThumbPos;
402 unsigned int m_maximum = 10;
403 unsigned int m_value = 0;
406 unsigned int m_viewportSize = 1;
408 Orientation m_orientation = Orientation::Vertical;
409 Orientation m_imageOrientation = Orientation::Vertical;
410 bool m_orientationLocked =
false;
413 unsigned int m_scrollAmount = 1;
416 Scrollbar::Policy m_policy = Scrollbar::Policy::Automatic;
419 bool m_mouseDownOnIncreaseArrow =
false;
420 bool m_mouseDownOnDecreaseArrow =
false;
421 std::chrono::time_point<std::chrono::steady_clock> m_lastMousePressTime;
423 bool m_sizeSet =
false;
425 std::chrono::steady_clock::time_point m_lastSuccessfulScrollTime;
426 Vector2f m_lastSuccessfulScrollPos;
431 FloatRect m_arrowDown;
433 Sprite m_spriteTrack;
434 Sprite m_spriteTrackHover;
435 Sprite m_spriteThumb;
436 Sprite m_spriteThumbHover;
437 Sprite m_spriteArrowUp;
438 Sprite m_spriteArrowUpHover;
439 Sprite m_spriteArrowDown;
440 Sprite m_spriteArrowDownHover;
443 Color m_thumbColorCached;
444 Color m_thumbColorHoverCached;
445 Color m_trackColorCached;
446 Color m_trackColorHoverCached;
447 Color m_arrowColorCached;
448 Color m_arrowColorHoverCached;
449 Color m_arrowBackgroundColorCached;
450 Color m_arrowBackgroundColorHoverCached;
499 std::function<
void()> valueChangedCallback,
500 std::function<
void()> policyChangedCallback,
501 std::function<
void()> scrollAmountChangedCallback);
583 std::function<void()> m_valueChangedCallback;
584 std::function<void()> m_policyChangedCallback;
585 std::function<void()> m_scrollAmountChangedCallback;
Base class for render targets.
Definition BackendRenderTarget.hpp:46
Definition CopiedSharedPtr.hpp:40
Class to store the position or size of a widget.
Definition Layout.hpp:321
Signal to which the user can subscribe to get callbacks from.
Definition Signal.hpp:59
Wrapper class to store strings.
Definition String.hpp:94
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:36
SignalTyped< unsigned int > SignalUInt
Signal with one "unsigned int" as optional unbound parameter.
Definition Signal.hpp:422
Orientation
Orientation of the object.
Definition Layout.hpp:50
@ Vertical
Vertical orientation.
Definition Layout.hpp:51
States used for drawing.
Definition RenderStates.hpp:38