16#ifndef AEONGUI_DOCUMENT_H
17#define AEONGUI_DOCUMENT_H
24#include "aeongui/Canvas.hpp"
25#include "aeongui/StyleSheet.hpp"
26#include "aeongui/dom/Node.hpp"
27#include "aeongui/dom/DOMString.hpp"
28#include "aeongui/dom/USVString.hpp"
29#include "aeongui/dom/Element.hpp"
47 DLL
void Load (
const USVString& aFilename );
62 DLL
void Draw (
Canvas& aCanvas,
const std::function<
void (
const Node& ) >& aPreDraw )
const;
70 DLL
const USVString&
url()
const;
102 mDirtyElements.push_back ( aElement );
109 return mFullDirty || !mDirtyElements.empty();
123 return mDirtyElements;
129 mDirtyElements.clear();
136 StyleSheetPtr mStyleSheet{};
138 double mDocumentTime{0.0};
139 bool mFullDirty{
true};
140 std::vector<Element*> mDirtyElements{};
Abstract 2D rendering surface.
Definition Canvas.hpp:40
void MarkDirty()
Mark the entire document as needing a full redraw.
Definition Document.hpp:89
Element * getElementById(const DOMString &aElementId) const
Find an element by its ID attribute.
Definition Document.cpp:260
~Document()
Destructor. Unloads the document.
Definition Document.cpp:220
bool IsFullDirty() const
Check whether a full (non-partial) redraw is needed.
Definition Document.hpp:114
void AdvanceTime(double aDeltaTime)
Advance animation time and update all animations.
Definition Document.cpp:225
void Draw(Canvas &aCanvas) const
Draw the document onto a canvas.
Definition Document.cpp:235
bool IsDirty() const
Check whether the document needs redrawing.
Definition Document.hpp:107
css_stylesheet * GetStyleSheet() const
Get the document-level CSS stylesheet.
Definition Document.cpp:197
void Load(const USVString &aFilename)
Load a document from a file.
Definition Document.cpp:109
Document()
Default constructor. Creates an empty document.
void ClearDirty()
Clear the dirty flag after a redraw.
Definition Document.hpp:126
const USVString & url() const
Get the document URL.
Definition Document.cpp:192
const std::vector< Element * > & GetDirtyElements() const
Get the list of elements dirtied since the last draw.
Definition Document.hpp:121
void MarkElementDirty(Element *aElement)
Mark a specific element as needing redraw.
Definition Document.hpp:100
NodeType nodeType() const final
Get the node type (always DOCUMENT_NODE).
Definition Document.cpp:98
Base class for DOM elements.
Definition Element.hpp:46
NodeType
DOM node type constants.
Definition Node.hpp:46
Node(Node *aParent=nullptr)
Construct a node with an optional parent.
Definition Node.cpp:29