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

ufo::UDimension Class Reference

An abstraction to dimension (width and height). More...

#include <udimension.hpp>

Inheritance diagram for ufo::UDimension:

ufo::UDimensionObject List of all members.

Public Member Functions

 UDimension ()
 UDimension (int w, int h)
int getWidth () const
int getHeight () const
bool isInvalid () const
bool isValid () const
bool isEmpty () const
void clamp (const UDimension &maxDim)
void expand (const UDimension &minDim)
void update (const UDimension &dim)
void transcribe (const UDimension &dim)
void setSize (int w, int h)
UDimension getSize () const
bool operator() () const
bool operator! () const
UDimensionoperator+= (const UDimension &dim)
UDimensionoperator-= (const UDimension &dim)
UDimensionoperator+= (const UInsets &insets)
UDimensionoperator-= (const UInsets &insets)
UDimensionoperator *= (int c)
UDimensionoperator *= (double c)
UDimensionoperator/= (int c)
UDimensionoperator/= (double c)

Public Attributes

int w
int h

Static Public Attributes

UDimension maxDimension
UDimension invalid

Friends

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

Detailed Description

An abstraction to dimension (width and height).

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

Author:
Johannes Schmidt


Constructor & Destructor Documentation

ufo::UDimension::UDimension  )  [inline]
 

Creates an empty dimension (width == 0 and height == 0).

ufo::UDimension::UDimension int  w,
int  h
[inline]
 

Creates a dimension with the given width and height.

Parameters:
w The width
h The height


Member Function Documentation

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

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

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

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

int ufo::UDimension::getHeight  )  const [inline]
 

Returns:
The height of this dimension.

UDimension ufo::UDimension::getSize  )  const [inline]
 

This method is for convenience and mimics the API of widget types.

Returns:
A copy of this dimension object.

int ufo::UDimension::getWidth  )  const [inline]
 

Returns:
The width of this dimension.

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

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

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

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

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

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

UDimension & ufo::UDimension::operator *= double  c  )  [inline]
 

Multiplies c with both width and height of this dimension.

Returns:
Reference to this dimension.

UDimension & ufo::UDimension::operator *= int  c  )  [inline]
 

Multiplies c with both width and height of this dimension.

Returns:
Reference to this dimension.

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

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

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

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

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

Increases this dimension using the given insets

Returns:
Reference to this rectangle.

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

Adds dimension dim to this dimension

Returns:
Reference to this dimension.

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

Shrinks this dimension using the given insets

Returns:
Reference to this rectangle.

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

Subtracts dimension dim from this dimension

Returns:
Reference to this dimension.

UDimension & ufo::UDimension::operator/= double  c  )  [inline]
 

Divides both width and height by c.

Returns:
Reference to this dimension.

UDimension & ufo::UDimension::operator/= int  c  )  [inline]
 

Divides both width and height by c.

Returns:
Reference to this dimension.

void ufo::UDimension::setSize int  w,
int  h
[inline]
 

Sets the size of this dimension to the given values.

Parameters:
w The new width
h The new height

void ufo::UDimension::transcribe const UDimension dim  )  [inline]
 

If width resp. height of the given dimension is not euqal to invalid, the width resp. height of this dimension is replaced by this value.

Parameters:
dim The dimension whose valid values replaces the values of this dimension.

void ufo::UDimension::update const UDimension dim  )  [inline]
 

If width resp. height of this dimension is equal to invalid, it is replaced by the width resp. height of the given dimension.

Parameters:
dim The dimension which should be used for updates of invalid values


Member Data Documentation

int ufo::UDimension::h
 

The height of this dimension object.

int ufo::UDimension::w
 

The width of this dimension object.


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