The WindowManager class describes an object that manages creation and lifetime of Window objects.
More...
List of all members.
Qualified Iterators |
Window | Window |
| Can be used to iterate over the currently defined Windows.
|
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 Function Documentation
Window GUI::WindowManager::createWindow |
( |
string |
type, |
|
|
string |
name = "" |
|
) |
| |
Creates a new Window object of the specified type, and gives it the specified unique name.
- Parameters:
-
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. |
- Returns:
- Pointer to the newly created Window object.
- Exceptions:
-
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 GUI::WindowManager::destroyWindow |
( |
Window |
window | ) |
|
Destroy the specified Window object.
- Parameters:
-
window | Pointer to the Window object to be destroyed. If the window is null, or is not recognised, nothing happens. |
- Returns:
- Nothing
- Exceptions:
-
InvalidRequestException | Can be thrown if the WindowFactory for window's object type was removed. |
void GUI::WindowManager::destroyWindow |
( |
string |
window | ) |
|
Destroy the specified Window object.
- Parameters:
-
window | String containing the name of the Window object to be destroyed. If window is not recognised, nothing happens. |
- Returns:
- Nothing.
- Exceptions:
-
InvalidRequestException | Can be thrown if the WindowFactory for window's object type was removed. |
Window GUI::WindowManager::getWindow |
( |
string |
name | ) |
|
Return a pointer to the specified Window object.
- Parameters:
-
name | String holding the name of the Window object to be returned. |
- Returns:
- Pointer to the Window object with the name name.
- Exceptions:
-
UnknownObjectException | No Window object with a name matching name was found. |
bool GUI::WindowManager::isWindowPresent |
( |
string |
name | ) |
|
Examines the list of Window objects to see if one exists with the given name.
- Parameters:
-
name | String holding the name of the Window object to look for. |
- Returns:
- true if a Window object was found with a name matching name. false if no matching Window object was found.
void GUI::WindowManager::destroyAllWindows |
( |
| ) |
|
Destroys all Window objects within the system.
- Returns:
- Nothing.
- Exceptions:
-
InvalidRequestException | Thrown if the WindowFactory for any Window object type has been removed. |
Window GUI::WindowManager::loadWindowLayout |
( |
string |
filename, |
|
|
string |
name_prefix = "" , |
|
|
string |
resourceGroup = "" |
|
) |
| |
Creates a set of windows (a Gui layout) from the information in the specified XML file.
- Warning:
- When using a C string literal as the value for the second argument name_prefix, currently (0.6.x releases) it is likely that the incorrect overload of loadWindowLayout will be invoked (possibly without immediate error or warning). To avoid the possibility of invoking the incorrect overload by mistake, it is recommended that you explicity use the CEGUI::String type when passing name_prefix.
- For example, instead of this:
winMgr.loadWindowLayout("MyLayout.layout", "aPrefix/");
- Do this:
winMgr.loadWindowLayout("MyLayout.layout", CEGUI::String("aPrefix/"));
- Parameters:
-
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. |
- Returns:
- Pointer to the root Window object defined in the layout.
- Exceptions:
-
FileIOException | thrown if something goes wrong while processing the file filename. |
InvalidRequestException | thrown if filename appears to be invalid. |
bool GUI::WindowManager::isDeadPoolEmpty |
( |
| ) |
|
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.
void GUI::WindowManager::cleanDeadPool |
( |
| ) |
|
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.
void GUI::WindowManager::renameWindow |
( |
string |
window, |
|
|
string |
new_name |
|
) |
| |
Rename a window.
- Parameters:
-
window | String holding the current name of the window to be renamed. |
new_name | String holding the new name for the window |
- Exceptions:
-
UnknownObjectException | thrown if window is not known in the system. |
AlreadyExistsException | thrown if a Window named new_name already exists. |
void GUI::WindowManager::renameWindow |
( |
Window |
window, |
|
|
string |
new_name |
|
) |
| |
Rename a window.
- Parameters:
-
window | Pointer to the window to be renamed. |
new_name | String holding the new name for the window |
- Exceptions:
-
AlreadyExistsException | thrown if a Window named new_name already exists. |
string GUI::WindowManager::getDefaultResourceGroup |
( |
| ) |
|
|
inline |
Returns the default resource group currently set for layouts.
- Returns:
- String describing the default resource group identifier that will be used when loading layouts.
void GUI::WindowManager::setDefaultResourceGroup |
( |
string |
resourceGroup | ) |
|
|
inline |
Sets the default resource group to be used when loading layouts.
- Parameters:
-
resourceGroup | String describing the default resource group identifier to be used. |
- Returns:
- Nothing.
void GUI::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.
- Note:
- This is primarily intended for internal use within the system.
void GUI::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.
- Note:
- This is primarily intended for internal use within the system.
bool GUI::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.
- 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.
Member Data Documentation
Window GUI::WindowManager::Window |
Can be used to iterate over the currently defined Windows.
for each Window w in GUI.WindowManager {
trace(w.getName());
}