]> Dogcows Code - chaz/openbox/blob - otk/rect.hh
kill some whitespace
[chaz/openbox] / otk / rect.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __rect_hh
3 #define __rect_hh
4
5 #include "point.hh"
6 #include "size.hh"
7
8 namespace otk {
9
10 class Rect {
11 Point _p;
12 Size _s;
13 public:
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) {}
19
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(); }
24
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; }
29
30 inline const Point& position() const { return _p; }
31 inline const Size& size() const { return _s; }
32
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; }
35 };
36
37 }
38
39 #endif // __rect_hh
This page took 0.033385 seconds and 4 git commands to generate.