Crazy Eddies GUI System: CEGUI::WindowFactoryManager Class Reference

Crazy Eddies GUI System 0.7.6

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Static Public Member Functions
CEGUI::WindowFactoryManager Class Reference

Class that manages WindowFactory objects. More...

Inheritance diagram for CEGUI::WindowFactoryManager:
[legend]
Collaboration diagram for CEGUI::WindowFactoryManager:
[legend]

List of all members.

## 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 ConstBaseIterator < WindowFactoryRegistry > | WindowFactoryIterator
typedef ConstBaseIterator < TypeAliasRegistry > | TypeAliasIterator
typedef ConstBaseIterator < 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.
void | removeFactory (const String &name)
| Removes a WindowFactory from the list of registered factories.
void | removeFactory (WindowFactory *factory)
| Removes a WindowFactory from the list of registered factories.
void | removeAllFactories (void)
| Remove all WindowFactory objects from the list.
WindowFactory * | getFactory (const String &type) const
| Return a pointer to the specified WindowFactory object.
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.
void | addWindowTypeAlias (const String &aliasName, const String &targetType)
| Adds an alias for a current window type.
void | removeWindowTypeAlias (const String &aliasName, const String &targetType)
| Remove the specified alias mapping. If the alias mapping does not exist, nothing happens.
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.
void | removeFalagardWindowMapping (const String &type)
| Remove the specified falagard type mapping if it exists.
bool | isFalagardMappedType (const String &type) const
| Return whether the given type is a falagard mapped type.
const String & | getMappedLookForType (const String &type) const
| Return the name of the LookN'Feel assigned to the specified window mapping.
const String & | getMappedRendererForType (const String &type) const
| Return the name of the WindowRenderer assigned to the specified window mapping.
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).
const FalagardWindowMapping & | getFalagardMappingForType (const String &type) const
| Return the FalagardWindowMapping for the specified window mapping type.
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).

## 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:

  factory | Pointer to the WindowFactory to be added to the WindowManager.

Returns:
  Nothing

Exceptions:

  NullObjectException | factory was null.
  AlreadyExistsException | factory 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:

  T | Specifies 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:

  newType | The type name that will be used to create windows using the target type and look.
  targetType | The base window type.
  lookName | The name of the 'look' that will be used by windows of this type.
  renderer | The type of window renderer to assign for windows of this type.
  effectName | The identifier of the RenderEffect to attempt to set up for windows of this type.

Returns:
  Nothing.

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:

  aliasName | String object holding the alias name. That is the name that targetType will also be known as from no on.
  targetType | String object holding the type window type name that is to be aliased. This type must already exist.

Returns:
  Nothing.

Exceptions:

  UnknownObjectException | thrown 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:

  type | String 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:

  type | String holding the Window object type to return the WindowFactory for.

Returns:
  Pointer to the WindowFactory object that creates Windows of the type type.

Exceptions:

  UnknownObjectException | No 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:

  type | Name of a window type. The window type referenced should be a falagard mapped type.

Returns:
  FalagardWindowMapping object describing the falagard mapping.

Exceptions:

  InvalidRequestException | thrown 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:

  type | Name 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:

  InvalidRequestException | thrown 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:

  type | Name 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:

  InvalidRequestException | thrown 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:

  name | String 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:

  type | Name 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:

  name | String 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:

  factory | Pointer 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:

  aliasName | String object holding the alias name.
  targetType | String object holding the type window type name that was aliased.

Returns:
  Nothing.