2023-11-04 18:03:05 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Vector2D.hpp"
|
|
|
|
#include "../SharedDefs.hpp"
|
2023-11-05 18:32:27 +01:00
|
|
|
#include "../includes.hpp"
|
2023-11-04 18:03:05 +01:00
|
|
|
|
|
|
|
class CBox {
|
|
|
|
public:
|
|
|
|
CBox(double x_, double y_, double w_, double h_) {
|
|
|
|
x = x_;
|
|
|
|
y = y_;
|
|
|
|
w = w_;
|
|
|
|
h = h_;
|
|
|
|
}
|
|
|
|
|
|
|
|
CBox() {
|
|
|
|
w = 0;
|
|
|
|
h = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
CBox(const wlr_box& box) {
|
|
|
|
x = box.x;
|
|
|
|
y = box.y;
|
|
|
|
w = box.width;
|
|
|
|
h = box.height;
|
|
|
|
}
|
|
|
|
|
|
|
|
CBox(const double d) {
|
|
|
|
x = d;
|
|
|
|
y = d;
|
|
|
|
w = d;
|
|
|
|
h = d;
|
|
|
|
}
|
|
|
|
|
2023-11-04 22:45:34 +01:00
|
|
|
CBox(const Vector2D& pos, const Vector2D& size) {
|
|
|
|
x = pos.x;
|
|
|
|
y = pos.y;
|
|
|
|
w = size.x;
|
|
|
|
h = size.y;
|
|
|
|
}
|
|
|
|
|
2023-11-04 18:03:05 +01:00
|
|
|
wlr_box wlr();
|
|
|
|
wlr_box* pWlr();
|
|
|
|
|
|
|
|
CBox& applyFromWlr();
|
|
|
|
CBox& scale(double scale);
|
|
|
|
CBox& scaleFromCenter(double scale);
|
|
|
|
CBox& scale(const Vector2D& scale);
|
|
|
|
CBox& translate(const Vector2D& vec);
|
|
|
|
CBox& round();
|
|
|
|
CBox& transform(const wl_output_transform t, double w, double h);
|
|
|
|
CBox& addExtents(const SWindowDecorationExtents& e);
|
|
|
|
|
|
|
|
Vector2D middle() const;
|
2023-11-04 22:45:34 +01:00
|
|
|
Vector2D pos() const;
|
|
|
|
Vector2D size() const;
|
2023-11-04 18:03:05 +01:00
|
|
|
|
|
|
|
bool containsPoint(const Vector2D& vec) const;
|
|
|
|
bool empty() const;
|
|
|
|
|
|
|
|
double x = 0, y = 0;
|
|
|
|
union {
|
|
|
|
double w;
|
|
|
|
double width;
|
|
|
|
};
|
|
|
|
union {
|
|
|
|
double h;
|
|
|
|
double height;
|
|
|
|
};
|
|
|
|
|
2023-11-04 22:45:34 +01:00
|
|
|
//
|
|
|
|
bool operator==(const CBox& rhs) const {
|
|
|
|
return x == rhs.x && y == rhs.y && w == rhs.w && h == rhs.h;
|
|
|
|
}
|
|
|
|
|
2023-11-04 18:03:05 +01:00
|
|
|
private:
|
|
|
|
CBox roundInternal();
|
|
|
|
|
|
|
|
wlr_box m_bWlrBox;
|
2023-11-05 18:32:27 +01:00
|
|
|
};
|