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

Class that manages WindowFactory objects. More...

+ Inheritance diagram for CEGUI::WindowFactoryManager:
+ Collaboration diagram for CEGUI::WindowFactoryManager:

Classes

class  AliasTargetStack
 Class used to track active alias targets for Window factory types. More...
 
struct  FalagardWindowMapping
 struct used to hold mapping information required to create a falagard based window. More...
 

Public Types

typedef ConstMapIterator< WindowFactoryRegistry > WindowFactoryIterator
 
typedef ConstMapIterator< TypeAliasRegistry > TypeAliasIterator
 
typedef ConstMapIterator< FalagardMapRegistry > FalagardMappingIterator
 

Public Member Functions

 WindowFactoryManager (void)
 Constructs a new WindowFactoryManager object.
 
 ~WindowFactoryManager (void)
 Destructor for WindowFactoryManager objects.
 
void addFactory (WindowFactory *factory)
 Adds a new WindowFactory to the list of registered factories. More...
 
void removeFactory (const String &name)
 Removes a WindowFactory from the list of registered factories. More...
 
void removeFactory (WindowFactory *factory)
 Removes a WindowFactory from the list of registered factories. More...
 
void removeAllFactories (void)
 Remove all WindowFactory objects from the list. More...
 
WindowFactorygetFactory (const String &type) const
 Return a pointer to the specified WindowFactory object. More...
 
bool isFactoryPresent (const String &name) const
 Checks the list of registered WindowFactory objects, aliases, and falagard mapped types for one which can create Window objects of the specified type. More...
 
void addWindowTypeAlias (const String &aliasName, const String &targetType)
 Adds an alias for a current window type. More...
 
void removeWindowTypeAlias (const String &aliasName, const String &targetType)
 Remove the specified alias mapping. If the alias mapping does not exist, nothing happens. More...
 
void removeAllWindowTypeAliases ()
 Remove all registered window type alias mappings.
 
void addFalagardWindowMapping (const String &newType, const String &targetType, const String &lookName, const String &renderer, const String &effectName=String(""))
 Add a mapping for a falagard based window. More...
 
void removeFalagardWindowMapping (const String &type)
 Remove the specified falagard type mapping if it exists. More...
 
void removeAllFalagardWindowMappings ()
 Remove all registered falagard type mappings.
 
bool isFalagardMappedType (const String &type) const
 Return whether the given type is a falagard mapped type. More...
 
const StringgetMappedLookForType (const String &type) const
 Return the name of the LookN'Feel assigned to the specified window mapping. More...
 
const StringgetMappedRendererForType (const String &type) const
 Return the name of the WindowRenderer assigned to the specified window mapping. More...
 
String getDereferencedAliasType (const String &type) const
 Use the alias system, where required, to 'de-reference' the specified type to an actual window type that can be created directly (that being either a concrete window type, or a falagard mapped type). More...
 
const FalagardWindowMappinggetFalagardMappingForType (const String &type) const
 Return the FalagardWindowMapping for the specified window mapping type. More...
 
WindowFactoryIterator getIterator (void) const
 Return a WindowFactoryManager::WindowFactoryIterator object to iterate over the available WindowFactory types.
 
TypeAliasIterator getAliasIterator (void) const
 Return a WindowFactoryManager::TypeAliasIterator object to iterate over the defined aliases for window types.
 
FalagardMappingIterator getFalagardMappingIterator () const
 Return a WindowFactoryManager::FalagardMappingIterator object to iterate over the defined falagard window mappings.
 

Static Public Member Functions

template<typename T >
static void addFactory ()
 Creates a WindowFactory of the type T and adds it to the system for use. The created WindowFactory will automatically be deleted when the factory is removed from the system (either directly or at system deletion time). More...
 
template<typename T >
static void addWindowType ()
 Internally creates a factory suitable for creating Window objects of the given type and adds it to the system. More...
 
