Utility class that defines a rectangle. More...
#include <Wt/WRectF>
Public Member Functions | |
WRectF () | |
Default constructor. | |
WRectF (double x, double y, double width, double height) | |
Creates a rectangle. | |
WRectF (const WPointF &topLeft, const WPointF &bottomRight) | |
Creates a rectangle. | |
bool | operator== (const WRectF &rhs) const |
Comparison operator. | |
bool | isNull () const |
Checks for a null rectangle. | |
bool | isEmpty () const |
Determines whether or not this rectangle is empty. | |
void | setX (double x) |
Sets the X-position of the left side. | |
void | setY (double y) |
Sets the Y-position of the top side. | |
void | setWidth (double width) |
Sets the width. | |
void | setHeight (double height) |
Sets the Y-position of the top side. | |
double | x () const |
Returns the X-position of the left side. | |
double | y () const |
Returns the Y-position of the top side. | |
double | width () const |
Returns the width. | |
double | height () const |
Returns the height. | |
double | left () const |
Returns the X position of the left side. | |
double | top () const |
Returns the Y position of the top side. | |
double | right () const |
Returns the X position of the right side. | |
double | bottom () const |
Returns the Y position of the bottom side. | |
WPointF | topLeft () const |
Returns the top left point. | |
WPointF | topRight () const |
Returns the top right point. | |
WPointF | center () const |
Returns the center point. | |
WPointF | bottomLeft () const |
Returns the bottom left point. | |
WPointF | bottomRight () const |
Returns the bottom right point. | |
bool | contains (const WPointF &p) const |
Tests if a rectangle contains a point. | |
bool | contains (double x, double y) const |
Tests if a rectangle contains a point. | |
bool | intersects (const WRectF &other) const |
Tests if two rectangles intersect. | |
WRectF | united (const WRectF &other) const |
Makes the union of to rectangles. | |
WRectF | normalized () const |
Returns a normalized rectangle. |
Utility class that defines a rectangle.
The rectangle is defined by a top-left point and a width and height.
Wt::WRectF::WRectF | ( | ) |
Wt::WRectF::WRectF | ( | double | x, |
double | y, | ||
double | width, | ||
double | height | ||
) |
Creates a rectangle.
Constructs a rectangle with top left point (x, y
) and size width x height
.
Creates a rectangle.
Constructs a rectangle from the two points topLeft
and bottomRight
.
If you want to create a rectangle from two arbitrary corner points, you can use this constructor too, but should call normalized() afterwords.
double Wt::WRectF::bottom | ( | ) | const [inline] |
Returns the Y position of the bottom side.
WPointF Wt::WRectF::bottomRight | ( | ) | const |
double Wt::WRectF::height | ( | ) | const [inline] |
Returns the height.
bool Wt::WRectF::isEmpty | ( | ) | const |
Determines whether or not this rectangle is empty.
A rectangle is empty if its width or its height is less than or equal to zero.
bool Wt::WRectF::isNull | ( | ) | const |
Checks for a null rectangle.
double Wt::WRectF::left | ( | ) | const [inline] |
WRectF Wt::WRectF::normalized | ( | ) | const |
Returns a normalized rectangle.
A normalized rectangle has a positive width and height.
double Wt::WRectF::right | ( | ) | const [inline] |
Returns the X position of the right side.
void Wt::WRectF::setHeight | ( | double | height ) | [inline] |
Sets the Y-position of the top side.
The bottom side of the rectangle may move, but does not change the Y position of the top side.
void Wt::WRectF::setWidth | ( | double | width ) | [inline] |
Sets the width.
The right side of the rectangle may move, but does not change the X position of the left side.
void Wt::WRectF::setX | ( | double | x ) |
Sets the X-position of the left side.
The right side of the rectangle does not move, and as a result, the rectangle may be resized.
void Wt::WRectF::setY | ( | double | y ) |
Sets the Y-position of the top side.
The bottom side of the rectangle does not move, and as a result, the rectangle may be resized.
double Wt::WRectF::top | ( | ) | const [inline] |
double Wt::WRectF::width | ( | ) | const [inline] |
Returns the width.
double Wt::WRectF::x | ( | ) | const [inline] |