# CEGUI::BaseDim Class Reference

Abstract interface for a generic 'dimension' class. More...

Inheritance diagram for CEGUI::BaseDim:

[legend]
Collaboration diagram for CEGUI::BaseDim:

[legend]
List of all members.

## Public Member Functions

float | getValue (const Window &wnd) const
| Return a value that represents this dimension as absolute pixels.
float | getValue (const Window &wnd, const Rect &container) const
| Return a value that represents this dimension as absolute pixels.
BaseDim * | clone () const
| Create an exact copy of the specialised class and return it as a pointer to a BaseDim object.
DimensionOperator | getDimensionOperator () const
| Return the DimensionOperator set for this BaseDim based object.
void | setDimensionOperator (DimensionOperator op)
| Set the DimensionOperator set for this BaseDim based object.
const BaseDim * | getOperand () const
| Return a pointer to the BaseDim set to be used as the other operand.
void | setOperand (const BaseDim &operand)
| Set the BaseDim set to be used as the other operand in calculations for this BaseDim.
void | writeXMLToStream (OutStream &out_stream) const
| Writes an xml representation of this BaseDim to out_stream.

## Protected Member Functions

virtual float | getValue_impl (const Window &wnd) const =0
| Implementataion method to return the base value for this BaseDim. This method should not attempt to apply the mathematical operator; this is handled automatically.
virtual float | getValue_impl (const Window &wnd, const Rect &container) const =0
| Implementataion method to return the base value for this BaseDim. This method should not attempt to apply the mathematical operator; this is handled automatically by BaseDim.
virtual BaseDim * | clone_impl () const =0
| Implementataion method to return a clone of this sub-class of BaseDim. This method should not attempt to clone the mathematical operator or operand; theis is handled automatically by BaseDim.
virtual void | writeXMLElementName_impl (OutStream &out_stream) const =0
| Implementataion method to output real xml element name to an OutStream. This method should not write the element opening '<' character, nor close the element, it must write just the element name itself.
virtual void | writeXMLElementAttributes_impl (OutStream &out_stream) const =0
| Implementataion method to output xml element attributes to an OutStream. This method should not write the element opening '<' character, nor close the element, it must write just the element attributes.

## Detailed Description

Abstract interface for a generic 'dimension' class.

## Member Function Documentation

BaseDim * CEGUI::BaseDim::clone | ( |  | ) | const

Create an exact copy of the specialised class and return it as a pointer to a BaseDim object.

Since the system needs to be able to copy objects derived from BaseDim, but only has knowledge of the BaseDim interface, this clone method is provided to prevent slicing issues.

Returns:
  BaseDim object pointer

DimensionOperator CEGUI::BaseDim::getDimensionOperator | ( |  | ) | const

Return the DimensionOperator set for this BaseDim based object.

Returns:
  One of the DimensionOperator enumerated values representing a mathematical operation to be performed upon this BaseDim using the set operand.

const BaseDim * CEGUI::BaseDim::getOperand | ( |  | ) | const

Return a pointer to the BaseDim set to be used as the other operand.

Returns:
  Pointer to the BaseDim object.

float CEGUI::BaseDim::getValue | ( | const Window & | wnd,
|  | const Rect & | container
| ) | const

Return a value that represents this dimension as absolute pixels.

Parameters:

  | wnd | Window object that may be used by the specialised class to aid in calculating the final value (typically would be used to obtain window/widget dimensions).
  | container | Rect object which describes an area to be considered as the base area when calculating the final value. Basically this means that relative values are calculated from the dimensions of this Rect.

Returns:
  float value which represents, in pixels, the same value as this BaseDim.

float CEGUI::BaseDim::getValue | ( | const Window & | wnd | ) | const

Return a value that represents this dimension as absolute pixels.

Parameters:

  | wnd | Window object that may be used by the specialised class to aid in calculating the final value.

Returns:
  float value which represents, in pixels, the same value as this BaseDim.

void CEGUI::BaseDim::setDimensionOperator | ( | DimensionOperator | op | ) |

Set the DimensionOperator set for this BaseDim based object.

Parameters:

  | op | One of the DimensionOperator enumerated values representing a mathematical operation to be performed upon this BaseDim using the set operand.

Returns:
  Nothing.

void CEGUI::BaseDim::setOperand | ( | const BaseDim & | operand | ) |

Set the BaseDim set to be used as the other operand in calculations for this BaseDim.

Parameters:

  | operand | sub-class of BaseDim representing the 'other' operand. The given object will be cloned; no transfer of ownership occurrs for the passed object.

Returns:
  Nothing.

void CEGUI::BaseDim::writeXMLToStream | ( | OutStream & | out_stream | ) | const

Writes an xml representation of this BaseDim to out_stream.

Parameters:

  | out_stream | Stream where xml data should be output.

Returns:
  Nothing.