WindowManager
Application window manager. More...
#include "GUI/WindowManager.h"
Public Functions
Name | |
---|---|
WindowManager() =default | |
void | addWindow(Ptr< IWindow > window)<br>Add a dockable window. |
void | clear()<br>Remove all managed windows. |
void | draw()<br>Draw all managed windows. |
Ptr< IWindow > | findDockableWindowByID(const char * ID) |
Ptr< IWindow > | findImGuiWindow(ImGuiWindow * window) |
void | focusWindow(Ptr< IWindow > window, bool updateImGuiFocus =true) |
Ptr< IWindow > | getCurrentWindow()<br>Returns the last window that started being constructed (eg. |
std::vector< Ptr< IWindow > > | getDockableWindows() const |
Ptr< IWindow > | getFocusedWindow() |
template <typename T > <br>Ptr< T > | getWindowPtr()<br>Find a dockable window of type T and return a shared pointer to it. |
bool | hasWindow(const std::string & id) |
template <typename T > <br>bool | isFocused() |
void | loadLayout(std::string path) |
template <typename TStrategy > <br>void | openConfirmModal() |
template <typename T > <br>void | openModal() |
void | openModal(UPtr< IWindow > modalInstance) |
void | removeWindow(const std::string & windowId)<br>Hide and remove window. |
template <typename T > <br>void | showUniqueWindow()<br>Create and show desired window. |
void | showWindow(IWindow * window, bool show) |
void | showWindow(Ptr< IWindow > window, bool show) |
void | updateFocus()<br>Handles automatic window focus change. |
glm::vec2 | getMousePositionForWindow(const IWindow * window)<br>Returns relative mouse position for a specified window. |
Friends
Name | |
---|---|
class | IWindow |
Detailed Description
class WindowManager;
class WindowManager;
Application window manager.
Handles window lifetime, visibility, focus and drawing. As well as some utility methods. Also holds a reference to the last drawn window (See below).
Each window should call its IWindow::updateWindowInfo() method after its ImGui::Begin() call. This method updates its window dimension/position information and marks itself as the current window of its assigned WindowManager. With access to window manager any code can retrieve window information without an explicit reference to the window being constructed.
Public Functions Documentation
function WindowManager
WindowManager() =default
WindowManager() =default
function addWindow
void addWindow(
Ptr< IWindow > window
)
void addWindow(
Ptr< IWindow > window
)
Add a dockable window.
function clear
void clear()
void clear()
Remove all managed windows.
function draw
void draw()
void draw()
Draw all managed windows.
function findDockableWindowByID
inline Ptr< IWindow > findDockableWindowByID(
const char * ID
)
inline Ptr< IWindow > findDockableWindowByID(
const char * ID
)
function findImGuiWindow
Ptr< IWindow > findImGuiWindow(
ImGuiWindow * window
)
Ptr< IWindow > findImGuiWindow(
ImGuiWindow * window
)
function focusWindow
void focusWindow(
Ptr< IWindow > window,
bool updateImGuiFocus =true
)
void focusWindow(
Ptr< IWindow > window,
bool updateImGuiFocus =true
)
function getCurrentWindow
inline Ptr< IWindow > getCurrentWindow()
inline Ptr< IWindow > getCurrentWindow()
Returns the last window that started being constructed (eg.
the last window that called IWindow::updateWindowInfo() after its ImGui::Begin() call).
function getDockableWindows
inline std::vector< Ptr< IWindow > > getDockableWindows() const
inline std::vector< Ptr< IWindow > > getDockableWindows() const
function getFocusedWindow
inline Ptr< IWindow > getFocusedWindow()
inline Ptr< IWindow > getFocusedWindow()
function getWindowPtr
template <typename T >
inline Ptr< T > getWindowPtr()
template <typename T >
inline Ptr< T > getWindowPtr()
Find a dockable window of type T and return a shared pointer to it.
Template Parameters:
- T
Return:
function hasWindow
bool hasWindow(
const std::string & id
)
bool hasWindow(
const std::string & id
)
function isFocused
template <typename T >
inline bool isFocused()
template <typename T >
inline bool isFocused()
function loadLayout
void loadLayout(
std::string path
)
void loadLayout(
std::string path
)
function openConfirmModal
template <typename TStrategy >
inline void openConfirmModal()
template <typename TStrategy >
inline void openConfirmModal()
function openModal
template <typename T >
void openModal()
template <typename T >
void openModal()
function openModal
void openModal(
UPtr< IWindow > modalInstance
)
void openModal(
UPtr< IWindow > modalInstance
)
function removeWindow
void removeWindow(
const std::string & windowId
)
void removeWindow(
const std::string & windowId
)
Hide and remove window.
Parameters:
- windowId identification of window to hide.
Called by HideWindowCommand.
function showUniqueWindow
template <typename T >
inline void showUniqueWindow()
template <typename T >
inline void showUniqueWindow()
Create and show desired window.
Template Parameters:
- T window to create. T must be derived from IWindow class.
function showWindow
void showWindow(
IWindow * window,
bool show
)
void showWindow(
IWindow * window,
bool show
)
function showWindow
void showWindow(
Ptr< IWindow > window,
bool show
)
void showWindow(
Ptr< IWindow > window,
bool show
)
function updateFocus
void updateFocus()
void updateFocus()
Handles automatic window focus change.
function getMousePositionForWindow
static glm::vec2 getMousePositionForWindow(
const IWindow * window
)
static glm::vec2 getMousePositionForWindow(
const IWindow * window
)
Returns relative mouse position for a specified window.
This is a utility method to fetch current mouse position from InputManager and then make that position relative to the specified window.
Friends
friend IWindow
friend class IWindow(
IWindow
);
friend class IWindow(
IWindow
);
Updated on 2025-01-07 at 13:40:43 +0000