30#include <TGUI/Widgets/ClickableWidget.hpp>
31#include <TGUI/Renderers/LabelRenderer.hpp>
32#include <TGUI/CopiedSharedPtr.hpp>
33#include <TGUI/Widgets/Scrollbar.hpp>
34#include <TGUI/Text.hpp>
47 typedef std::shared_ptr<Label>
Ptr;
50#ifndef TGUI_REMOVE_DEPRECATED_CODE
298 void setParent(
Container* parent)
override;
318 void leftMousePressed(
Vector2f pos)
override;
321 void leftMouseReleased(
Vector2f pos)
override;
324 void mouseMoved(
Vector2f pos)
override;
327 bool mouseWheelScrolled(
float delta,
Vector2f pos)
override;
330 void mouseNoLongerOnWidget()
override;
333 void leftMouseButtonNoLongerDown()
override;
343 void draw(sf::RenderTarget& target, sf::RenderStates states)
const override;
373 std::unique_ptr<DataIO::Node>
save(SavingRenderersMap& renderers)
const override;
379 void load(
const std::unique_ptr<DataIO::Node>& node,
const LoadingRenderersMap& renderers)
override;
385 bool update(sf::Time elapsedTime)
override;
391 void rearrangeText();
399 return std::make_shared<Label>(*
this);
406 SignalString onDoubleClick = {
"DoubleClicked"};
413 std::vector<Text> m_lines;
415 HorizontalAlignment m_horizontalAlignment = HorizontalAlignment::Left;
416 VerticalAlignment m_verticalAlignment = VerticalAlignment::Top;
418 bool m_autoSize =
true;
420 float m_maximumTextWidth = 0;
422 bool m_ignoringMouseEvents =
false;
425 bool m_possibleDoubleClick =
false;
434 Sprite m_spriteBackground;
440 Color m_textColorCached;
441 Color m_borderColorCached;
442 Color m_backgroundColorCached;
443 Color m_textOutlineColorCached;
444 float m_textOutlineThicknessCached = 0;
Wrapper for colors.
Definition: Color.hpp:49
Container widget.
Definition: Container.hpp:48
Definition: CopiedSharedPtr.hpp:40
Definition: LabelRenderer.hpp:37
Label widget.
Definition: Label.hpp:44
bool mouseOnWidget(Vector2f pos) const override
Returns whether the mouse position (which is relative to the parent widget) lies on top of the widget...
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
Draw the widget to a render target.
void rendererChanged(const std::string &property) override
Function called when one of the properties of the renderer is changed.
void setTextSize(unsigned int size) override
Changes the character size of the text.
bool canGainFocus() const override
Returns whether the widget can gain focus.
void setAutoSize(bool autoSize)
Changes whether the label is auto-sized or not.
HorizontalAlignment getHorizontalAlignment() const
Gets the current horizontal text alignment.
void setMaximumTextWidth(float maximumWidth)
Changes the maximum width that the text will have when auto-sizing.
void setScrollbarPolicy(Scrollbar::Policy policy)
Changes when the vertical scrollbar should be displayed.
Widget::Ptr clone() const override
Makes a copy of the widget if you don't know its exact type.
Definition: Label.hpp:397
VerticalAlignment
The vertical text alignment.
Definition: Label.hpp:70
void ignoreMouseEvents(bool ignore=true)
Sets whether the widget should completely ignore mouse events and let them pass to the widgets behind...
void load(const std::unique_ptr< DataIO::Node > &node, const LoadingRenderersMap &renderers) override
Loads the widget from a tree of nodes.
LabelRenderer * getRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
void setText(const sf::String &text)
Changes the text.
float getMaximumTextWidth() const
Returns the maximum width that the text will have.
void setVerticalAlignment(VerticalAlignment alignment)
Changes the vertical text alignment.
Signal & getSignal(std::string signalName) override
Retrieves a signal based on its name.
LabelRenderer * getSharedRenderer()
Returns the renderer, which gives access to functions that determine how the widget is displayed.
bool isIgnoringMouseEvents() const
Returns whether the widget is ignoring mouse events and letting them pass to the widgets behind it.
std::shared_ptr< const Label > ConstPtr
Shared constant widget pointer.
Definition: Label.hpp:48
static Label::Ptr copy(Label::ConstPtr label)
Makes a copy of another label.
std::shared_ptr< Label > Ptr
Shared widget pointer.
Definition: Label.hpp:47
bool getAutoSize() const
Returns whether the label is auto-sized or not.
VerticalAlignment getVerticalAlignment() const
Gets the current vertical text alignment.
Scrollbar::Policy getScrollbarPolicy() const
Returns when the vertical scrollbar should be displayed.
const sf::String & getText() const
Returns the text.
void setSize(const Layout2d &size) override
Changes the area of the text that will be drawn.
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.
static Label::Ptr create(sf::String text="")
Creates a new label widget.
void setHorizontalAlignment(HorizontalAlignment alignment)
Changes the horizontal text alignment.
HorizontalAlignment
The horizontal text alignment.
Definition: Label.hpp:59
Class to store the position or size of a widget.
Definition: Layout.hpp:260
Definition: Outline.hpp:39
Signal to which the user can subscribe to get callbacks from.
Definition: Signal.hpp:231
Definition: Sprite.hpp:46
Wrapper for text styles.
Definition: TextStyle.hpp:47
Definition: Vector2f.hpp:39
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:37