- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

ufo::URectangle Class Reference

An abstraction of a rectangle (x, y, width and height). More...

#include <urectangle.hpp>

Inheritance diagram for ufo::URectangle:

ufo::URectangleObject List of all members.

Public Member Functions

 URectangle (int x, int y, int w, int h)
 URectangle (const UPoint &p, const UDimension &d)
 URectangle (const UPoint &p1, const UPoint &p2)
 URectangle (const UDimension &d)
UPoint getLocation () const
UDimension getSize () const
void setBounds (int x, int y, int w, int h)
void setBounds (const URectangle &rect)
bool contains (const UPoint &pos) const
bool isValid () const
bool isInvalid () const
bool isEmpty () const
void clamp (const UDimension &maxDim)
void expand (const UDimension &minDim)
void intersect (const URectangle &rect)
void unite (const URectangle &rect)
URectangle computeUnion (const URectangle &src) const
bool operator() () const
bool operator! () const
URectangleoperator+= (const UPoint &p)
URectangleoperator-= (const UPoint &p)
URectangleoperator+= (const UDimension &dim)
URectangleoperator-= (const UDimension &dim)
URectangleoperator+= (const UInsets &insets)
URectangleoperator-= (const UInsets &insets)

Static Public Member Functions

URectanglecomputeUnion (const URectangle &src1, const URectangle &src2, URectangle *dest)

Public Attributes

int x
int y
int w
int h

Static Public Attributes

URectangle invalid

Friends

std::ostream & operator<< (std::ostream &os, const URectangle &o)

Detailed Description

An abstraction of a rectangle (x, y, width and height).

This class is not part of the UObject inheritance structure. Use instead URectangleObject if you need a rectangle derived from UObject.

Author:
Johannes Schmidt


Constructor & Destructor Documentation

ufo::URectangle::URectangle const UPoint p1,
const UPoint p2
[inline]
 

Computes a rectangle between two points.

ufo::URectangle::URectangle const UDimension d  )  [inline]
 

Creates a rectangle with locatin 0,0 and the given size.


Member Function Documentation

void ufo::URectangle::clamp const UDimension maxDim  )  [inline]
 

Clamps this URectangle to have at most the dimension of the given maxDim. Does nothing if maxDim is smaller than the size of this rectangle.

URectangle * ufo::URectangle::computeUnion const URectangle src1,
const URectangle src2,
URectangle dest
[inline, static]
 

computes the rectangle that contains both src rectangles and saves the values in the dest rectangle within creating a new one. It is allowed to use one source rectangle as dest rectangle, e.g. URectangle::computeUnion(src, src2, src);

Returns:
dest

URectangle ufo::URectangle::computeUnion const URectangle src  )  const [inline]
 

Returns:
The union of this rectangle and the given rectangle

bool ufo::URectangle::contains const UPoint pos  )  const [inline]
 

Returns:
True when the given point pos is inside the rectangle or on the edge of the rectangle

void ufo::URectangle::expand const UDimension minDim  )  [inline]
 

Expands this URectangle to have at least the dimension of the given minDim. Does nothing if minDim is bigger than the size of this rectangle.

void ufo::URectangle::intersect const URectangle rect  )  [inline]
 

Intersects this rectangle with the given rectangle

bool ufo::URectangle::isEmpty  )  const [inline]
 

Returns:
True if width or height is equal to 0.

bool ufo::URectangle::isInvalid  )  const [inline]
 

Returns:
True if the width and height are equal to invalid
See also:
invalid

bool ufo::URectangle::isValid  )  const [inline]
 

Returns:
True if both, width and height are not equal to invalid
See also:
invalid

bool ufo::URectangle::operator!  )  const [inline]
 

See also:
isInvalid
Returns:
True if width or height is "invalid".

bool ufo::URectangle::operator()  )  const [inline]
 

See also:
isValid
Returns:
True if width and height have both "valid" values.

URectangle & ufo::URectangle::operator+= const UInsets insets  )  [inline]
 

Increases this rectangle using the given insets

Returns:
Reference to this rectangle.

URectangle & ufo::URectangle::operator+= const UDimension dim  )  [inline]
 

Increases this rectangle using the given dimension

Returns:
Reference to this rectangle.

URectangle & ufo::URectangle::operator+= const UPoint p  )  [inline]
 

Moves this rectangle using the coordinates of the given point

Returns:
Reference to this rectangle.

URectangle & ufo::URectangle::operator-= const UInsets insets  )  [inline]
 

Shrinks this rectangle using the given insets

Returns:
Reference to this rectangle.

URectangle & ufo::URectangle::operator-= const UDimension dim  )  [inline]
 

Shrinks this rectangle using the given dimension

Returns:
Reference to this rectangle.

URectangle & ufo::URectangle::operator-= const UPoint p  )  [inline]
 

Moves this rectangle using the coordinates of the given point

Returns:
Reference to this rectangle.

void ufo::URectangle::unite const URectangle rect  )  [inline]
 

Unites this rectangle with the given rectangle.

See also:
computeUnion


The documentation for this class was generated from the following file:
The libUFO Project - written by Johannes Schmidt