X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FGeometry.cc;h=db1de4067015db4c69919065448f4a31d62fdf0e;hb=62e178416108c41f8d3e7c1a5fc113c7e7724543;hp=df8fc31dad8ffba4902024d916eebd1cd1be076d;hpb=44e3582d5e08556c7b1136cfd9a49546cf5fcae0;p=chaz%2Fopenbox diff --git a/src/Geometry.cc b/src/Geometry.cc index df8fc31d..db1de406 100644 --- a/src/Geometry.cc +++ b/src/Geometry.cc @@ -70,10 +70,20 @@ void Rect::setSize(const Size &size) { m_size = size; } +void Rect::setSize(const unsigned int w, const unsigned int h) { + m_size.setW(w); + m_size.setH(h); +} + void Rect::setOrigin(const Point &origin) { m_origin = origin; } +void Rect::setOrigin(const int x, const int y) { + m_origin.setX(x); + m_origin.setY(y); +} + void Rect::setX(const int x) { m_origin.setX(x); } @@ -97,3 +107,39 @@ bool Rect::Intersect(const Rect &r) const { (y() < (r.y()+r.h()) ) && ( (y()+h()) > r.y()); } + +Rect Rect::Inflate(const unsigned int i) const { + return Rect(x(), y(), w()+i, h()+i); +} + +Rect Rect::Inflate(const unsigned int iw, const unsigned int ih) const { + return Rect(x(), y(), w()+iw, h()+ih); +} + +Rect Rect::Inflate(const Size &i) const { + return Rect(x(), y(), w()+i.w(), h()+i.h()); +} + +Rect Rect::Deflate(const unsigned int d) const { + return Rect(x(), y(), w()-d, h()-d); +} + +Rect Rect::Deflate(const unsigned int dw, const unsigned int dh) const { + return Rect(x(), y(), w()-dw, h()-dh); +} + +Rect Rect::Deflate(const Size &d) const { + return Rect(x(), y(), w()-d.w(), h()-d.h()); +} + +Rect Rect::Translate(const int t) const { + return Rect(x()+t, y()+t, w(), h()); +} + +Rect Rect::Translate(const int tx, const int ty) const { + return Rect(x()+tx, y()+ty, w(), h()); +} + +Rect Rect::Translate(const Point &t) const { + return Rect(x()+t.x(), y()+t.y(), w(), h()); +}