- Static Public Member Functions inherited from CEGUI::Singleton< WindowFactoryManager >
static WindowFactoryManagergetSingleton (void)
 
static WindowFactoryManagergetSingletonPtr (void)
 

Additional Inherited Members

- Static Protected Attributes inherited from CEGUI::Singleton< WindowFactoryManager >
static WindowFactoryManagerms_Singleton
 

Detailed Description

Class that manages WindowFactory objects.

Todo:
I think we could clean up the mapping stuff a bit. Possibly make it more generic now with the window renderers and all.

Member Function Documentation

void CEGUI::WindowFactoryManager::addFactory ( WindowFactory factory)

Adds a new WindowFactory to the list of registered factories.

Parameters
factoryPointer to the WindowFactory to be added to the WindowManager.
Returns
Nothing
Exceptions
NullObjectExceptionfactory was null.
AlreadyExistsExceptionfactory provided a Window type name which is in use by another registered WindowFactory.
template<typename T >
void CEGUI::WindowFactoryManager::addFactory ( )
static

Creates a WindowFactory of the type T and adds it to the system for use. The created WindowFactory will automatically be deleted when the factory is removed from the system (either directly or at system deletion time).

Template Parameters
TSpecifies the type of WindowFactory subclass to add a factory for.
Returns
Nothing

References CEGUI::WindowFactory::getTypeName().

void CEGUI::WindowFactoryManager::addFalagardWindowMapping ( const String newType,
const String targetType,
const String lookName,
const String renderer,
const String effectName = String("") 
)

Add a mapping for a falagard based window.

This function creates maps a target window type and target 'look' name onto a registered window type, thus allowing the ususal window creation interface to be used to create windows that require extra information to full initialise themselves.

Note
These mappings support 'late binding' to the target window type, as such the type indicated by targetType need not exist in the system until attempting to create a Window using the type.
Also note that creating a mapping for an existing type will replace any previous mapping for that same type.
Parameters
newTypeThe type name that will be used to create windows using the target type and look.
targetTypeThe base window type.
lookNameThe name of the 'look' that will be used by windows of this type.
rendererThe type of window renderer to assign for windows of this type.
effectNameThe identifier of the RenderEffect to attempt to set up for windows of this type.
Returns
Nothing.
template<typename T >
void CEGUI::WindowFactoryManager::addWindowType ( )
static

Internally creates a factory suitable for creating Window objects of the given type and adds it to the system.

Note
The internally created factory is owned and managed by CEGUI, and will be automatically deleted when the window type is removed from the system - either directly by calling WindowFactoryManager::removeFactory or at system shut down.
Template Parameters
TSpecifies the type of Window to add a factory for.
void CEGUI::WindowFactoryManager::addWindowTypeAlias ( const String aliasName,
const String targetType 
)

Adds an alias for a current window type.

This method allows you to create an alias for a specified window type. This means that you can then use either name as the type parameter when creating a window.

Note
You need to be careful using this system. Creating an alias using a name that already exists will replace the previous mapping for that alias. Each alias name maintains a stack, which means that it is possible to remove an alias and have the previous alias restored. The windows created via an alias use the real type, so removing an alias after window creation is always safe (i.e. it is not the same as removing a real factory, which would cause an exception when trying to destroy a window with a missing factory).
Parameters
aliasNameString object holding the alias name. That is the name that targetType will also be known as from no on.
targetTypeString object holding the type window type name that is to be aliased. This type must already exist.
Returns
Nothing.
Exceptions
UnknownObjectExceptionthrown if targetType is not known within the system.
String CEGUI::WindowFactoryManager::getDereferencedAliasType ( const String type) const

Use the alias system, where required, to 'de-reference' the specified type to an actual window type that can be created directly (that being either a concrete window type, or a falagard mapped type).

Note
Even though implied by the above description, this method does not check that a factory for the final type exists; we simply say that the returned type is not an alias for some other type.
Parameters
typeString describing the type to be de-referenced.
Returns
String object holding a type for a window that can be created directly; that is, a type that does not describe an alias to some other type.
WindowFactory* CEGUI::WindowFactoryManager::getFactory ( const String type) const

