AeonGUI
A portable video game graphic user interface library.
Loading...
Searching...
No Matches
Window.hpp
1/*
2Copyright (C) 2019,2020,2023,2025,2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#ifndef AEONGUI_WINDOW_H
17#define AEONGUI_WINDOW_H
18#include <cstdint>
19#include <string>
20#include "aeongui/Platform.hpp"
21#include "aeongui/CairoCanvas.hpp"
22#include "aeongui/dom/EventTarget.hpp"
23#include "aeongui/dom/USVString.hpp"
24#include "aeongui/dom/Location.hpp"
25#include "aeongui/dom/Document.hpp"
26
27namespace AeonGUI
28{
29 namespace DOM
30 {
31 class Document;
39 class Window : public EventTarget
40 {
41 public:
43 DLL Window ();
48 DLL Window ( uint32_t aWidth, uint32_t aHeight );
50 DLL ~Window () override final;
55 DLL void ResizeViewport ( uint32_t aWidth, uint32_t aHeight );
59 DLL const uint8_t* GetPixels() const;
62 DLL size_t GetWidth() const;
65 DLL size_t GetHeight() const;
68 DLL size_t GetStride() const;
70 DLL void Draw();
75 DLL const Document* document() const;
79 DLL Location& location() const;
81 private:
82 void OnLocationChanged ( const Location& location );
83 Location mLocation{std::bind ( &Window::OnLocationChanged, this, std::placeholders::_1 ) };
84 Document mDocument{};
85 CairoCanvas mCanvas{};
86 };
87 }
88}
89#endif
Platform-specific DLL import/export macros and compiler helpers.
Cairo-backed Canvas implementation.
Definition CairoCanvas.hpp:35
Represents a DOM Document.
Definition Document.hpp:38
Base class for objects that can receive DOM events.
Definition EventTarget.hpp:58
Represents the URL of the active document.
Definition Location.hpp:33
~Window() override final
Destructor.
size_t GetWidth() const
Get the window width in pixels.
Definition Window.cpp:64
Location & location() const
Get the Location object.
Definition Window.cpp:44
void Draw()
Render the current document to the internal canvas.
Definition Window.cpp:77
size_t GetHeight() const
Get the window height in pixels.
Definition Window.cpp:68
const Document * document() const
Get the associated Document.
Definition Window.cpp:39
Window()
Default constructor. Creates an empty window.
size_t GetStride() const
Get the stride (bytes per row) of the pixel buffer.
Definition Window.cpp:72
void ResizeViewport(uint32_t aWidth, uint32_t aHeight)
Resize the rendering viewport.
Definition Window.cpp:54
const uint8_t * GetPixels() const
Get a pointer to the rendered pixel data.
Definition Window.cpp:59