![]() |
XII Release 0.1.0
|
#include <WindowManager.h>
Public Member Functions | |
| void | Update () |
| xiiRegisteredWindowHandle | Register (xiiStringView sName, const void *pCreatedBy, xiiUniquePtr< xiiWindowBase > &&pWindow) |
| void | GetRegistered (xiiDynamicArray< xiiRegisteredWindowHandle > &out_windowHandles, const void *pCreatedBy=nullptr) |
| bool | IsValid (xiiRegisteredWindowHandle hWindow) const |
| xiiStringView | GetName (xiiRegisteredWindowHandle hWindow) const |
| Gets the name of a registered window. | |
| xiiWindowBase * | GetWindow (xiiRegisteredWindowHandle hWindow) const |
| Gets the window implementation for a registered window. | |
| void | SetDestroyCallback (xiiRegisteredWindowHandle hWindow, xiiWindowDestroyFunc onDestroyCallback) |
| void | Close (xiiRegisteredWindowHandle hWindow) |
| void | CloseAll (const void *pCreatedBy) |
Manages registered windows and their associated data.
The WindowManager provides a centralized system for managing windows throughout their lifetime. Windows are registered with unique handles and can have associated output targets and destruction callbacks.
| void xiiWindowManager::Close | ( | xiiRegisteredWindowHandle | hWindow | ) |
Closes and unregisters a specific window.
This first calls any registered destroy callback, then destroys the output target, then the window. The handle becomes invalid after this call.
| void xiiWindowManager::CloseAll | ( | const void * | pCreatedBy | ) |
Closes all windows created by a specific object.
| pCreatedBy | Identifier of the creator, or nullptr to close all windows |
This is useful for cleanup when an object that created multiple windows is destroyed.
| void xiiWindowManager::GetRegistered | ( | xiiDynamicArray< xiiRegisteredWindowHandle > & | out_windowHandles, |
| const void * | pCreatedBy = nullptr ) |
Retrieves handles for all registered windows.
| out_WindowIDs | Array to fill with window handles. |
| pCreatedBy | Optional filter to only return windows created by this object. |
| bool xiiWindowManager::IsValid | ( | xiiRegisteredWindowHandle | hWindow | ) | const |
Checks if a window handle is valid and refers to an existing window.
Invalid handles can occur if the window was closed or if using a default-constructed handle.
| xiiRegisteredWindowHandle xiiWindowManager::Register | ( | xiiStringView | sName, |
| const void * | pCreatedBy, | ||
| xiiUniquePtr< xiiWindowBase > && | pWindow ) |
Registers a new window with the manager.
| sName | Human-readable name for the window (for debugging). |
| pCreatedBy | Pointer identifying the creator (used for bulk operations). |
| pWindow | The window implementation to register. |
The returned handle remains valid until the window is explicitly closed. The pCreatedBy parameter allows closing all windows created by a specific object.
| void xiiWindowManager::SetDestroyCallback | ( | xiiRegisteredWindowHandle | hWindow, |
| xiiWindowDestroyFunc | onDestroyCallback ) |
Sets a callback to be invoked when the window is destroyed.
The callback receives the window handle as parameter. Only one callback can be set per window, setting a new callback replaces the previous one.
| void xiiWindowManager::Update | ( | ) |
Processes window messages for all registered windows.
This should be called regularly (typically once per frame) to handle platform-specific window events.