Loading...
Searching...
No Matches
Panel.h
Go to the documentation of this file.
1//
2// Created by Dave Smith on 4/1/26.
3//
4
5#ifndef MALENA_PANEL_H
6#define MALENA_PANEL_H
7
8#pragma once
9
14#include <unordered_map>
15
16namespace ml {
17
19
42 class MALENA_API Panel : public CoreManager<Core>, public RectangleWith<PanelManifest>, public Themeable
43 {
44 // Maps each child pointer to its position relative to this panel's origin
45 std::unordered_map<Core*, sf::Vector2f> _relativePositions;
46
47 public:
49
57 void addComponent(Core& child);
58
62 bool removeComponent(Core& child);
63
67 void setPosition(const sf::Vector2f& position) override;
68
69 void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
70
71 protected:
72 void onThemeApplied(const Theme& theme) override;
73 };
74
75} // ml
76
77#endif //PANEL_H
Virtual base class for all Malena framework objects.
Definition Core.h:69
Static, type-safe collection manager for Core-derived objects.
Definition CoreManager.h:56
Base class for all Malena manifests.
Definition Manifest.h:51
void addComponent(Core &child)
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 onThemeApplied(const Theme &theme) override
Called by ThemeManager when the active theme changes.
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.
Rectangle with an attached manifest.
Definition Rectangle.h:68
#define MALENA_API
Definition Component.h:22
Vector2< float > Vector2f
Universal design token set applied across all Themeable components.
Definition Theme.h:70