26#ifndef TGUI_PROGRESS_BAR_HPP
27#define TGUI_PROGRESS_BAR_HPP
30#include <TGUI/Widgets/Label.hpp>
36 class ProgressBarRenderer;
57 typedef std::shared_ptr<ProgressBar>
Ptr;
58 typedef std::shared_ptr<const ProgressBar>
ConstPtr;
110 return std::static_pointer_cast<ProgressBarRenderer>(m_renderer);
261 return m_textBack.getText();
283 return m_textBack.getTextSize();
308 return m_fillDirection;
347 virtual void reload(
const std::string& primary =
"",
const std::string& secondary =
"",
bool force =
false)
override;
355 return std::make_shared<ProgressBar>(*
this);
363 void recalculateSize();
369 virtual void draw(sf::RenderTarget& target, sf::RenderStates states)
const override;
375 unsigned int m_minimum = 0;
376 unsigned int m_maximum = 100;
377 unsigned int m_value = 0;
381 unsigned int m_textSize = 0;
383 sf::FloatRect m_frontRect;
385 FillDirection m_fillDirection = FillDirection::LeftToRight;
415 virtual void setProperty(std::string property,
const std::string& value)
override;
550 void draw(sf::RenderTarget& target, sf::RenderStates states)
const;
559 virtual std::shared_ptr<WidgetRenderer> clone(
Widget* widget)
override;
570 sf::Color m_textColorFront;
571 sf::Color m_textColorBack;
573 sf::Color m_backgroundColor;
574 sf::Color m_foregroundColor;
576 sf::Color m_borderColor;
Implicit converter for colors.
Definition: Color.hpp:40
Label widget.
Definition: Label.hpp:50
Class to store the position or size of a widget.
Definition: Layout.hpp:255
Implicit converter for settable properties.
Definition: ObjectConverter.hpp:43
Definition: ProgressBar.hpp:394
void setBorderColor(const Color &color)
Changes the border color.
void setTextColor(const Color &color)
Changes the color of the text that is optionally displayed on top of the progress bar.
void setForegroundColor(const Color &color)
Changes the foreground color of the progress bar.
void setTextColorFront(const Color &color)
Changes the color of the text that is optionally displayed on top of the progress bar.
void setFrontTexture(const Texture &texture)
Change the foreground image of the progress bar.
ProgressBarRenderer(ProgressBar *progressBar)
Constructor.
Definition: ProgressBar.hpp:403
virtual std::map< std::string, ObjectConverter > getPropertyValuePairs() const override
Get a map with all properties and their values.
virtual void setProperty(std::string property, ObjectConverter &&value) override
Change a property of the renderer.
void setBackTexture(const Texture &texture)
Change the background image of the progress bar.
void setTextColorBack(const Color &color)
Changes the color of the text that is optionally displayed on top of the progress bar.
void setBackgroundColor(const Color &color)
Changes the background color of the progress bar.
virtual ObjectConverter getProperty(std::string property) const override
Retrieve the value of a certain property.
virtual void setProperty(std::string property, const std::string &value) override
Change a property of the renderer.
Progress bar widget.
Definition: ProgressBar.hpp:54
virtual sf::Vector2f getWidgetOffset() const override
Returns the distance between the position where the widget is drawn and where the widget is placed.
std::shared_ptr< ProgressBarRenderer > getRenderer() const
Returns the renderer, which gives access to functions that determine how the widget is displayed.
Definition: ProgressBar.hpp:108
virtual void setPosition(const Layout2d &position) override
Set the position of the widget.
unsigned int getValue() const
Returns the current value.
Definition: ProgressBar.hpp:225
void setFillDirection(FillDirection direction)
Changes the fill direction of the progress bar.
virtual void setFont(const Font &font) override
Changes the font of the text in the widget.
void setMaximum(unsigned int maximum)
Sets a maximum value.
static ProgressBar::Ptr copy(ProgressBar::ConstPtr progressBar)
Makes a copy of another progress bar.
sf::String getText() const
Returns the caption of the progress bar.
Definition: ProgressBar.hpp:259
std::shared_ptr< const ProgressBar > ConstPtr
Shared constant widget pointer.
Definition: ProgressBar.hpp:58
virtual void setOpacity(float opacity) override
Changes the opacity of the widget.
virtual void reload(const std::string &primary="", const std::string &secondary="", bool force=false) override
Reload the widget.
std::shared_ptr< ProgressBar > Ptr
Shared widget pointer.
Definition: ProgressBar.hpp:57
ProgressBar()
Default constructor.
virtual Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition: ProgressBar.hpp:353
void setValue(unsigned int value)
Changes the current value.
unsigned int incrementValue()
Increment the value.
void setMinimum(unsigned int minimum)
Sets a minimum value.
void setSize(const Layout2d &size) override
Changes the size of the progress bar.
static ProgressBar::Ptr create()
Creates a new progress bar widget.
FillDirection
The fill direction of the progress bar.
Definition: ProgressBar.hpp:68
void setText(const sf::String &text)
Changes the caption of the progress bar.
unsigned int getMinimum() const
Returns the minimum value.
Definition: ProgressBar.hpp:201
void setTextSize(unsigned int size)
Changes the character size of the text.
unsigned int getMaximum() const
Returns the maximum value.
Definition: ProgressBar.hpp:213
FillDirection getFillDirection()
Returns the fill direction of the progress bar.
Definition: ProgressBar.hpp:306
virtual sf::Vector2f getFullSize() const override
Returns the full size of the progress bar.
unsigned int getTextSize() const
Returns the character size of the text.
Definition: ProgressBar.hpp:281
Definition: Texture.hpp:45
Namespace that contains all TGUI functions and classes.
Definition: Animation.hpp:34