8#ifndef W_LEGEND_ENTITY_HPP
9#define W_LEGEND_ENTITY_HPP
18#pragma GCC diagnostic push
19#pragma GCC diagnostic ignored "-Wfloat-equal"
20#pragma GCC diagnostic ignored "-Wswitch-default"
21#include <SFML/Graphics.hpp>
22#pragma GCC diagnostic pop
67 LegendEntity(
const sf::Font& font,
const sf::Vector2f& position,
bool hasFrame =
true );
135 void setPadding(
const sf::Vector2f& padding );
143 void setFont(
const sf::Font& font );
165 void render( sf::RenderWindow& window );
174 std::unique_ptr< LineEntity > line;
177 LegendItem( std::unique_ptr< LineEntity > line, sf::Text&& txt )
178 : line{ std::move( line ) },
179 labelText{ std::move( txt ) }
197 template <
typename LabelT,
typename SourceT >
198 void addItemGeneric(
const LabelT& label, SourceT* source );
211 template<
typename T >
212 void createItem(
const T& label, std::unique_ptr< LineEntity > line );
214 std::vector< LegendItem > mItems;
215 const sf::Font& mFont;
216 unsigned int mCharacterSize = 30;
Represents an entity in the ECS (Entity-Component System) architecture.
Definition wEntity.hpp:60
Entity for plotting raw data points as a connected polyline.
Definition wDataPlotEntity.hpp:42
Represents a mathematical function as a drawable entity in a 2D plot.
Definition wFunctionEntity.hpp:43
void render(sf::RenderWindow &window)
Renders the legend (all items and optional frame) to the target window.
Definition wLegendEntity.cpp:150
void setFont(const sf::Font &font)
Updates the font used for all legend labels.
Definition wLegendEntity.cpp:111
virtual ~LegendEntity()=default
Virtual destructor.
void setCharacterSize(unsigned int size)
Sets the character size of the legend text.
Definition wLegendEntity.cpp:117
void setFrameEnabled(bool enabled)
Enables or disables the surrounding frame of the legend.
Definition wLegendEntity.cpp:86
LegendEntity(const sf::Font &font, const sf::Vector2f &position, bool hasFrame=true)
Constructs a LegendEntity.
Definition wLegendEntity.cpp:21
void setPadding(const sf::Vector2f &padding)
Sets the internal padding between items and the frame borders.
Definition wLegendEntity.cpp:106
void setFrameFillColor(const sf::Color &color)
Sets the fill color of the legend frame.
Definition wLegendEntity.cpp:91
void setFrameThickness(float thickness)
Sets the outline thickness of the legend frame.
Definition wLegendEntity.cpp:101
void addItem(const std::string &label, FunctionEntity *function)
Adds a new legend item associated with a function.
Definition wLegendEntity.cpp:36
void setTextColor(const sf::Color &color)
Sets the color of the legend labels.
Definition wLegendEntity.cpp:126
void setFrameOutlineColor(const sf::Color &color)
Sets the outline color of the legend frame.
Definition wLegendEntity.cpp:96
Definition wAxisEntity.cpp:17