Crazy Eddie's GUI System  0.8.4
CEGUI::WindowManager Class Reference

The WindowManager class describes an object that manages creation and lifetime of Window objects. More...

+ Inheritance diagram for CEGUI::WindowManager:
+ Collaboration diagram for CEGUI::WindowManager:

List of all members.

Public Types

typedef bool PropertyCallback (Window *window, String &propname, String &propvalue, void *userdata)
 Function type that is used as a callback when loading layouts from XML; the function is called for each Property element encountered.
typedef ConstVectorIterator
< WindowVector > 
WindowIterator

Public Member Functions

 WindowManager (void)
 Constructs a new WindowManager object.
 ~WindowManager (void)
 Destructor for WindowManager objects.
WindowcreateWindow (const String &type, const String &name="")
 Creates a new Window object of the specified type, and gives it the specified unique name.
void destroyWindow (Window *window)
 Destroy the specified Window object.
void destroyAllWindows (void)
 Destroys all Window objects within the system.
bool isAlive (const Window *window) const
 return whether Window is alive.
WindowloadLayoutFromContainer (const RawDataContainer &source, PropertyCallback *callback=0, void *userdata=0)
 Creates a set of windows (a GUI layout) from the information in the specified XML.
WindowloadLayoutFromFile (const String &filename, const String &resourceGroup="", PropertyCallback *callback=0, void *userdata=0)
 Creates a set of windows (a GUI layout) from the information in the specified XML file.
WindowloadLayoutFromString (const String &source, PropertyCallback *callback=0, void *userdata=0)
 Creates a set of windows (a GUI layout) from the information in the specified XML.
bool isDeadPoolEmpty (void) const
 Return whether the window dead pool is empty.
void cleanDeadPool (void)
 Permanently destroys any windows placed in the dead pool.
void writeLayoutToStream (const Window &window, OutStream &out_stream) const
 Writes a full XML window layout, starting at the given Window to the given OutStream.
String getLayoutAsString (const Window &window) const
 Writes a full XML window layout, starting at the given Window and returns the result as string.
void saveLayoutToFile (const Window &window, const String &filename) const
 Save a full XML window layout, starting at the given Window, to a file with the given file name.
void lock ()
 Put WindowManager into the locked state.
void unlock ()
 Put WindowManager into the unlocked state.
bool isLocked () const
 Returns whether WindowManager is currently in the locked state.
WindowIterator getIterator (void) const
 Return a WindowManager::WindowIterator object to iterate over the currently defined Windows.
void DEBUG_dumpWindowNames (String zone) const
 Outputs the names of ALL existing windows to log (DEBUG function).

Static Public Member Functions

static const StringgetDefaultResourceGroup ()
 Returns the default resource group currently set for layouts.
static void setDefaultResourceGroup (const String &resourceGroup)
 Sets the default resource group to be used when loading layouts.

Static Public Attributes

static const String GeneratedWindowNameBase
static const String EventNamespace
 Namespace for global events.
static const String EventWindowCreated
static const String EventWindowDestroyed
static const String GUILayoutSchemaName
 Filename of the XML schema used for validating GUILayout files.

Detailed Description

The WindowManager class describes an object that manages creation and lifetime of Window objects.

The WindowManager is the means by which Window objects are created and destroyed. For each sub-class of Window that is to be created, there must exist a WindowFactory object which is registered with the WindowFactoryManager. Additionally, the WindowManager tracks every Window object created, and can be used to access those Window objects by name.


Member Typedef Documentation

typedef bool CEGUI::WindowManager::PropertyCallback(Window *window, String &propname, String &propvalue, void *userdata)

Function type that is used as a callback when loading layouts from XML; the function is called for each Property element encountered.

Parameters:
windowWindow object that the property is to be applied to.
propnameString holding the name of the property that is being set.
propvalueString holding the new value that will be applied to the property specified by /a propname.
userdataSome client code supplied data.
Returns:
  • true if the property should be set.
  • false if the property should not be set,

Constructor & Destructor Documentation

Constructs a new WindowManager object.

NB: Client code should not create WindowManager objects - they are of limited use to you! The intended pattern of access is to get a pointer to the GUI system's WindowManager via the System object, and use that.

Destructor for WindowManager objects.

This will properly destry all remaining Window objects. Note that WindowFactory objects will not be destroyed (since they are owned by whoever created them).


Member Function Documentation

Permanently destroys any windows placed in the dead pool.

Note:
It is probably not a good idea to call this from a Window based event handler if the specific window has been or is being destroyed.
Returns:
Nothing.
Window* CEGUI::WindowManager::createWindow ( const String type,
const String name = "" 
)

Creates a new Window object of the specified type, and gives it the specified unique name.

Parameters:
typeString that describes the type of Window to be created. A valid WindowFactory for the specified type must be registered.
nameString that holds the name that is to be given to the new window. If name is empty, a name will be generated for the window.
Returns:
Pointer to the newly created Window object.
Exceptions:
InvalidRequestExceptionWindowManager is locked and no Windows may be created.
UnknownObjectExceptionNo WindowFactory is registered for type Window objects.
GenericExceptionSome other error occurred (Exception message has details).

Outputs the names of ALL existing windows to log (DEBUG function).

