25#ifndef TGUI_PROGRESS_BAR_HPP
26#define TGUI_PROGRESS_BAR_HPP
28#include <TGUI/Renderers/ProgressBarRenderer.hpp>
29#include <TGUI/Widgets/ClickableWidget.hpp>
30#include <TGUI/Text.hpp>
34TGUI_MODULE_EXPORT
namespace tgui
43 using Ptr = std::shared_ptr<ProgressBar>;
44 using ConstPtr = std::shared_ptr<const ProgressBar>;
46 static constexpr const char StaticWidgetType[] =
"ProgressBar";
68 ProgressBar(
const char* typeName = StaticWidgetType,
bool initRenderer =
true);
106 using Widget::setSize;
237 TGUI_NODISCARD std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
242 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
252 TGUI_NODISCARD
Vector2f getInnerSize()
const;
258 void recalculateFillSize();
263 TGUI_NODISCARD
Vector2f getFrontImageSize()
const;
279 unsigned int m_minimum = 0;
280 unsigned int m_maximum = 100;
281 unsigned int m_value = 0;
289 FillDirection m_fillDirection = FillDirection::LeftToRight;
291 Sprite m_spriteBackground;
296 Color m_borderColorCached;
297 Color m_backgroundColorCached;
298 Color m_fillColorCached;
Base class for render targets.
Definition BackendRenderTarget.hpp:46
Wrapper for colors.
Definition Color.hpp:73
Class to store the position or size of a widget.
Definition Layout.hpp:313
Definition Outline.hpp:38
Definition ProgressBarRenderer.hpp:35
Progress bar widget.
Definition ProgressBar.hpp:40
TGUI_NODISCARD ProgressBarRenderer * getSharedRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
void setFillDirection(FillDirection direction)
Changes the fill direction of the progress bar.
TGUI_NODISCARD Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
void setMaximum(unsigned int maximum)
Sets a maximum value.
TGUI_NODISCARD unsigned int getValue() const
Returns the current value.
void updateTextSize() override
Called when the text size is changed (either by setTextSize or via the renderer)
std::shared_ptr< ProgressBar > Ptr
Shared widget pointer.
Definition ProgressBar.hpp:43
TGUI_NODISCARD Signal & getSignal(String signalName) override
Retrieves a signal based on its name.
static TGUI_NODISCARD ProgressBar::Ptr copy(const ProgressBar::ConstPtr &progressBar)
Makes a copy of another progress bar.
TGUI_NODISCARD std::unique_ptr< DataIO::Node > save(SavingRenderersMap &renderers) const override
Saves the widget as a tree node in order to save it to a file.
TGUI_NODISCARD ProgressBarRenderer * getRenderer() override
Returns the renderer, which gives access to functions that determine how the widget is displayed.
TGUI_NODISCARD unsigned int getMinimum() const
Returns the minimum value.
std::shared_ptr< const ProgressBar > ConstPtr
Shared constant widget pointer.
Definition ProgressBar.hpp:44
void setValue(unsigned int value)
Changes the current value.
unsigned int incrementValue()
Increments the value.
void setMinimum(unsigned int minimum)
Sets a minimum value.
void setText(const String &text)
Changes the caption of the progress bar.
void setSize(const Layout2d &size) override
Changes the size of the progress bar.
FillDirection
The fill direction of the progress bar.
Definition ProgressBar.hpp:54
TGUI_NODISCARD FillDirection getFillDirection() const
Returns the fill direction of the progress bar.
TGUI_NODISCARD bool isMouseOnWidget(Vector2f pos) const override
Returns whether the mouse position (which is relative to the parent widget) lies on top of the widget...
void draw(BackendRenderTarget &target, RenderStates states) const override
Draw the widget to a render target.
static TGUI_NODISCARD ProgressBar::Ptr create()
Creates a new progress bar widget.
void rendererChanged(const String &property) override
Function called when one of the properties of the renderer is changed.
TGUI_NODISCARD const String & getText() const
Returns the caption of the progress bar.
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
TGUI_NODISCARD unsigned int getMaximum() const
Returns the maximum value.
Signal to which the user can subscribe to get callbacks from.
Definition Signal.hpp:61
Wrapper class to store strings.
Definition String.hpp:96
Backend-independent wrapper around the backend-specific text class.
Definition Text.hpp:48
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38
States used for drawing.
Definition RenderStates.hpp:38