|
Wt
3.7.1
|
A value class that defines a rectangle. More...
#include <Wt/WRectF>

Public Member Functions | |
| WRectF () | |
| Default constructor. More... | |
| WRectF (double x, double y, double width, double height) | |
| Creates a rectangle. More... | |
| WRectF (const WPointF &topLeft, const WPointF &bottomRight) | |
| Creates a rectangle. More... | |
| bool | operator== (const WRectF &rhs) const |
| Comparison operator. | |
| bool | isNull () const |
| Checks for a null rectangle. More... | |
| bool | isEmpty () const |
| Determines whether or not this rectangle is empty. More... | |
| void | setX (double x) |
| Sets the X-position of the left side. More... | |
| void | setY (double y) |
| Sets the Y-position of the top side. More... | |
| void | setWidth (double width) |
| Sets the width. More... | |
| void | setHeight (double height) |
| Sets the Y-position of the top side. More... | |
| double | x () const |
| Returns the X-position (left side offset). More... | |
| double | y () const |
| Returns the Y-position (top side offset). More... | |
| double | width () const |
| Returns the width. More... | |
| double | height () const |
| Returns the height. More... | |
| double | left () const |
| Returns the X position (left side offset). More... | |
| double | top () const |
| Returns the Y position (top side offset). More... | |
| double | right () const |
| Returns the the right side offset. More... | |
| double | bottom () const |
| Returns the bottom side offset. More... | |
| WPointF | topLeft () const |
| Returns the top left point. More... | |
| WPointF | topRight () const |
| Returns the top right point. More... | |
| WPointF | center () const |
| Returns the center point. | |
| WPointF | bottomLeft () const |
| Returns the bottom left point. More... | |
| WPointF | bottomRight () const |
| Returns the bottom right point. More... | |
| bool | contains (const WPointF &p) const |
| Tests if a rectangle contains a point. More... | |
| bool | contains (double x, double y) const |
| Tests if a rectangle contains a point. More... | |
| bool | intersects (const WRectF &other) const |
| Tests if two rectangles intersect. | |
| WRectF | united (const WRectF &other) const |
| Makes the union of to rectangles. More... | |
| WRectF | normalized () const |
| Returns a normalized rectangle. More... | |
| virtual std::string | jsValue () const WT_CXX11ONLY(override) |
| Returns a JavaScript representation of the value of this object. More... | |
Public Member Functions inherited from Wt::WJavaScriptExposableObject | |
| bool | isJavaScriptBound () const |
| Returns whether this object is JavaScript bound. More... | |
| std::string | jsRef () const |
| Returns a JavaScript reference to this object. More... | |
A value class that defines a rectangle.
The rectangle is defined by a top-left point and a width and height.
A WRectF is JavaScript exposable. If a WRectF is JavaScript bound, it can be accessed in your custom JavaScript code through its handle's jsRef(). A rectangle is represented in JavaScript as an array of four elements (x,y,width,height), e.g. a rectangle WRectF(10,20,30,40) will be represented in JavaScript as:
| 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 |
Returns the bottom side offset.
| bool Wt::WRectF::contains | ( | const WPointF & | p | ) | const |
Tests if a rectangle contains a point.
| bool Wt::WRectF::contains | ( | double | x, |
| double | y | ||
| ) | const |
Tests if a rectangle contains a point.
| double Wt::WRectF::height | ( | ) | const |
Returns the height.
| bool Wt::WRectF::isEmpty | ( | ) | const |
Determines whether or not this rectangle is empty.
A rectangle is empty if its width and height are zero.
A rectangle that isJavaScriptBound() is JavaScript bound is never empty.
| bool Wt::WRectF::isNull | ( | ) | const |
|
overridevirtual |
Returns a JavaScript representation of the value of this object.
Implements Wt::WJavaScriptExposableObject.
| WRectF Wt::WRectF::normalized | ( | ) | const |
Returns a normalized rectangle.
A normalized rectangle has a positive width and height.
This method supports JavaScript bound rectangles.
| double Wt::WRectF::right | ( | ) | const |
Returns the the right side offset.
| void Wt::WRectF::setHeight | ( | double | height | ) |
Sets the Y-position of the top side.
The bottom side of the rectangle may move, but this does not affect the Y position of the top side.
| WException | if the rectangle is JavaScript bound |
| void Wt::WRectF::setWidth | ( | double | width | ) |
Sets the width.
The right side of the rectangle may move, but this does not affect the left side.
| WException | if the rectangle is JavaScript bound |
| 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.
| WException | if the rectangle is JavaScript bound |
| 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.
| WException | if the rectangle is JavaScript bound |
Makes the union of to rectangles.
| double Wt::WRectF::width | ( | ) | const |
Returns the width.
| double Wt::WRectF::x | ( | ) | const |
1.8.13