Rocket::Core::Decorator Class Reference

#include <Decorator.h>

Inheritance diagram for Rocket::Core::Decorator:
Collaboration diagram for Rocket::Core::Decorator:

Public Member Functions

virtual DecoratorDataHandle GenerateElementData (Element *element)=0
virtual void ReleaseElementData (DecoratorDataHandle element_data)=0
void SetZIndex (float z_index)
float GetZIndex () const
void SetSpecificity (int specificity)
int GetSpecificity () const
virtual void RenderElement (Element *element, DecoratorDataHandle element_data)=0

Protected Member Functions

virtual void OnReferenceDeactivate ()
 Releases the decorator through its instancer.
int LoadTexture (const String &texture_name, const String &rcss_path)
const TextureGetTexture (int index=0) const
float ResolveProperty (const PropertyDictionary &properties, const String &name, float base_value) const

Friends

class Factory

Detailed Description

The abstract base class for any visual object that can be attached to any element.

Author:
Peter Curry

Member Function Documentation

virtual DecoratorDataHandle Rocket::Core::Decorator::GenerateElementData ( Element element  )  [pure virtual]

Called on a decorator to generate any required per-element data for a newly decorated element.

Parameters:
[in] element The newly decorated element.
Returns:
A handle to a decorator-defined data handle, or NULL if none is needed for the element.

Implemented in Rocket::Core::DecoratorNone, Rocket::Core::DecoratorTiledBox, Rocket::Core::DecoratorTiledHorizontal, Rocket::Core::DecoratorTiledImage, and Rocket::Core::DecoratorTiledVertical.

virtual void Rocket::Core::Decorator::ReleaseElementData ( DecoratorDataHandle  element_data  )  [pure virtual]

Called to release element data generated by this decorator.

Parameters:
[in] element_data The element data handle to release.

Implemented in Rocket::Core::DecoratorNone, Rocket::Core::DecoratorTiledBox, Rocket::Core::DecoratorTiledHorizontal, Rocket::Core::DecoratorTiledImage, and Rocket::Core::DecoratorTiledVertical.

void Rocket::Core::Decorator::SetZIndex ( float  z_index  ) 

Sets the z-index of the decorator. A decorator with a higher z-index will be rendered after a decorator with a lower z-index. By default, all decorators have a z-index of 0.

Parameters:
[in] z-index The new z-index of the decorator.

float Rocket::Core::Decorator::GetZIndex (  )  const

Returns the decorator's z-index.

Returns:
The z-index of the decorator.

void Rocket::Core::Decorator::SetSpecificity ( int  specificity  ) 

Sets the specificity of the decorator.

Parameters:
[in] specificity The specificity of the decorator.

int Rocket::Core::Decorator::GetSpecificity (  )  const

Returns the specificity of the decorator. This is used when multiple pseudo-classes are active on an element, each with similarly-named decorators.

Returns:
The specificity of the decorator.

virtual void Rocket::Core::Decorator::RenderElement ( Element element,
DecoratorDataHandle  element_data 
) [pure virtual]

Called to render the decorator on an element.

Parameters:
[in] element The element to render the decorator on.
[in] element_data The handle to the data generated by the decorator for the element.

Implemented in Rocket::Core::DecoratorNone, Rocket::Core::DecoratorTiledBox, Rocket::Core::DecoratorTiledHorizontal, Rocket::Core::DecoratorTiledImage, and Rocket::Core::DecoratorTiledVertical.

int Rocket::Core::Decorator::LoadTexture ( const String texture_name,
const String rcss_path 
) [protected]

Attempts to load a texture into the list of textures in use by the decorator.

Parameters:
[in] texture_name The name of the texture to load.
[in] rcss_path The RCSS file the decorator definition was loaded from; this is used to resolve relative paths.
Returns:
The index of the texture if the load was successful, or -1 if the load failed.

const Texture * Rocket::Core::Decorator::GetTexture ( int  index = 0  )  const [protected]

Returns one of the decorator's previously loaded textures.

Parameters:
[in] index The index of the desired texture.
Returns:
The texture at the appropriate index, or NULL if the index was invalid.

float Rocket::Core::Decorator::ResolveProperty ( const PropertyDictionary properties,
const String name,
float  base_value 
) const [protected]

Returns the floating-point value of a numerical property from a dictionary of properties, resolving it against a base value if it is a relative property.

Parameters:
[in] properties The user-supplied dictionary of properties.
[in] name The name of the desired property. This must be a numerical property.
Returns:
The fully-resolved value of the property, or 0 if an error occured.


The documentation for this class was generated from the following files:
  • Include/Rocket/Core/Decorator.h
  • Source/Core/Decorator.cpp