Entity representing a rectangular frame around content.
More...
#include <wFrameEntity.hpp>
|
| | FrameEntity (bool enabled=true) |
| | Constructs a frame entity.
|
| virtual | ~FrameEntity ()=default |
| | Virtual destructor.
|
| void | setEnabled (bool enabled) |
| | Enables or disables the frame.
|
| bool | isEnabled () const |
| | Checks whether the frame is currently enabled.
|
| sf::Color | getFillColor () const |
| | Gets the current fill color of the frame.
|
| sf::Color | getOutlineColor () const |
| | Gets the current outline color of the frame.
|
| float | getThickness () const |
| | Gets the current outline thickness of the frame.
|
| sf::Vector2f | getPadding () const |
| | Gets the current padding applied around the content.
|
| void | setFillColor (const sf::Color &color) |
| | Sets the fill color of the frame.
|
| void | setOutlineColor (const sf::Color &color) |
| | Sets the outline color of the frame.
|
| void | setThickness (float thickness) |
| | Sets the outline thickness of the frame.
|
| void | setPadding (const sf::Vector2f &padding) |
| | Sets the padding around the content.
|
| void | update (const sf::FloatRect &contentBounds, const sf::Vector2f &position) |
| | Updates the size and position of the frame based on content bounds.
|
| void | render (sf::RenderWindow &window) |
| | Renders the frame to the given render window.
|
| | Entity () |
| virtual | ~Entity () |
| unsigned int | getEntityID () const |
| | Returns the unique ID associated with this entity.
|
| void | clearComponents () |
| | Removes all components currently attached to the entity.
|
| template<typename T, typename... Args> |
| std::shared_ptr< T > | addComponent (Args &&... args) |
| | Adds a new component of type T to the entity.
|
| template<typename T> |
| void | removeComponent () |
| | Removes the component of type T from the entity.
|
| template<typename T> |
| bool | hasComponent () const noexcept |
| | Checks whether the entity has a component of type T.
|
| template<typename T> |
| std::shared_ptr< T > | getComponent () const |
| | Retrieves the component of type T attached to the entity.
|
| template<typename T> |
| std::shared_ptr< T > | requireComponent (const std::string &context="") const |
| | Retrieves the component of type T and throws if it's missing.
|
| template<typename Interface> |
| std::shared_ptr< Interface > | getInterfaceComponent () const |
| | Returns the first component that implements the specified interface.
|
Entity representing a rectangular frame around content.
A FrameEntity is typically used to visually surround titles, legends, or other graphical content. It supports:
- Toggle visibility (enabled flag),
- Fill and outline colors,
- Outline thickness,
- Padding around the content.
The size of the frame is dynamically updated from the content bounds (see update( )).
- Author
- Wilfried Koch
- Copyright
- © 2025 Wilfried Koch. All rights reserved.
◆ FrameEntity()
| wPlot2D::FrameEntity::FrameEntity |
( |
bool | enabled = true | ) |
|
Constructs a frame entity.
- Parameters
-
| enabled | Whether the frame should be enabled initially. |
◆ ~FrameEntity()
| virtual wPlot2D::FrameEntity::~FrameEntity |
( |
| ) |
|
|
virtualdefault |
◆ setEnabled()
| void wPlot2D::FrameEntity::setEnabled |
( |
bool | enabled | ) |
|
Enables or disables the frame.
- Parameters
-
| enabled | New enabled state. |
◆ isEnabled()
| bool wPlot2D::FrameEntity::isEnabled |
( |
| ) |
const |
|
nodiscard |
Checks whether the frame is currently enabled.
- Returns
- True if the frame is enabled, false otherwise.
◆ getFillColor()
| sf::Color wPlot2D::FrameEntity::getFillColor |
( |
| ) |
const |
|
nodiscard |
Gets the current fill color of the frame.
- Returns
- Fill color.
◆ getOutlineColor()
| sf::Color wPlot2D::FrameEntity::getOutlineColor |
( |
| ) |
const |
|
nodiscard |
Gets the current outline color of the frame.
- Returns
- Outline color.
◆ getThickness()
| float wPlot2D::FrameEntity::getThickness |
( |
| ) |
const |
|
nodiscard |
Gets the current outline thickness of the frame.
- Returns
- Outline thickness (in pixels).
◆ getPadding()
| sf::Vector2f wPlot2D::FrameEntity::getPadding |
( |
| ) |
const |
|
nodiscard |
Gets the current padding applied around the content.
- Returns
- Padding as (x, y).
◆ setFillColor()
| void wPlot2D::FrameEntity::setFillColor |
( |
const sf::Color & | color | ) |
|
Sets the fill color of the frame.
- Parameters
-
◆ setOutlineColor()
| void wPlot2D::FrameEntity::setOutlineColor |
( |
const sf::Color & | color | ) |
|
Sets the outline color of the frame.
- Parameters
-
◆ setThickness()
| void wPlot2D::FrameEntity::setThickness |
( |
float | thickness | ) |
|
Sets the outline thickness of the frame.
- Parameters
-
| thickness | New outline thickness (must be > 0). |
◆ setPadding()
| void wPlot2D::FrameEntity::setPadding |
( |
const sf::Vector2f & | padding | ) |
|
Sets the padding around the content.
- Parameters
-
| padding | Padding as (x, y). |
◆ update()
| void wPlot2D::FrameEntity::update |
( |
const sf::FloatRect & | contentBounds, |
|
|
const sf::Vector2f & | position ) |
Updates the size and position of the frame based on content bounds.
- Parameters
-
| contentBounds | The bounding box of the content (width/height). |
| position | The position of the frame's center in pixels. |
◆ render()
| void wPlot2D::FrameEntity::render |
( |
sf::RenderWindow & | window | ) |
|
Renders the frame to the given render window.
- Parameters
-
| window | Target render window. |
The documentation for this class was generated from the following files: