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

70 lines
963 B
C++
Raw Normal View History

2021-08-21 18:02:53 +02:00
#include "Element.h"
#include "UI/System.h"
2022-04-18 18:08:38 +02:00
#include "Graphics/Graphics.h"
2021-08-21 18:02:53 +02:00
using namespace Seele;
using namespace Seele::UI;
Element::Element()
2022-01-12 14:40:26 +01:00
: dirty(false)
, enabled(false)
2021-08-21 18:02:53 +02:00
{
}
Element::~Element()
{
}
2022-04-13 13:01:35 +02:00
void Element::setParent(PElement element)
{
if(parent != nullptr)
{
parent->removeChild(this);
}
parent = element;
}
2021-10-15 23:12:29 +02:00
PElement Element::getParent() const
{
return parent;
}
2021-09-23 10:10:39 +02:00
void Element::addChild(PElement element)
2021-08-21 18:02:53 +02:00
{
2021-09-23 10:10:39 +02:00
children.add(element);
2021-08-21 18:02:53 +02:00
}
2022-04-13 13:01:35 +02:00
void Element::removeChild(PElement element)
{
children.remove(element, false);
}
2021-09-23 10:10:39 +02:00
const Array<PElement> Element::getChildren()
2021-08-21 18:02:53 +02:00
{
return children;
}
void Element::clear()
{
children.clear();
}
void Element::setEnabled(bool newEnabled)
{
enabled = newEnabled;
}
bool Element::isEnabled() const
{
return enabled;
2021-09-23 10:10:39 +02:00
}
Rect& Element::getBoundingBox()
{
return boundingBox;
}
const Rect Element::getBoundingBox() const
{
return boundingBox;
2021-08-21 18:02:53 +02:00
}