AeonGUI
A portable video game graphic user interface library.
Loading...
Searching...
No Matches
DOMRectReadOnly.hpp
1/*
2Copyright (C) 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_DOMRECTREADONLY_HPP
17#define AEONGUI_DOMRECTREADONLY_HPP
18
19#include "aeongui/Platform.hpp"
20#include "DOMString.hpp"
21
22namespace AeonGUI
23{
24 namespace DOM
25 {
32 {
33 public:
40 DOMRectReadOnly ( float x = 0.0f, float y = 0.0f, float width = 0.0f, float height = 0.0f );
43
46 float x() const;
49 float y() const;
52 float width() const;
55 float height() const;
58 float top() const;
61 float right() const;
64 float bottom() const;
67 float left() const;
68
74 template <typename T>
75 static DOMRectReadOnly fromRect ( const T& rect )
76 {
77 return DOMRectReadOnly ( rect.x(), rect.y(), rect.width(), rect.height() );
78 }
79
83 DOMString toJSON() const;
84
85 protected:
86 float mX{};
87 float mY{};
88 float mWidth{};
89 float mHeight{};
90 };
91 }
92}
93
94#endif
Platform-specific DLL import/export macros and compiler helpers.
float y() const
Get the Y coordinate.
Definition DOMRectReadOnly.cpp:32
float mHeight
Rectangle height.
Definition DOMRectReadOnly.hpp:89
static DOMRectReadOnly fromRect(const T &rect)
Create a DOMRectReadOnly from any rect-like object.
Definition DOMRectReadOnly.hpp:75
float x() const
Get the X coordinate.
Definition DOMRectReadOnly.cpp:28
float mX
X coordinate.
Definition DOMRectReadOnly.hpp:86
float mY
Y coordinate.
Definition DOMRectReadOnly.hpp:87
float left() const
Get the left edge (min of x and x+width).
Definition DOMRectReadOnly.cpp:56
DOMRectReadOnly(float x=0.0f, float y=0.0f, float width=0.0f, float height=0.0f)
Construct a rectangle.
Definition DOMRectReadOnly.cpp:23
float top() const
Get the top edge (min of y and y+height).
Definition DOMRectReadOnly.cpp:44
float width() const
Get the width.
Definition DOMRectReadOnly.cpp:36
float right() const
Get the right edge (max of x and x+width).
Definition DOMRectReadOnly.cpp:48
float height() const
Get the height.
Definition DOMRectReadOnly.cpp:40
float bottom() const
Get the bottom edge (max of y and y+height).
Definition DOMRectReadOnly.cpp:52
virtual ~DOMRectReadOnly()
Destructor.
float mWidth
Rectangle width.
Definition DOMRectReadOnly.hpp:88