Wt::WRectF Class Reference
[Painting system]

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


Detailed Description

Utility 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

bool Wt::WRectF::isNull (  )  const

Checks for a null rectangle.

See also:
WRectF()

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.

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.

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

double Wt::WRectF::x (  )  const [inline]

Returns the X-position of the left side.

This is equivalent to left().

See also:
y(), left()

double Wt::WRectF::y (  )  const [inline]

Returns the Y-position of the top side.

This is equivalent to top().

See also:
x(), top()

double Wt::WRectF::width (  )  const [inline]

Returns the width.

See also:
height()

double Wt::WRectF::height (  )  const [inline]

Returns the height.

See also:
width()

double Wt::WRectF::left (  )  const [inline]

Returns the X position of the left side.

See also:
x(), right()

double Wt::WRectF::top (  )  const [inline]

Returns the Y position of the top side.

See also:
y(), bottom()

double Wt::WRectF::right (  )  const [inline]

Returns the X position of the right side.

See also:
left()

double Wt::WRectF::bottom (  )  const [inline]

Returns the Y position of the bottom side.

See also:
top()

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()

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()

WRectF Wt::WRectF::normalized (  )  const

Returns a normalized rectangle.

A normalized rectangle has a positive width and height.


Generated on Thu May 20 18:14:47 2010 for Wt by doxygen 1.5.6