#include <rect.hh>
Definition at line 15 of file rect.hh.
Public Methods | |
Rect (void) | |
Constructs an invalid Rect. | |
Rect (int x, int y, int w, int h) | |
Constructs a Rect. | |
Rect (const Point &location, const Point &size) | |
Constructs a Rect from 2 Point objects. | |
Rect (const Rect &rect) | |
Constructs a Rect from another Rect. | |
Rect (const XRectangle &xrect) | |
Constructs a Rect from an XRectangle. | |
int | left (void) const |
Returns the left coordinate of the Rect. Identical to Rect::x. | |
int | top (void) const |
Returns the top coordinate of the Rect. Identical to Rect::y. | |
int | right (void) const |
Returns the right coordinate of the Rect. | |
int | bottom (void) const |
Returns the bottom coordinate of the Rect. | |
int | x (void) const |
The x component of the point defining the top left corner of the Rect. | |
int | y (void) const |
The y component of the point defining the top left corner of the Rect. | |
Point | location () const |
Returns the Point that defines the top left corner of the rectangle. | |
void | setX (int x) |
Sets the x coordinate of the Rect. | |
void | setY (int y) |
Sets the y coordinate of the Rect. | |
void | setPos (int x, int y) |
Sets the x and y coordinates of the Rect. | |
void | setPos (const Point &location) |
Sets the x and y coordinates of the Rect. | |
int | width (void) const |
The width of the Rect. | |
int | height (void) const |
The height of the Rect. | |
Point | size () const |
Returns the size of the Rect. | |
void | setWidth (int w) |
Sets the width of the Rect. | |
void | setHeight (int h) |
Sets the height of the Rect. | |
void | setSize (int w, int h) |
Sets the size of the Rect. | |
void | setSize (const Point &size) |
Sets the size of the Rect. | |
void | setRect (int x, int y, int w, int h) |
Sets the position and size of the Rect. | |
void | setRect (const Point &location, const Point &size) |
Sets the position and size of the Rect. | |
void | setCoords (int l, int t, int r, int b) |
Sets the position of all 4 sides of the Rect. | |
void | setCoords (const Point &tl, const Point &br) |
Sets the position of all 4 sides of the Rect. | |
bool | operator== (const Rect &a) |
Determines if two Rect objects are equal. | |
bool | operator!= (const Rect &a) |
Determines if two Rect objects are inequal. | |
Rect | operator| (const Rect &a) const |
Returns the union of two Rect objects. | |
Rect | operator & (const Rect &a) const |
Returns the intersection of two Rect objects. | |
Rect & | operator|= (const Rect &a) |
Sets the Rect to the union of itself with another Rect object. | |
Rect & | operator &= (const Rect &a) |
Sets the Rect to the intersection of itself with another Rect object. | |
bool | valid (void) const |
Returns if the Rect is valid. | |
bool | intersects (const Rect &a) const |
Determines if this Rect intersects another Rect. | |
bool | contains (int x, int y) const |
Determines if this Rect contains a point. | |
bool | contains (const Point &p) const |
Determines if this Rect contains a point. | |
bool | contains (const Rect &a) const |
Determines if this Rect contains another Rect entirely. | |
Private Attributes | |
int | _x1 |
The left coordinate of the Rect. | |
int | _y1 |
The top coordinate of the Rect. | |
int | _x2 |
The right coordinate of the Rect. | |
int | _y2 |
The bottom coordinate of the Rect. |
|
Constructs an invalid Rect.
Definition at line 18 of file rect.hh. References _x1, _x2, _y1, and _y2. Referenced by setRect().
|
|
Constructs a Rect.
Definition at line 28 of file rect.hh. References _x1, _x2, _y1, and _y2.
|
|
Constructs a Rect from 2 Point objects.
Definition at line 35 of file rect.hh. References _x1, _x2, _y1, _y2, size(), x(), and y().
|
|
Constructs a Rect from another Rect.
Definition at line 42 of file rect.hh. References _x1, _x2, _y1, and _y2.
|
|
Constructs a Rect from an XRectangle.
Definition at line 45 of file rect.hh. References _x1, _x2, _y1, _y2, height(), width(), x(), and y().
|
|
Returns the bottom coordinate of the Rect.
Definition at line 56 of file rect.hh. References _y2.
00056 { return _y2; } |
|
Determines if this Rect contains another Rect entirely. This rectangle contains the second rectangle if it is entirely within this rectangle's boundaries. Definition at line 145 of file rect.cc. References _x1, _x2, _y1, and _y2.
|
|
Determines if this Rect contains a point. The rectangle contains the point if it falls within the rectangle's boundaries.
Definition at line 139 of file rect.cc. References contains(), otk::Point::x(), and otk::Point::y().
00140 { 00141 return contains(p.x(), p.y()); 00142 } |
|
Determines if this Rect contains a point. The rectangle contains the point if it falls within the rectangle's boundaries.
Definition at line 132 of file rect.cc. References _x1, _x2, _y1, and _y2. Referenced by contains().
|
|
|
Determines if this Rect intersects another Rect. The rectangles intersect if any part of them overlaps.
Definition at line 125 of file rect.cc. References _x1, _x2, _y1, and _y2.
00126 {
00127 return std::max(_x1, a._x1) <= std::min(_x2, a._x2) &&
00128 std::max(_y1, a._y1) <= std::min(_y2, a._y2);
00129 }
|
|
Returns the left coordinate of the Rect. Identical to Rect::x.
Definition at line 50 of file rect.hh. References _x1.
00050 { return _x1; } |
|
Returns the Point that defines the top left corner of the rectangle.
Definition at line 63 of file rect.hh.
00063 { return Point(_x1, _y1); }
|
|
Returns the intersection of two Rect objects. The intersection of the rectangles will consist of just the area where the two rectangles overlap.
Definition at line 112 of file rect.cc. References _x1, _x2, _y1, and _y2.
00113 { 00114 Rect b; 00115 00116 b._x1 = std::max(_x1, a._x1); 00117 b._y1 = std::max(_y1, a._y1); 00118 b._x2 = std::min(_x2, a._x2); 00119 b._y2 = std::min(_y2, a._y2); 00120 00121 return b; 00122 } |
|
Sets the Rect to the intersection of itself with another Rect object. The intersection of the rectangles will consist of just the area where the two rectangles overlap.
Definition at line 195 of file rect.hh.
00195 { *this = *this & a; return *this; } |
|
Determines if two Rect objects are inequal.
Definition at line 163 of file rect.hh. References operator==().
00163 { return ! operator==(a); } |
|
Determines if two Rect objects are equal. The rectangles are considered equal if they are in the same position and are the same size. Definition at line 157 of file rect.hh. References _x1, _x2, _y1, and _y2. Referenced by operator!=().
|
|
Returns the union of two Rect objects. The union of the rectangles will consist of the maximimum area that the two rectangles can make up.
Definition at line 99 of file rect.cc. References _x1, _x2, _y1, and _y2.
00100 { 00101 Rect b; 00102 00103 b._x1 = std::min(_x1, a._x1); 00104 b._y1 = std::min(_y1, a._y1); 00105 b._x2 = std::max(_x2, a._x2); 00106 b._y2 = std::max(_y2, a._y2); 00107 00108 return b; 00109 } |
|
Sets the Rect to the union of itself with another Rect object. The union of the rectangles will consist of the maximimum area that the two rectangles can make up.
Definition at line 188 of file rect.hh.
00188 { *this = *this | a; return *this; } |
|
Returns the right coordinate of the Rect.
Definition at line 54 of file rect.hh. References _x2.
00054 { return _x2; } |
|
Sets the position of all 4 sides of the Rect.
Definition at line 90 of file rect.cc. References _x1, _x2, _y1, _y2, otk::Point::x(), and otk::Point::y().
|
|
Sets the position of all 4 sides of the Rect.
Definition at line 81 of file rect.cc. References _x1, _x2, _y1, and _y2.
|
|
Sets the height of the Rect.
Definition at line 49 of file rect.cc.
|
|
Sets the x and y coordinates of the Rect.
Definition at line 25 of file rect.cc. References _x1, _x2, _y1, _y2, otk::Point::x(), and otk::Point::y().
|
|
Sets the x and y coordinates of the Rect.
Definition at line 34 of file rect.cc. References _x1, _x2, _y1, and _y2. Referenced by ob::Client::internal_move(), otk::Widget::move(), ob::Client::toggleClientBorder(), and ob::Client::updateNormalHints().
|
|
Sets the position and size of the Rect.
Definition at line 75 of file rect.cc. References Rect().
00076 { 00077 *this = Rect(location, size); 00078 } |
|
Sets the position and size of the Rect.
Definition at line 69 of file rect.cc. References Rect(). Referenced by ob::Screen::calcArea(), otk::Widget::create(), and ob::Client::getArea().
00070 { 00071 *this = Rect(x, y, w, h); 00072 } |
|
Sets the size of the Rect.
Definition at line 62 of file rect.cc. References _x1, _x2, _y1, _y2, otk::Point::x(), and otk::Point::y().
|
|
Sets the size of the Rect.
Definition at line 55 of file rect.cc. References _x1, _x2, _y1, and _y2. Referenced by otk::Widget::configureHandler(), ob::Client::internal_resize(), and otk::ScreenInfo::ScreenInfo().
|
|
Sets the width of the Rect.
Definition at line 43 of file rect.cc.
|
|
Sets the x coordinate of the Rect.
Definition at line 11 of file rect.cc.
|
|
Sets the y coordinate of the Rect.
Definition at line 18 of file rect.cc.
|
|
Returns the size of the Rect.
Definition at line 96 of file rect.hh. Referenced by Rect(), and otk::Widget::render().
00096 { return Point(_x2 - _x1 + 1, _y2 - _y1 + 1); }
|
|
Returns the top coordinate of the Rect. Identical to Rect::y.
Definition at line 52 of file rect.hh. References _y1.
00052 { return _y1; } |
|
Returns if the Rect is valid. A rectangle is valid only if its right and bottom coordinates are larger than its left and top coordinates (i.e. it does not have a negative width or height).
Definition at line 204 of file rect.hh. References _x1, _x2, _y1, and _y2.
|
|
|
The x component of the point defining the top left corner of the Rect.
Definition at line 59 of file rect.hh. References _x1. Referenced by otk::Widget::adjustHorz(), ob::Frame::adjustPosition(), ob::Screen::changeWorkArea(), ob::Client::configureRequestHandler(), otk::Widget::create(), ob::Client::fullscreen(), ob::Client::internal_resize(), ob::Client::maximize(), ob::MouseData::MouseData(), Rect(), ob::Frame::releaseClient(), otk::Widget::resize(), otk::Widget::setGeometry(), otk::Widget::setHeight(), otk::Widget::setWidth(), and ob::Client::toggleClientBorder().
00059 { return _x1; } |
|
The y component of the point defining the top left corner of the Rect.
Definition at line 61 of file rect.hh. References _y1. Referenced by ob::Frame::adjustPosition(), otk::Widget::adjustVert(), ob::Screen::changeWorkArea(), ob::Client::configureRequestHandler(), otk::Widget::create(), ob::Client::fullscreen(), ob::Client::internal_resize(), ob::Client::maximize(), ob::MouseData::MouseData(), Rect(), ob::Frame::releaseClient(), otk::Widget::resize(), otk::Widget::setGeometry(), otk::Widget::setHeight(), otk::Widget::setWidth(), and ob::Client::toggleClientBorder().
00061 { return _y1; } |
|
The left coordinate of the Rect.
Definition at line 242 of file rect.hh. Referenced by contains(), intersects(), left(), operator &(), operator==(), operator|(), Rect(), setCoords(), setPos(), setSize(), setWidth(), setX(), valid(), width(), and x(). |
|
The right coordinate of the Rect.
Definition at line 246 of file rect.hh. Referenced by contains(), intersects(), operator &(), operator==(), operator|(), Rect(), right(), setCoords(), setPos(), setSize(), setWidth(), setX(), valid(), and width(). |
|
The top coordinate of the Rect.
Definition at line 244 of file rect.hh. Referenced by contains(), height(), intersects(), operator &(), operator==(), operator|(), Rect(), setCoords(), setHeight(), setPos(), setSize(), setY(), top(), valid(), and y(). |
|
The bottom coordinate of the Rect.
Definition at line 248 of file rect.hh. Referenced by bottom(), contains(), height(), intersects(), operator &(), operator==(), operator|(), Rect(), setCoords(), setHeight(), setPos(), setSize(), setY(), and valid(). |