Crazy Eddies GUI System
0.7.2
|
The WindowManager class describes an object that manages creation and lifetime of Window objects. More...
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. More... | |
typedef ConstBaseIterator < WindowRegistry > | WindowIterator |
Public Types inherited from CEGUI::EventSet | |
typedef ConstBaseIterator < EventMap > | Iterator |
Public Member Functions | |
WindowManager (void) | |
Constructs a new WindowManager object. More... | |
~WindowManager (void) | |
Destructor for WindowManager objects. More... | |
Window * | createWindow (const String &type, const String &name="") |
Creates a new Window object of the specified type, and gives it the specified unique name. More... | |
void | destroyWindow (Window *window) |
Destroy the specified Window object. More... | |
void | destroyWindow (const String &window) |
Destroy the specified Window object. More... | |
Window * | getWindow (const String &name) const |
Return a pointer to the specified Window object. More... | |
bool | isWindowPresent (const String &name) const |
Examines the list of Window objects to see if one exists with the given name. More... | |
void | destroyAllWindows (void) |
Destroys all Window objects within the system. More... | |
Window * | loadWindowLayout (const String &filename, const String &name_prefix="", 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. More... | |
bool | isDeadPoolEmpty (void) const |
Return whether the window dead pool is empty. More... | |
void | cleanDeadPool (void) |
Permanently destroys any windows placed in the dead pool. More... | |
void | writeWindowLayoutToStream (const Window &window, OutStream &out_stream, bool writeParent=false) const |
Writes a full XML window layout, starting at the given Window to the given OutStream. More... | |
void | writeWindowLayoutToStream (const String &window, OutStream &out_stream, bool writeParent=false) const |
Writes a full XML window layout, starting at the given Window to the given OutStream. More... | |
void | saveWindowLayout (const String &window, const String &filename, const bool writeParent=false) const |
Save a full XML window layout, starting at the given Window, to a file with the given file name. More... | |
void | saveWindowLayout (const Window &window, const String &filename, const bool writeParent=false) const |
Save a full XML window layout, starting at the given Window, to a file with the given file name. More... | |
void | renameWindow (const String &window, const String &new_name) |
Rename a window. More... | |
void | renameWindow (Window *window, const String &new_name) |
Rename a window. More... | |
void | lock () |
Put WindowManager into the locked state. More... | |
void | unlock () |
Put WindowManager into the unlocked state. More... | |
bool | isLocked () const |
Returns whether WindowManager is currently in the locked state. More... | |
WindowIterator | getIterator (void) const |
Return a WindowManager::WindowIterator object to iterate over the currently defined Windows. | |
void | DEBUG_dumpWindowNames (String zone) |
Outputs the names of ALL existing windows to log (DEBUG function). More... | |
Public Member Functions inherited from CEGUI::EventSet | |
EventSet () | |
Constructor for EventSet objects. | |
virtual | ~EventSet (void) |
Destructor for EventSet objects. | |
void | addEvent (const String &name) |
Add a new Event to the EventSet with the given name. More... | |
void | removeEvent (const String &name) |
Removes the Event with the given name. All connections to the event are disconnected. More... | |
void | removeAllEvents (void) |
Remove all Event objects from the EventSet. More... | |
bool | isEventPresent (const String &name) |
Checks to see if an Event with the given name is present in the EventSet. More... | |
virtual Event::Connection | subscribeEvent (const String &name, Event::Subscriber subscriber) |
Subscribes a handler to the named Event. If the named Event is not yet present in the EventSet, it is created and added. More... | |
virtual Event::Connection | subscribeEvent (const String &name, Event::Group group, Event::Subscriber subscriber) |
Subscribes a handler to the specified group of the named Event. If the named Event is not yet present in the EventSet, it is created and added. More... | |
virtual Event::Connection | subscribeScriptedEvent (const String &name, const String &subscriber_name) |
Subscribes the named Event to a scripted funtion. More... | |
virtual Event::Connection | subscribeScriptedEvent (const String &name, Event::Group group, const String &subscriber_name) |
Subscribes the specified group of the named Event to a scripted funtion. More... | |
virtual void | fireEvent (const String &name, EventArgs &args, const String &eventNamespace="") |
Fires the named event passing the given EventArgs object. More... | |
bool | isMuted (void) const |
Return whether the EventSet is muted or not. More... | |
void | setMutedState (bool setting) |
Set the mute state for this EventSet. More... | |
Iterator | getIterator (void) const |
Return a EventSet::Iterator object to iterate over the events currently added to the EventSet. | |
Static Public Member Functions | |
static const String & | getDefaultResourceGroup () |
Returns the default resource group currently set for layouts. More... | |
static void | setDefaultResourceGroup (const String &resourceGroup) |
Sets the default resource group to be used when loading layouts. More... | |
Static Public Member Functions inherited from CEGUI::Singleton< WindowManager > | |
static WindowManager & | getSingleton (void) |
static WindowManager * | getSingletonPtr (void) |
Static Public Attributes | |
static const String | GeneratedWindowNameBase |
static const String | EventNamespace |
Namespace for global events. | |
static const String | EventWindowCreated |
static const String | EventWindowDestroyed |
Additional Inherited Members | |
Protected Types inherited from CEGUI::EventSet | |
typedef std::map< String, Event *, String::FastLessCompare > | EventMap |
Protected Member Functions inherited from CEGUI::EventSet | |
Event * | getEventObject (const String &name, bool autoAdd=false) |
Return a pointer to the Event object with the given name, optionally adding such an Event object to the EventSet if it does not already exist. More... | |
void | fireEvent_impl (const String &name, EventArgs &args) |
Implementation event firing member. | |
EventSet (EventSet &) | |
EventSet & | operator= (EventSet &) |
Protected Attributes inherited from CEGUI::EventSet | |
EventMap | d_events |
bool | d_muted |
true if events for this EventSet have been muted. | |
Static Protected Attributes inherited from CEGUI::Singleton< WindowManager > | |
static WindowManager * | ms_Singleton |
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.
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.
window | Window object that the property is to be applied to. |
propname | String holding the name of the property that is being set. |
propvalue | String holding the new value that will be applied to the property specified by /a propname. |
userdata | Some client code supplied data. |
CEGUI::WindowManager::WindowManager | ( | void | ) |
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.
CEGUI::WindowManager::~WindowManager | ( | void | ) |
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).
void CEGUI::WindowManager::cleanDeadPool | ( | void | ) |
Permanently destroys any windows placed in the dead pool.
Creates a new Window object of the specified type, and gives it the specified unique name.
type | String that describes the type of Window to be created. A valid WindowFactory for the specified type must be registered. |
name | String that holds a unique name that is to be given to the new window. If this string is empty (""), a name will be generated for the window. |
InvalidRequestException | WindowManager is locked and no Windows may be created. |
AlreadyExistsException | A Window object with the name name already exists. |
UnknownObjectException | No WindowFactory is registered for type Window objects. |
GenericException | Some other error occurred (Exception message has details). |
void CEGUI::WindowManager::DEBUG_dumpWindowNames | ( | String | zone | ) |
Outputs the names of ALL existing windows to log (DEBUG function).
zone | Helper string that can specify where the name dump was made (e.g. "BEFORE FRAME DELETION"). |
void CEGUI::WindowManager::destroyAllWindows | ( | void | ) |
Destroys all Window objects within the system.
InvalidRequestException | Thrown if the WindowFactory for any Window object type has been removed. |
void CEGUI::WindowManager::destroyWindow | ( | Window * | window | ) |
Destroy the specified Window object.
window | Pointer to the Window object to be destroyed. If the window is null, or is not recognised, nothing happens. |
InvalidRequestException | Can be thrown if the WindowFactory for window's object type was removed. |
void CEGUI::WindowManager::destroyWindow | ( | const String & | window | ) |
Destroy the specified Window object.
window | String containing the name of the Window object to be destroyed. If window is not recognised, nothing happens. |
InvalidRequestException | Can be thrown if the WindowFactory for window's object type was removed. |
|
inlinestatic |
Returns the default resource group currently set for layouts.
bool CEGUI::WindowManager::isDeadPoolEmpty | ( | void | ) | const |
Return whether the window dead pool is empty.
bool CEGUI::WindowManager::isLocked | ( | ) | const |
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.
bool CEGUI::WindowManager::isWindowPresent | ( | const String & | name | ) | const |
Window* CEGUI::WindowManager::loadWindowLayout | ( | const String & | filename, |
const String & | name_prefix = "" , |
||
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.
filename | String object holding the filename of the XML file to be processed. |
name_prefix | String object holding the prefix that is to be used when creating the windows in the layout file, this function allows a layout to be loaded multiple times without having name clashes. Note that if you use this facility, then all windows defined within the layout must have names assigned; you currently can not use this feature in combination with automatically generated window names. |
resourceGroup | Resource group identifier to be passed to the resource provider when loading the layout file. |
callback | PropertyCallback 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. |
userdata | Client code data pointer passed to the PropertyCallback function. |
FileIOException | thrown if something goes wrong while processing the file filename. |
InvalidRequestException | thrown if filename appears to be invalid. |
void CEGUI::WindowManager::lock | ( | ) |
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.
Rename a window.
window | String holding the current name of the window to be renamed. |
new_name | String holding the new name for the window |
UnknownObjectException | thrown if window is not known in the system. |
AlreadyExistsException | thrown if a Window named new_name already exists. |
Rename a window.
window | Pointer to the window to be renamed. |
new_name | String holding the new name for the window |
AlreadyExistsException | thrown if a Window named new_name already exists. |
void CEGUI::WindowManager::saveWindowLayout | ( | const String & | window, |
const String & | filename, | ||
const bool | writeParent = false |
||
) | const |
Save a full XML window layout, starting at the given Window, to a file with the given file name.
window | String holding the name of the Window object to become the root of the layout. |
filename | The 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. |
writeParent | If the starting window has a parent window, specifies whether to write the parent name into the Parent attribute of the GUILayout XML element. |
void CEGUI::WindowManager::saveWindowLayout | ( | const Window & | window, |
const String & | filename, | ||
const bool | writeParent = false |
||
) | const |
Save a full XML window layout, starting at the given Window, to a file with the given file name.
window | Window object to become the root of the layout. |
filename | The 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. |
writeParent | If the starting window has a parent window, specifies whether to write the parent name into the Parent attribute of the GUILayout XML element. |
|
inlinestatic |
Sets the default resource group to be used when loading layouts.
resourceGroup | String describing the default resource group identifier to be used. |
void CEGUI::WindowManager::unlock | ( | ) |
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.
void CEGUI::WindowManager::writeWindowLayoutToStream | ( | const Window & | window, |
OutStream & | out_stream, | ||
bool | writeParent = false |
||
) | const |
Writes a full XML window layout, starting at the given Window to the given OutStream.
window | Window object to become the root of the layout. |
out_stream | OutStream (std::ostream based) object where data is to be sent. |
writeParent | If the starting window has a parent window, specifies whether to write the parent name into the Parent attribute of the GUILayout XML element. |
void CEGUI::WindowManager::writeWindowLayoutToStream | ( | const String & | window, |
OutStream & | out_stream, | ||
bool | writeParent = false |
||
) | const |
Writes a full XML window layout, starting at the given Window to the given OutStream.
window | String holding the name of the Window object to become the root of the layout. |
out_stream | OutStream (std::ostream based) object where data is to be sent. |
writeParent | If the starting window has a parent window, specifies whether to write the parent name into the Parent attribute of the GUILayout XML element. |
|
static |
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.
|
static |
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.
|
static |
Base name to use for generated window names.