-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelement.h
More file actions
41 lines (28 loc) · 1.06 KB
/
Copy pathelement.h
File metadata and controls
41 lines (28 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// SPDX-License-Identifier: MIT
// Copyright (c) 2026 Diego Lopes <diego95lopes@gmail.com>
#pragma once
#include <string>
#include <vector>
#include "animation.h"
#include "types.hpp"
class IElement {
public:
virtual ~IElement() = default;
const std::string& GetId() const { return m_id; }
void SetId(const std::string& id) { m_id = id; }
IElement* GetParent() const { return m_parent; }
virtual void SetParent(IElement* parent);
const std::vector<IElement*>& GetChildren() const { return m_children; }
void AddChild(IElement* element);
void RemoveChild(IElement* element);
virtual Point GetGlobalPosition() const { return {0.0, 0.0}; }
virtual void Render(cairo_t* ctx, const AnimatedTransform& xf,
double timer, bool isOut) const {}
virtual void ApplyClipping(cairo_t* ctx, const AnimatedTransform& xf) const {}
protected:
void AddChildDirect(IElement* child);
void RemoveChildDirect(IElement* child);
std::string m_id;
IElement* m_parent{nullptr};
std::vector<IElement*> m_children;
};