Crazy Eddies GUI System  0.7.2
Public Member Functions | Protected Member Functions | List of all members
CEGUI::SectionSpecification Class Reference

Class that represents a simple 'link' to an ImagerySection. More...

Public Member Functions

 SectionSpecification (const String &owner, const String &sectionName, const String &controlPropertySource, const String &controlPropertyValue, const String &controlPropertyWidget)
 Constructor. More...
 
 SectionSpecification (const String &owner, const String &sectionName, const String &controlPropertySource, const String &controlPropertyValue, const String &controlPropertyWidget, const ColourRect &cols)
 Constructor. More...
 
void render (Window &srcWindow, const ColourRect *modcols=0, const Rect *clipper=0, bool clipToDisplay=false) const
 Render the section specified by this SectionSpecification. More...
 
void render (Window &srcWindow, const Rect &baseRect, const ColourRect *modcols=0, const Rect *clipper=0, bool clipToDisplay=false) const
 Render the section specified by this SectionSpecification. More...
 
const StringgetOwnerWidgetLookFeel () const
 Return the name of the WidgetLookFeel object containing the target section. More...
 
const StringgetSectionName () const
 Return the name of the target ImagerySection. More...
 
const ColourRectgetOverrideColours () const
 Return the current override colours. More...
 
void setOverrideColours (const ColourRect &cols)
 Set the override colours to be used by this SectionSpecification. More...
 
bool isUsingOverrideColours () const
 return whether the use of override colours is enabled on this SectionSpecification. More...
 
void setUsingOverrideColours (bool setting=true)
 Enable or disable the use of override colours for this section. More...
 
void setOverrideColoursPropertySource (const String &property)
 Set the name of the property where override colour values can be obtained. More...
 
void setOverrideColoursPropertyIsColourRect (bool setting=true)
 Set whether the override colours property source represents a full ColourRect. More...
 
void setRenderControlPropertySource (const String &property)
 Set the name of the property that controls whether to actually render this section. More...
 
void setRenderControlValue (const String &value)
 Set the test value used when determining whether to render this section. More...
 
void setRenderControlWidget (const String &widget)
 Set the widget what will be used as the source of the property named as the control property. More...
 
void writeXMLToStream (XMLSerializer &xml_stream) const
 Writes an xml representation of this SectionSpecification to out_stream. More...
 

Protected Member Functions

void initColourRectForOverride (const Window &wnd, ColourRect &cr) const
 Helper method to initialise a ColourRect with appropriate values according to the way the section sepcification is set up. More...
 
bool shouldBeDrawn (const Window &wnd) const
 

Detailed Description

Class that represents a simple 'link' to an ImagerySection.

This class enables sections to be easily re-used, by different states and/or layers, by allowing sections to be specified by name rather than having mutiple copies of the same thing all over the place.

Constructor & Destructor Documentation

CEGUI::SectionSpecification::SectionSpecification ( const String owner,
const String sectionName,
const String controlPropertySource,
const String controlPropertyValue,
const String controlPropertyWidget 
)

Constructor.

Parameters
ownerString holding the name of the WidgetLookFeel object that contains the target section.
sectionNameString holding the name of the target section.
controlPropertySourceString holding the name of a property that will control whether rendering for this secion will actually occur or not.
controlPropertyValueString holding the value to be tested for from the property named in controlPropertySource. If this is empty, then controlPropertySource will be accessed as a boolean property, otherwise rendering will only occur when the value returned via controlPropertySource matches the value specified here.
controlPropertyWidgetString holding either a widget name suffix or the special value of 'parent' indicating the window upon which the property named in controlPropertySource should be accessed. If this is empty then the window itself is used as the source, rather than a child or the parent.
CEGUI::SectionSpecification::SectionSpecification ( const String owner,
const String sectionName,
const String controlPropertySource,
const String controlPropertyValue,
const String controlPropertyWidget,
const ColourRect cols 
)

Constructor.

Parameters
ownerString holding the name of the WidgetLookFeel object that contains the target section.
sectionNameString holding the name of the target section.
controlPropertySourceString holding the name of a property that will control whether rendering for this secion will actually occur or not.
controlPropertyValueString holding the value to be tested for from the property named in controlPropertySource. If this is empty, then controlPropertySource will be accessed as a boolean property, otherwise rendering will only occur when the value returned via controlPropertySource matches the value specified here.
controlPropertyWidgetString holding either a widget name suffix or the special value of 'parent' indicating the window upon which the property named in controlPropertySource should be accessed. If this is empty then the window itself is used as the source, rather than a child or the parent.
colsOverride colours to be used (modulates sections master colours).

