#include <objects.h>
Public Methods | |
TRect (int ax, int ay, int bx, int by) | |
TRect (TPoint p1, TPoint p2) | |
TRect () | |
void | move (int aDX, int aDY) |
void | grow (int aDX, int aDY) |
void | intersect (const TRect &r) |
void | Union (const TRect &r) |
Boolean | contains (const TPoint &p) const |
Boolean | operator== (const TRect &r) const |
Boolean | operator!= (const TRect &r) const |
Boolean | isEmpty () |
Public Attributes | |
TPoint | a |
TPoint | b |
TRect is used to hold two coordinates on the screen, which usually specify the upper left corner and the lower right corner of views. Sometimes the second coordinate speficy the size (extension) of the view. The two coordinates are named a and b.
TRect has several inline member functions for manipulating rectangles. The operators == and != are overloaded to provide the comparison of two rectangles in a natural way.
Definition at line 128 of file objects.h.
|
Constructor. Initializes the rectangle coordinates using the four integer parameters. |
|
Constructor. Initializes the rectangle coordinates using two points.
|
|
Constructor. Does nothing. The two coordinates are not initialized, so they contain garbage. |
|
Calculates the union between this rectangle and the `r' parameter rectangle. The resulting rectangle is the smallest rectangle which contains both this rectangle and the `r' rectangle. |
|
Returns True if the calling rectangle (including its boundary) contains the point `p', returns False otherwise.
|
|
Enlarges the rectangle by a specified value. Changes the size of the calling rectangle by subtracting `aDX' from a.x, adding `aDX' to b.x, subtracting `aDY' from a.y, and adding `aDY' to b.y. The left side is left-moved by `aDX' units and the right side is right-moved by `aDX' units. In a similar way the upper side is upper-moved by `aDY' units and the bottom side is bottom-moved by `aDY' units. |
|
Calculates the intersection between this rectangle and the parameter rectangle. The resulting rectangle is the largest rectangle which contains both part of this rectangle and part of the parameter rectangle. |
|
Checks if the rectangle is empty, i.e. if the first coordinate is greater than the second one. Empty means that (a.x >= b.x || a.y >= b.y). |
|
Moves the rectangle to a new position. The two parameters are added to the two old coordinates as delta values. Both parameters can be negative or positive. |
|
Returns True if `r' is not the same as the calling rectangle; otherwise, returns False. |
|
Returns True if `r' is the same as the calling rectangle; otherwise, returns False. |
|
Is the point defining the top-left corner of a rectangle on the screen. |
|
Is the point defining the bottom-right corner of a rectangle on the screen. |