15#include <unordered_map>
46 std::unordered_map<Core*, sf::Vector2f> _relativePositions;
69 static_assert(std::is_base_of_v<Core, T>,
70 "Panel::addComponent requires a Core-derived type");
74 if constexpr (detail::has_setSize<T>::value)
79 _relativePositions[&child] = {0.f, 0.f};
80 _fillChildren[&child] = [&child](
sf::Vector2f sz){ child.setSize(sz); };
84 _relativePositions[&child] = child.getPosition() -
getPosition();
89 _relativePositions[&child] = child.getPosition() -
getPosition();
Virtual base class for all Malena framework objects.
void addComponent(Core &child)
sf::Vector2f getPosition() const override
Base class for all Malena manifests.
void setActive(bool active) override
void addComponent(T &child, bool fill=false)
Add a child component to this panel.
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
Draw this graphic to an SFML render target.
void setSize(const sf::Vector2f &size)
Resize the panel and propagate to fill-enabled children.
void addUntracked(Core &child)
Add a child that will NOT follow the panel when it moves.
void onThemeApplied(const Theme &theme) override
Called by ThemeManager when the active theme changes.
void clear()
Remove all child components from this panel.
void setPosition(const sf::Vector2f &position) override
Move the panel and shift all children by the same delta.
bool removeComponent(Core &child)
Remove a child component from this panel.
void setVisible(bool visible) override
void addRef(Core &child)
Alias for addUntracked(). Kept for compatibility.
Rectangle with an attached manifest.
const sf::Vector2f & getSize() const
Vector2< float > Vector2f
Universal design token set applied across all Themeable components.