diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-12-05 14:16:22 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-05 14:16:22 +0000 |
| commit | 9264436f35e2c4e94adfdf2a8ea23a346ace3a65 (patch) | |
| tree | 9fe48ff4728060445e655d8a3b528999fd124ff8 /src/desktop/reserved/ReservedArea.hpp | |
| parent | d5c52ef58e57b371a9df8fd4404c5d55a1b26f34 (diff) | |
desktop: rewrite reserved area handling + improve tests (#12383)
Diffstat (limited to 'src/desktop/reserved/ReservedArea.hpp')
| -rw-r--r-- | src/desktop/reserved/ReservedArea.hpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/desktop/reserved/ReservedArea.hpp b/src/desktop/reserved/ReservedArea.hpp new file mode 100644 index 00000000..2aca595d --- /dev/null +++ b/src/desktop/reserved/ReservedArea.hpp @@ -0,0 +1,48 @@ +#pragma once + +#include "../../helpers/math/Math.hpp" +#include <array> + +namespace Desktop { + enum eReservedDynamicType : uint8_t { + RESERVED_DYNAMIC_TYPE_LS = 0, + RESERVED_DYNAMIC_TYPE_ERROR_BAR, + + RESERVED_DYNAMIC_TYPE_END, + }; + + class CReservedArea { + public: + CReservedArea() = default; + CReservedArea(const Vector2D& tl, const Vector2D& br); + CReservedArea(double top, double right, double bottom, double left); + CReservedArea(const CBox& parent, const CBox& child); + ~CReservedArea() = default; + + CBox apply(const CBox& other) const; + void applyip(CBox& other) const; + + void resetType(eReservedDynamicType); + void addType(eReservedDynamicType, const Vector2D& topLeft, const Vector2D& bottomRight); + void addType(eReservedDynamicType, const CReservedArea& area); + + double left() const; + double right() const; + double top() const; + double bottom() const; + + bool operator==(const CReservedArea& other) const; + + private: + void calculate(); + + Vector2D m_topLeft, m_bottomRight; + Vector2D m_initialTopLeft, m_initialBottomRight; + + struct SDynamicData { + Vector2D topLeft, bottomRight; + }; + + std::array<SDynamicData, RESERVED_DYNAMIC_TYPE_END> m_dynamicReserved; + }; +};
\ No newline at end of file |