Member Function Documentation

const ColourRect& CEGUI::SectionSpecification::getOverrideColours ( ) const

Return the current override colours.

Returns
ColourRect holding the colours that will be modulated with the sections master colours if colour override is enabled on this SectionSpecification.
const String& CEGUI::SectionSpecification::getOwnerWidgetLookFeel ( ) const

Return the name of the WidgetLookFeel object containing the target section.

Returns
String object holding the name of the WidgetLookFeel that contains the target ImagerySection.
const String& CEGUI::SectionSpecification::getSectionName ( ) const

Return the name of the target ImagerySection.

Returns
String object holding the name of the target ImagerySection.
void CEGUI::SectionSpecification::initColourRectForOverride ( const Window wnd,
ColourRect cr 
) const
protected

Helper method to initialise a ColourRect with appropriate values according to the way the section sepcification is set up.

This will try and get values from multiple places:

  • a property attached to wnd
  • the integral d_coloursOverride values.
  • or default to colour(1,1,1,1);
bool CEGUI::SectionSpecification::isUsingOverrideColours ( ) const

return whether the use of override colours is enabled on this SectionSpecification.

Returns
void CEGUI::SectionSpecification::render ( Window srcWindow,
const ColourRect modcols = 0,
const Rect clipper = 0,
bool  clipToDisplay = false 
) const

Render the section specified by this SectionSpecification.

Parameters
srcWindowWindow object to be used when calculating pixel values from BaseDim values.
Returns
Nothing.
void CEGUI::SectionSpecification::render ( Window srcWindow,
const Rect baseRect,
const ColourRect modcols = 0,
const Rect clipper = 0,
bool  clipToDisplay = false 
) const

Render the section specified by this SectionSpecification.

Parameters
srcWindowWindow object to be used when calculating pixel values from BaseDim values.
baseRectRect object to be used when calculating pixel values from BaseDim values.
Returns
Nothing.
void CEGUI::SectionSpecification::setOverrideColours ( const ColourRect cols)

Set the override colours to be used by this SectionSpecification.

Parameters
colsColourRect describing the override colours to set for this SectionSpecification.
Returns
Nothing.
void CEGUI::SectionSpecification::setOverrideColoursPropertyIsColourRect ( bool  setting = true)

Set whether the override colours property source represents a full ColourRect.

Parameters
setting
  • true if the override colours property will access a ColourRect object.
  • false if the override colours property will access a colour object.
Returns
Nothing.
void CEGUI::SectionSpecification::setOverrideColoursPropertySource ( const String property)

Set the name of the property where override colour values can be obtained.

Parameters
propertyString containing the name of the property.
Returns
Nothing.
void CEGUI::SectionSpecification::setRenderControlPropertySource ( const String property)

Set the name of the property that controls whether to actually render this section.

Parameters
propertyString containing the name of the property.
Returns
Nothing.
void CEGUI::SectionSpecification::setRenderControlValue ( const String value)

Set the test value used when determining whether to render this section.

The value set here will be compared to the current value of the property named as the render control property, if they match the secion will be drawn, otherwise the section will not be drawn. If this value is set to the empty string, the control property will instead be treated as a boolean property.

void CEGUI::SectionSpecification::setRenderControlWidget ( const String widget)

Set the widget what will be used as the source of the property named as the control property.

The value of this setting will be interpreted as follows:

  • empty string: The target widget being drawn will be the source of the property value.
  • 'parent': The parent of the widget being drawn will be the source of the property value.
  • any other value: The value will be taken as a name suffix and a window with the name of the widget being drawn with the specified suffix will be the source of the property value.
void CEGUI::SectionSpecification::setUsingOverrideColours ( bool  setting = true)

Enable or disable the use of override colours for this section.

Parameters
setting
Returns
Nothing.
bool CEGUI::SectionSpecification::shouldBeDrawn ( const Window wnd) const
protected

return whether the section should be drawn, based upon the render control property and associated items.

void CEGUI::SectionSpecification::writeXMLToStream ( XMLSerializer xml_stream) const

Writes an xml representation of this SectionSpecification to out_stream.

Parameters
xml_streamStream where xml data should be output.
Returns
Nothing.