1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
14 Rect() : _p(), _s() {}
15 Rect(const Point &p, const Size &s) : _p(p), _s(s) {}
16 Rect(const Rect &r) : _p(r._p), _s(r._s) {}
17 Rect(int x, int y, int w, int h)
18 : _p(x, y), _s(w, h) {}
20 inline int x() const { return _p.x(); }
21 inline int y() const { return _p.y(); }
22 inline int width() const { return _s.width(); }
23 inline int height() const { return _s.height(); }
25 inline int left() const { return _p.x(); }
26 inline int top() const { return _p.y(); }
27 inline int right() const { return _p.x() + _s.width() - 1; }
28 inline int bottom() const { return _p.y() + _s.height() - 1; }
30 inline const Point& position() const { return _p; }
31 inline const Size& size() const { return _s; }
33 bool operator==(const Rect &o) const { return _p == o._p && _s == o._s; }
34 bool operator!=(const Rect &o) const { return _p != o._p || _s != o._s; }