Files
Seele/src/Engine/UI/Elements/Element.h
T

43 lines
1.1 KiB
C++
Raw Normal View History

2021-09-23 10:10:39 +02:00
#pragma once
2023-02-13 14:56:13 +01:00
#include "Containers/Array.h"
#include "Math/Math.h"
2024-06-09 12:20:04 +02:00
#include "MinimalEngine.h"
2021-09-23 10:10:39 +02:00
2024-06-09 12:20:04 +02:00
namespace Seele {
namespace UI {
// Element defines any part of the UI
2021-09-23 10:10:39 +02:00
DECLARE_REF(Element)
2021-10-05 12:24:41 +02:00
DECLARE_REF(System)
2024-06-09 12:20:04 +02:00
class Element {
public:
2021-09-23 10:10:39 +02:00
Element();
virtual ~Element();
void setParent(PElement element);
PElement getParent() const;
void addChild(PElement element);
2022-04-13 13:01:35 +02:00
void removeChild(PElement element);
2021-09-23 10:10:39 +02:00
const Array<PElement> getChildren();
void clear();
void setEnabled(bool newEnabled);
bool isEnabled() const;
// maybe not the healthiest inteface
// non-const version
2023-01-21 18:43:21 +01:00
Rect& getBoundingBox();
2021-09-23 10:10:39 +02:00
// The bounding box describes the relative size of any Element
// relative to the total view, meaning a bounding box of (0,0), (1,1)
// would take up the entire view
2023-01-21 18:43:21 +01:00
const Rect getBoundingBox() const;
2024-06-09 12:20:04 +02:00
protected:
2023-01-21 18:43:21 +01:00
Rect boundingBox;
2021-09-29 22:12:56 +02:00
bool dirty;
2024-06-09 12:20:04 +02:00
2021-09-23 10:10:39 +02:00
bool enabled;
2021-10-05 12:24:41 +02:00
PSystem system;
2021-09-23 10:10:39 +02:00
PElement parent;
Array<PElement> children;
friend class RenderElement;
};
DEFINE_REF(Element)
} // namespace UI
} // namespace Seele