Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
CEGUI::WidgetDim Class Reference

Dimension type that represents some dimension of a Window/widget. Implements BaseDim interface. More...

+ Inheritance diagram for CEGUI::WidgetDim:
+ Collaboration diagram for CEGUI::WidgetDim:

Public Member Functions

 WidgetDim (const String &name, DimensionType dim)
 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...
 
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 some dimension of a Window/widget. Implements BaseDim interface.

When calculating the final pixel value for the dimension, a target widget name is built by appending the name specified in the WidgetDim to the name path of the window passed to getValue, we then use the window/widget with that name to obtain the value for the dimension.

Constructor & Destructor Documentation

CEGUI::WidgetDim::WidgetDim ( const String name,
DimensionType  dim 
)

Constructor.

Parameters
nameString object holding the name suffix for a window/widget.
dimDimensionType value indicating which dimension of the described image that this ImageDim is to represent.

Member Function Documentation

BaseDim* CEGUI::WidgetDim::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.

DimensionType CEGUI::WidgetDim::getSourceDimension ( ) const

Gets the source dimension type for this WidgetDim.

Returns
DimensionType value indicating which dimension of the described image that this WidgetDim is to represent.
float CEGUI::WidgetDim::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::WidgetDim::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::WidgetDim::getWidgetName ( ) const

Get the name suffix to use for this WidgetDim.

Returns
String object holding the name suffix for a window/widget.
void CEGUI::WidgetDim::setSourceDimension ( DimensionType  dim)

Sets the source dimension type for this WidgetDim.

Parameters
dimDimensionType value indicating which dimension of the described image that this WidgetDim is to represent.
void CEGUI::WidgetDim::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.