Parameters:
zoneHelper string that can specify where the name dump was made (e.g. "BEFORE FRAME DELETION").
Returns:
Nothing.

Destroys all Window objects within the system.

Returns:
Nothing.
Exceptions:
InvalidRequestExceptionThrown if the WindowFactory for any Window object type has been removed.

Destroy the specified Window object.

Parameters:
windowPointer to the Window object to be destroyed.
Returns:
Nothing
Exceptions:
InvalidRequestExceptionCan be thrown if the WindowFactory for window's object type was removed.
static const String& CEGUI::WindowManager::getDefaultResourceGroup ( void  ) [inline, static]

Returns the default resource group currently set for layouts.

Returns:
String describing the default resource group identifier that will be used when loading layouts.

Writes a full XML window layout, starting at the given Window and returns the result as string.

Parameters:
windowWindow object to become the root of the layout.
Warning:
This is a convenience function and isn't designed to be fast at all! Use the other alternatives if you want performance.
Returns:
String containing XML of the resulting layout

Return whether the window dead pool is empty.

Returns:
  • true if there are no windows in the dead pool.
  • false if the dead pool contains >=1 window awaiting destruction.

Returns whether WindowManager is currently in the locked state.

While WindowManager is in the locked state all attempts to create a Window of any type will fail with an InvalidRequestException being thrown. Calls to lock/unlock are recursive; if multiple calls to lock are made, WindowManager is only unlocked after a matching number of calls to unlock.

Returns:
  • true to indicate WindowManager is locked and that any attempt to create Window objects will fail.
  • false to indicate WindowManager is unlocked and that Window objects may be created as normal.
Window* CEGUI::WindowManager::loadLayoutFromContainer ( const RawDataContainer source,
PropertyCallback callback = 0,
void *  userdata = 0 
)

Creates a set of windows (a GUI layout) from the information in the specified XML.

Parameters:
sourceRawDataContainer holding the XML source
callbackPropertyCallback function to be called for each Property element loaded from the layout. This is called prior to the property value being applied to the window enabling client code manipulation of properties.
userdataClient code data pointer passed to the PropertyCallback function.
Returns:
Pointer to the root Window object defined in the layout.
Window* CEGUI::WindowManager::loadLayoutFromFile ( const String filename,
const String resourceGroup = "",
PropertyCallback callback = 0,
void *  userdata = 0 
)

Creates a set of windows (a GUI layout) from the information in the specified XML file.

Parameters:
filenameString object holding the filename of the XML file to be processed.
resourceGroupResource group identifier to be passed to the resource provider when loading the layout file.
callbackPropertyCallback function to be called for each Property element loaded from the layout. This is called prior to the property value being applied to the window enabling client code manipulation of properties.
userdataClient code data pointer passed to the PropertyCallback function.
Returns:
Pointer to the root Window object defined in the layout.
Exceptions:
FileIOExceptionthrown if something goes wrong while processing the file filename.
InvalidRequestExceptionthrown if filename appears to be invalid.
Window* CEGUI::WindowManager::loadLayoutFromString ( const String source,
PropertyCallback callback = 0,
void *  userdata = 0 
)

Creates a set of windows (a GUI layout) from the information in the specified XML.

Parameters:
sourceString holding the XML source
callbackPropertyCallback function to be called for each Property element loaded from the layout. This is called prior to the property value being applied to the window enabling client code manipulation of properties.
userdataClient code data pointer passed to the PropertyCallback function.
Returns:
Pointer to the root Window object defined in the layout.

Put WindowManager into the locked state.

While WindowManager is in the locked state all attempts to create a Window of any type will fail with an InvalidRequestException being thrown. Calls to lock/unlock are recursive; if multiple calls to lock are made, WindowManager is only unlocked after a matching number of calls to unlock.

Note:
This is primarily intended for internal use within the system.
void CEGUI::WindowManager::saveLayoutToFile ( const Window window,
const String filename 
) const

Save a full XML window layout, starting at the given Window, to a file with the given file name.

Parameters:
windowWindow object to become the root of the layout.
filenameThe name of the file to which the XML will be written. Note that this does not use any part of the ResourceProvider system, but rather will write directly to disk. If this is not desirable, you should prefer the OutStream based writeWindowLayoutToStream functions.
static void CEGUI::WindowManager::setDefaultResourceGroup ( const String resourceGroup) [inline, static]

Sets the default resource group to be used when loading layouts.

Parameters:
resourceGroupString describing the default resource group identifier to be used.
Returns:
Nothing.

Put WindowManager into the unlocked state.

While WindowManager is in the locked state all attempts to create a Window of any type will fail with an InvalidRequestException being thrown. Calls to lock/unlock are recursive; if multiple calls to lock are made, WindowManager is only unlocked after a matching number of calls to unlock.

Note:
This is primarily intended for internal use within the system.
void CEGUI::WindowManager::writeLayoutToStream ( const Window window,
OutStream out_stream 
) const

Writes a full XML window layout, starting at the given Window to the given OutStream.

Parameters:
windowWindow object to become the root of the layout.
out_streamOutStream (std::ostream based) object where data is to be sent.
Returns:
Nothing.

Member Data Documentation

Event fired when a new Window object is created. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the Window that has just been created.

Event fired when a Window object is destroyed. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the Window that has been destroyed.

Base name to use for generated window names.

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends