Guillaume 1.0.0
Guillaume.
Loading...
Searching...
No Matches
Label Class Reference

Simple display component for text. More...

#include <label.hpp>

Inheritance diagram for Label:
Collaboration diagram for Label:

Public Member Functions

 Label (const std::string &text)
 Constructs a Label object.
 
 Label (const std::string &text, const Properties &properties)
 Constructs a Label object with properties.
 
 ~Label (void) override=default
 Destroys the Label object.
 
const std::string & getText (void) const
 Gets the label's text.
 
void setText (const std::string &text)
 Sets the label's text.
 
std::shared_ptr< Componentrender (void) override
 Renders the label.
 
void onEvent (const Event &event) override
 Handles events for the label.
 
- Public Member Functions inherited from Component
 Component (void)
 Constructs a Component object.
 
 Component (const Properties &properties)
 Constructs a Component object with properties.
 
virtual ~Component (void)=default
 Destroy the Component object.
 
ComponentID getID (void) const
 Get the ID object.
 
virtual void addChild (const std::shared_ptr< Component > &child)
 Add a child component.
 
virtual void addPrimitive (const std::shared_ptr< Primitive > &primitive)
 Add a primitive for rendering.
 
StategetState (void)
 Gets the component's state.
 
const PropertiesgetProperties (void) const
 Gets the component's properties.
 
const std::vector< std::shared_ptr< Component > > & getChildren (void) const
 Gets the component's children.
 
std::shared_ptr< ComponentgetParent (void) const
 Gets the component's parent.
 
const std::vector< std::shared_ptr< Primitive > > & getPrimitives (void) const
 Gets the component's primitives.
 

Additional Inherited Members

- Protected Member Functions inherited from Component
void setParent (const std::shared_ptr< Component > &parent)
 Set the Parent object.
 
- Protected Attributes inherited from Component
State _state
 The component's state.
 
Properties _properties
 The component's properties.
 
std::shared_ptr< Component_parent
 Pointer to the parent component.
 
std::vector< std::shared_ptr< Component > > _children
 Vector of child components.
 
std::vector< std::shared_ptr< Primitive > > _primitives
 Vector of primitives for rendering.
 

Detailed Description

Simple display component for text.

The Label class represents a text display component that typically does not handle events.

Constructor & Destructor Documentation

◆ Label() [1/2]

Label::Label ( const std::string &  text)
inline

Constructs a Label object.

Parameters
textThe label's text content

◆ Label() [2/2]

Label::Label ( const std::string &  text,
const Properties properties 
)
inline

Constructs a Label object with properties.

Parameters
textThe label's text content
propertiesThe properties for the label

Member Function Documentation

◆ getText()

const std::string & Label::getText ( void  ) const
inline

Gets the label's text.

Returns
const std::string& The label's text content

◆ onEvent()

void Label::onEvent ( const Event event)
inlineoverridevirtual

Handles events for the label.

Labels typically do not handle events, so this is a no-op.

Parameters
eventThe event to handle

Reimplemented from Component.

◆ render()

std::shared_ptr< Component > Label::render ( void  )
inlineoverridevirtual

Renders the label.

Returns
std::shared_ptr<Component> Pointer to the rendered component

Reimplemented from Component.

◆ setText()

void Label::setText ( const std::string &  text)
inline

Sets the label's text.

Parameters
textThe new text content

The documentation for this class was generated from the following file: