Crazy Eddie's GUI System  0.8.7
CEGUI::PropertyDim Class Reference

Dimension type that represents the value of a Window property. Implements BaseDim interface. More...

+ Inheritance diagram for CEGUI::PropertyDim:
+ Collaboration diagram for CEGUI::PropertyDim:

Public Member Functions

 PropertyDim (const String &name, const String &property, DimensionType type)
 Constructor. More...
 
const StringgetWidgetName () const
 Get the name suffix to use for this WidgetDim. More...
 
void setWidgetName (const String &name)
 Set the name suffix to use for this WidgetDim. More...
 
const StringgetPropertyName () const
 Get the name of the property to use for this WidgetDim. More...
 
void setPropertyName (const String &property)
 Set the name of the property to use for this WidgetDim. More...
 
DimensionType getSourceDimension () const
 Gets the source dimension type for this WidgetDim. More...
 
void setSourceDimension (DimensionType dim)
 Sets the source dimension type for this WidgetDim. More...
 
float getValue (const Window &wnd) const
 Return a value that represents this dimension as absolute pixels. More...
 
float getValue (const Window &wnd, const Rectf &container) const
 Return a value that represents this dimension as absolute pixels. More...
 
BaseDimclone () const
 Create an exact copy of the specialised object and return it as a pointer to a BaseDim object. More...
 
- Public Member Functions inherited from CEGUI::BaseDim
virtual void writeXMLToStream (XMLSerializer &xml_stream) const
 Writes an xml representation of this BaseDim to out_stream. More...
 
virtual bool handleFontRenderSizeChange (Window &window, const Font *font) const
 perform any processing required due to the given font having changed.
 

Protected Member Functions

void writeXMLElementName_impl (XMLSerializer &xml_stream) const
 Implementataion method to output real xml element name.
 
void writeXMLElementAttributes_impl (XMLSerializer &xml_stream) const
 Implementataion method to create the element attributes.
 

Detailed Description

Dimension type that represents the value of a Window property. Implements BaseDim interface.

Constructor & Destructor Documentation

CEGUI::PropertyDim::PropertyDim ( const String name,
const String property,
DimensionType  type 
)

Constructor.

Parameters
nameString holding the name suffix of the window on which the property is to be accessed.
propertyString object holding the name of the property this PropertyDim represents the value of. The property named should represent either a UDim value or a simple float value - dependning upon what type is specified as.
typeDimensionType value indicating what dimension named property represents. The possible DimensionType values are as follows:
  • DT_INVALID the property should represent a simple float value.
  • DT_WIDTH the property should represent a UDim value where the scale is relative to the targetted Window's width.
  • DT_HEIGHT the property should represent a UDim value where the scale is relative to the targetted Window's height.
  • All other values will cause an InvalidRequestException exception to be thrown.

Member Function Documentation

BaseDim* CEGUI::PropertyDim::clone ( ) const
virtual

Create an exact copy of the specialised object 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.

Implements CEGUI::BaseDim.

const String& CEGUI::PropertyDim::getPropertyName ( ) const

Get the name of the property to use for this WidgetDim.

Returns
String object holding the name of the property.
DimensionType CEGUI::PropertyDim::getSourceDimension ( ) const

Gets the source dimension type for this WidgetDim.

Returns
DimensionType value indicating which dimension of the target window to use as the reference / base value when accessing a property that represents a unified dimension:
  • DT_INVALID if the property does not represent a unified dim.
  • DT_WIDTH to use target width as reference value.
  • DT_HEIGHT to use target hight as reference value.
float CEGUI::PropertyDim::getValue ( const Window wnd) const
virtual

Return a value that represents this dimension as absolute pixels.

Parameters
wndWindow 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.

Implements CEGUI::BaseDim.

float CEGUI::PropertyDim::getValue ( const Window wnd,
const Rectf container 
) const
virtual

Return a value that represents this dimension as absolute pixels.

Parameters
wndWindow 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).
containerRect 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.

Implements CEGUI::BaseDim.

const String& CEGUI::PropertyDim::getWidgetName ( ) const

Get the name suffix to use for this WidgetDim.

Returns
String object holding the name suffix for a window/widget.
void CEGUI::PropertyDim::setPropertyName ( const String property)

Set the name of the property to use for this WidgetDim.

Parameters
propertyString object holding the name of the property.
Returns
Nothing.
void CEGUI::PropertyDim::setSourceDimension ( DimensionType  dim)

Sets the source dimension type for this WidgetDim.

Parameters
dimDimensionType value indicating which dimension of the target window to use as the reference / base value when accessing a property that represents a unified dimension:
  • DT_INVALID if the property does not represent a unified dim.
  • DT_WIDTH to use target width as reference value.
  • DT_HEIGHT to use target hight as reference value.
void CEGUI::PropertyDim::setWidgetName ( const String name)

Set the name suffix to use for this WidgetDim.

Parameters
nameString object holding the name suffix for a window/widget.
Returns
Nothing.