Return a pointer to the specified WindowFactory object.

Parameters
typeString holding the Window object type to return the WindowFactory for.
Returns
Pointer to the WindowFactory object that creates Windows of the type type.
Exceptions
UnknownObjectExceptionNo WindowFactory object for Window objects of type type was found.
const FalagardWindowMapping& CEGUI::WindowFactoryManager::getFalagardMappingForType ( const String type) const

Return the FalagardWindowMapping for the specified window mapping type.

Parameters
typeName of a window type. The window type referenced should be a falagard mapped type.
Returns
FalagardWindowMapping object describing the falagard mapping.
Exceptions
InvalidRequestExceptionthrown if type is not a falagard mapping type (or maybe the type didn't exist).
const String& CEGUI::WindowFactoryManager::getMappedLookForType ( const String type) const

Return the name of the LookN'Feel assigned to the specified window mapping.

Parameters
typeName of a window type. The window type referenced should be a falagard mapped type.
Returns
String object holding the name of the look mapped for the requested type.
Exceptions
InvalidRequestExceptionthrown if type is not a falagard mapping type (or maybe the type didn't exist).
const String& CEGUI::WindowFactoryManager::getMappedRendererForType ( const String type) const

Return the name of the WindowRenderer assigned to the specified window mapping.

Parameters
typeName of a window type. The window type referenced should be a falagard mapped type.
Returns
String object holding the name of the window renderer mapped for the requested type.
Exceptions
InvalidRequestExceptionthrown if type is not a falagard mapping type (or maybe the type didn't exist).
bool CEGUI::WindowFactoryManager::isFactoryPresent ( const String name) const

Checks the list of registered WindowFactory objects, aliases, and falagard mapped types for one which can create Window objects of the specified type.

Parameters
nameString containing the Window type name to check for.
Returns
  • true if a WindowFactory, alias, or falagard mapping for Window objects of type name is registered.
  • false if the system knows nothing about windows of type name.
bool CEGUI::WindowFactoryManager::isFalagardMappedType ( const String type) const

Return whether the given type is a falagard mapped type.

Parameters
typeName of a window type.
Returns
  • true if the requested type is a Falagard mapped window type.
  • false if the requested type is a normal WindowFactory (or alias), or if the type does not exist.
void CEGUI::WindowFactoryManager::removeAllFactories ( void  )

Remove all WindowFactory objects from the list.

Returns
Nothing
void CEGUI::WindowFactoryManager::removeFactory ( const String name)

Removes a WindowFactory from the list of registered factories.

Note
The WindowFactory object is not destroyed (since it was created externally), instead it is just removed from the list.
Parameters
nameString which holds the name (technically, Window type name) of the WindowFactory to be removed. If name is not in the list, no error occurs (nothing happens).
Returns
Nothing
void CEGUI::WindowFactoryManager::removeFactory ( WindowFactory factory)

Removes a WindowFactory from the list of registered factories.

Note
The WindowFactory object is not destroyed (since it was created externally), instead it is just removed from the list.
Parameters
factoryPointer to the factory object to be removed. If factory is null, or if no such WindowFactory is in the list, no error occurs (nothing happens).
Returns
Nothing
void CEGUI::WindowFactoryManager::removeFalagardWindowMapping ( const String type)

Remove the specified falagard type mapping if it exists.

Returns
Nothing.
void CEGUI::WindowFactoryManager::removeWindowTypeAlias ( const String aliasName,
const String targetType 
)

Remove the specified alias mapping. If the alias mapping does not exist, nothing happens.

Note
You are required to supply both the alias and target names because there may exist more than one entry for a given alias - therefore you are required to be explicit about which alias is to be removed.
Parameters
aliasNameString object holding the alias name.
targetTypeString object holding the type window type name that was aliased.
Returns
Nothing.