30#include <TGUI/Widgets/ClickableWidget.hpp>
53 typedef std::shared_ptr<Label>
Ptr;
115 return std::static_pointer_cast<LabelRenderer>(m_renderer);
376 virtual void setParent(
Container* parent)
override;
382 virtual void leftMouseReleased(
float x,
float y)
override;
400 virtual void reload(
const std::string& primary =
"",
const std::string& secondary =
"",
bool force =
false)
override;
408 return std::make_shared<Label>(*
this);
415 virtual void update(sf::Time elapsedTime)
override;
421 void rearrangeText();
427 virtual void draw(sf::RenderTarget& target, sf::RenderStates states)
const override;
433 sf::RectangleShape m_background;
436 std::vector<sf::Text> m_lines;
438 unsigned int m_textSize = 18;
439 sf::Uint32 m_textStyle = sf::Text::Style::Regular;
440 HorizontalAlignment m_horizontalAlignment = HorizontalAlignment::Left;
441 VerticalAlignment m_verticalAlignment = VerticalAlignment::Top;
443 bool m_autoSize =
true;
445 float m_maximumTextWidth = 0;
448 bool m_possibleDoubleClick =
false;
480 virtual void setProperty(std::string property,
const std::string& value)
override;
564 void draw(sf::RenderTarget& target, sf::RenderStates states)
const;
573 virtual std::shared_ptr<WidgetRenderer> clone(
Widget* widget)
override;
581 sf::Color m_textColor;
582 sf::Color m_backgroundColor;
583 sf::Color m_borderColor;
Definition: Borders.hpp:38
Implicit converter for colors.
Definition: Color.hpp:40
Container widget.
Definition: Container.hpp:48
Definition: Label.hpp:459
void setPadding(const Padding &padding) override
Changes the size of the padding.
virtual void setProperty(std::string property, const std::string &value) override
Change a property of the renderer.
void setBorderColor(const Color &color)
Changes the color of the borders.
virtual void setProperty(std::string property, ObjectConverter &&value) override
Change a property of the renderer.
void setTextColor(const Color &color)
Changes the color of the text.
virtual ObjectConverter getProperty(std::string property) const override
Retrieve the value of a certain property.
LabelRenderer(Label *label)
Constructor.
Definition: Label.hpp:468
void setBackgroundColor(const Color &color)
Changes the background color of the label.
virtual std::map< std::string, ObjectConverter > getPropertyValuePairs() const override
Get a map with all properties and their values.
Label widget.
Definition: Label.hpp:50
virtual void reload(const std::string &primary="", const std::string &secondary="", bool force=false) override
Reload the widget.
HorizontalAlignment getHorizontalAlignment() const
Get the current horizontal text alignment.
void setMaximumTextWidth(float maximumWidth)
Changes the maximum width that the text will have when auto-sizing.
const sf::Color & getTextColor() const
Returns the color of the text.
VerticalAlignment
The vertical text alignment.
Definition: Label.hpp:72
void setTextColor(const Color &color)
Changes the color of the text.
void setText(const sf::String &text)
Changes the text.
void setTextStyle(sf::Uint32 style)
Changes the style of the text.
virtual Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition: Label.hpp:406
virtual void setSize(const Layout2d &size) override
Changes the area of the text that will be drawn.
virtual void setOpacity(float opacity) override
Changes the opacity of the widget.
float getMaximumTextWidth() const
Returns the maximum width that the text will have.
std::shared_ptr< LabelRenderer > getRenderer() const
Returns the renderer, which gives access to functions that determine how the widget is displayed.
Definition: Label.hpp:113
unsigned int getTextSize() const
Returns the character size of the text.
virtual sf::Vector2f getWidgetOffset() const override
Returns the distance between the position where the widget is drawn and where the widget is placed.
void setVerticalAlignment(VerticalAlignment alignment)
Change the vertical text alignment.
virtual void setFont(const Font &font) override
Changes the font of the text in the widget.
void setTextSize(unsigned int size)
Changes the character size of the text.
std::shared_ptr< const Label > ConstPtr
Shared constant widget pointer.
Definition: Label.hpp:54
static Label::Ptr copy(Label::ConstPtr label)
Makes a copy of another label.
virtual void setPosition(const Layout2d &position) override
Set the position of the widget.
std::shared_ptr< Label > Ptr
Shared widget pointer.
Definition: Label.hpp:53
virtual bool getAutoSize() const
Returns whether the label is auto-sized or not.
Definition: Label.hpp:319
VerticalAlignment getVerticalAlignment() const
Get the current vertical text alignment.
const sf::String & getText() const
Returns the text.
Definition: Label.hpp:195
sf::Uint32 getTextStyle() const
Returns the style of the text.
static Label::Ptr create(sf::String text="")
Creates a new label widget.
virtual sf::Vector2f getFullSize() const override
Returns the full size of the label.
virtual void setAutoSize(bool autoSize)
Changes whether the label is auto-sized or not.
void setHorizontalAlignment(HorizontalAlignment alignment)
Change the horizontal text alignment.
HorizontalAlignment
The horizontal text alignment.
Definition: Label.hpp:61
Class to store the position or size of a widget.
Definition: Layout.hpp:255
Implicit converter for settable properties.
Definition: ObjectConverter.hpp:43
Namespace that contains all TGUI functions and classes.
Definition: Animation.hpp:34