Wt: Wt::WRectF Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions
Wt::WRectF Class Reference
Painting system

A value class that defines a rectangle. More...

`#include <Wt/WRectF>`

List of all members.

## 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 (left side offset).
double | y () const
| Returns the Y-position (top side offset).
double | width () const
| Returns the width.
double | height () const
| Returns the height.
double | left () const
| Returns the X position (left side offset).
double | top () const
| Returns the Y position (top side offset).
double | right () const
| Returns the the right side offset.
double | bottom () const
| Returns the bottom side offset.
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.

## Detailed Description

A value class that defines a rectangle.

The rectangle is defined by a top-left point and a width and height.

## Constructor & Destructor Documentation

Wt::WRectF::WRectF | ( |  | ) |

Default constructor.

Constructs a `null` rectangle.

See also:
  isNull()

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`.

Wt::WRectF::WRectF | ( | const WPointF & | topLeft,
|  | const WPointF & | bottomRight
| ) |  |

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.

## Member Function Documentation

double Wt::WRectF::bottom | ( |  | ) | const

Returns the bottom side offset.

See also:
  top()

WPointF Wt::WRectF::bottomLeft | ( |  | ) | const

Returns the bottom left point.

See also:
  left(), bottom()

WPointF Wt::WRectF::bottomRight | ( |  | ) | const

Returns the bottom right point.

See also:
  right(), bottom()

double Wt::WRectF::height | ( |  | ) | const

Returns the height.

See also:
  width()

bool Wt::WRectF::isEmpty | ( |  | ) | const

Determines whether or not this rectangle is empty.

A rectangle is empty if its width and height are zero.

bool Wt::WRectF::isNull | ( |  | ) | const

Checks for a null rectangle.

See also:
  WRectF()

double Wt::WRectF::left | ( |  | ) | const

Returns the X position (left side offset).

See also:
  x(), right()

WRectF Wt::WRectF::normalized | ( |  | ) | const

Returns a normalized rectangle.

A normalized rectangle has a positive width and height.

double Wt::WRectF::right | ( |  | ) | const

Returns the the right side offset.

See also:
  left()

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.

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.

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

Returns the Y position (top side offset).

See also:
  y(), bottom()

WPointF Wt::WRectF::topLeft | ( |  | ) | const

Returns the top left point.

See also:
  left(), top()

WPointF Wt::WRectF::topRight | ( |  | ) | const

Returns the top right point.

See also:
  right(), top()

double Wt::WRectF::width | ( |  | ) | const

Returns the width.

See also:
  height()

double Wt::WRectF::x | ( |  | ) | const

Returns the X-position (left side offset).

This is equivalent to left().

See also:
  y(), left()

double Wt::WRectF::y | ( |  | ) | const

Returns the Y-position (top side offset).

This is equivalent to top().

See also:
  x(), top()

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator