wPlot2D version: 0.1.0
A lightweight C++ library for clear and customizable 2D scientific plots.
Loading...
Searching...
No Matches
wPlot2D::FrameEntity Class Reference

Entity representing a rectangular frame around content. More...

#include <wFrameEntity.hpp>

Inheritance diagram for wPlot2D::FrameEntity:
Inheritance graph

Public Member Functions

 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.
Public Member Functions inherited from wEngine::Entity
 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.

Additional Inherited Members

Static Public Member Functions inherited from wEngine::Entity
static void resetEntityIDCounter ()
 Resets the global entity ID counter to zero.

Detailed Description

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

Constructor & Destructor Documentation

◆ FrameEntity()

wPlot2D::FrameEntity::FrameEntity ( bool enabled = true)

Constructs a frame entity.

Parameters
enabledWhether the frame should be enabled initially.

◆ ~FrameEntity()

virtual wPlot2D::FrameEntity::~FrameEntity ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ setEnabled()

void wPlot2D::FrameEntity::setEnabled ( bool enabled)

Enables or disables the frame.

Parameters
enabledNew 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
colorNew fill color.

◆ setOutlineColor()

void wPlot2D::FrameEntity::setOutlineColor ( const sf::Color & color)

Sets the outline color of the frame.

Parameters
colorNew outline color.

◆ setThickness()

void wPlot2D::FrameEntity::setThickness ( float thickness)

Sets the outline thickness of the frame.

Parameters
thicknessNew outline thickness (must be > 0).

◆ setPadding()

void wPlot2D::FrameEntity::setPadding ( const sf::Vector2f & padding)

Sets the padding around the content.

Parameters
paddingPadding 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
contentBoundsThe bounding box of the content (width/height).
positionThe 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
windowTarget render window.

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