added Rect::moveTo methods

svn-id: r13190
This commit is contained in:
Max Horn 2004-03-04 22:26:31 +00:00
parent 601723408f
commit af2f29f55c

View File

@ -78,7 +78,7 @@ struct Rect {
@return true if the given point is inside this rectangle, false otherwise @return true if the given point is inside this rectangle, false otherwise
*/ */
bool contains(const Point & p) const { bool contains(const Point & p) const {
return (left <= p.x) && (p.x < right) && (top <= p.y) && (p.y < bottom); return contains(p.x, p.y);
} }
/*! @brief check if given rectangle intersects with this rectangle /*! @brief check if given rectangle intersects with this rectangle
@ -137,6 +137,17 @@ struct Rect {
bool isValidRect() const { bool isValidRect() const {
return (left <= right && top <= bottom); return (left <= right && top <= bottom);
} }
void moveTo(int16 x, int16 y) {
bottom += y - top;
right += x - left;
top = y;
left = x;
}
void moveTo(const Point & p) {
moveTo(p.x, p.y);
}
}; };
} // End of namespace Common } // End of namespace Common