24#include "aeongui/AttributeMap.hpp"
25#include "aeongui/dom/EventTarget.hpp"
61 DLL
Node (
Node* aParent =
nullptr );
109 DLL
void TraverseDepthFirstPreOrder (
const std::function<
void (
const Node& ) >& aPreamble,
const std::function<
void (
const Node& ) >& aPostamble,
const std::function<
bool (
const Node& ) >& aUnaryPredicate )
const;
125 DLL
virtual void OnLoad ();
155 const std::vector<std::unique_ptr<Node>>&
childNodes()
const;
158 DLL
virtual void OnAncestorChanged();
160 std::vector<std::unique_ptr<Node>> mChildren{};
161 mutable std::vector<std::unique_ptr<Node>>::size_type mIterator{ 0 };
Abstract 2D rendering surface.
Definition Canvas.hpp:39
Base class for objects that can receive DOM events.
Definition EventTarget.hpp:58
Base class for all nodes in the DOM tree.
Definition Node.hpp:40
void TraverseDepthFirstPreOrder(const std::function< void(const Node &) > &aPreamble, const std::function< void(const Node &) > &aPostamble) const
Traverse pre-order with pre/post callbacks (const).
void TraverseDepthFirstPostOrder(const std::function< void(Node &) > &aAction)
Traverse the tree depth-first in post-order.
virtual void DrawStart(Canvas &aCanvas) const
Begin drawing this node on the canvas.
Definition Node.cpp:38
Node * AddNode(std::unique_ptr< Node > aNode)
Add a child node.
Definition Node.cpp:198
void TraverseDepthFirstPreOrder(const std::function< void(Node &) > &aPreamble, const std::function< void(Node &) > &aPostamble, const std::function< bool(Node &) > &aUnaryPredicate)
Traverse pre-order with pre/post callbacks and a predicate filter.
virtual void DrawFinish(Canvas &aCanvas) const
Finish drawing this node on the canvas.
Definition Node.cpp:44
std::unique_ptr< Node > RemoveNode(const Node *aNode)
Remove a child node.
Definition Node.cpp:210
virtual void OnLoad()
Definition Node.cpp:50
void TraverseDepthFirstPreOrder(const std::function< void(const Node &) > &aAction) const
Traverse the tree depth-first in pre-order (const).
virtual NodeType nodeType() const =0
Get the node type.
virtual void OnUnload()
Definition Node.cpp:55
NodeType
DOM node type constants.
Definition Node.hpp:44
@ ENTITY_NODE
An Entity node (legacy).
Definition Node.hpp:50
@ ATTRIBUTE_NODE
An Attribute node (legacy).
Definition Node.hpp:46
@ CDATA_SECTION_NODE
A CDATASection node.
Definition Node.hpp:48
@ TEXT_NODE
A Text node.
Definition Node.hpp:47
@ COMMENT_NODE
A Comment node.
Definition Node.hpp:52
@ DOCUMENT_TYPE_NODE
A DocumentType node.
Definition Node.hpp:54
@ ENTITY_REFERENCE_NODE
An EntityReference node (legacy).
Definition Node.hpp:49
@ NOTATION_NODE
A Notation node (legacy).
Definition Node.hpp:56
@ PROCESSING_INSTRUCTION_NODE
A ProcessingInstruction node.
Definition Node.hpp:51
@ DOCUMENT_FRAGMENT_NODE
A DocumentFragment node.
Definition Node.hpp:55
@ DOCUMENT_NODE
A Document node.
Definition Node.hpp:53
@ ELEMENT_NODE
An Element node.
Definition Node.hpp:45
virtual bool IsDrawEnabled() const
Definition Node.cpp:33
const std::vector< std::unique_ptr< Node > > & childNodes() const
Get the list of child nodes.
Definition Node.cpp:28
Node * parentElement() const
Get the parent element (same as parentNode for elements).
Definition Node.cpp:64
Node * parentNode() const
Get the parent node.
Definition Node.cpp:60
void TraverseDepthFirstPostOrder(const std::function< void(const Node &) > &aAction) const
Traverse the tree depth-first in post-order (const).
void TraverseDepthFirstPreOrder(const std::function< void(Node &) > &aAction)
Traverse the tree depth-first in pre-order.
void TraverseDepthFirstPreOrder(const std::function< void(Node &) > &aPreamble, const std::function< void(Node &) > &aPostamble)
Traverse pre-order with separate pre and post callbacks.
Node(Node *aParent=nullptr)
Construct a node with an optional parent.
Definition Node.cpp:25
void TraverseDepthFirstPreOrder(const std::function< void(const Node &) > &aPreamble, const std::function< void(const Node &) > &aPostamble, const std::function< bool(const Node &) > &aUnaryPredicate) const
Traverse pre-order with pre/post callbacks and predicate (const).