class DockableEditorWindows

Handles opening and closing of dockable editor windows.

Its primary purpose is to keep track of all types of windows so they can be saved and restored upon program shutdown/startup, as well as being able to change docked window layout on the fly.

Public

Constructors

DockableEditorWindows

DockableEditorWindows()

Methods

~DockableEditorWindows

~DockableEditorWindows() noexcept

Update

void Update()

Called every frame.

RegisterWindow

void RegisterWindow(const String &name, Function<SPtr<DockableEditorWindow> (EditorWindowTabGroup &)> createCallback)

Registers a window that can then be opened by calling Open().

When loading a window layout this name and callback will be used to attempt creating the window.

name
Unique name for the window.
createCallback
Callback that returns a new instance of the window.

UnregisterWindow

void UnregisterWindow(const String &name)

Unregisters a window so it may no longer be opened using this manager.

Open

SPtr<DockableEditorWindow> Open(const String &name)

Creates a window with the given name.

If a window is already created it returns the existing instance. Window is opened in a new key window.

name
The name of the window.

Returns: Created window, or null if it failed.

Create

SPtr<DockableEditorWindow> Create(const String &name, EditorWindowTabGroup &parentContainer)

Creates a new window an inserts it into the specified tab group.

IsValidWindow

bool IsValidWindow(const String &name) const

Checks if the provided name represents a window that can be created.

Close

void Close(DockableEditorWindow *window)

Closes the given window.

CloseAll

void CloseAll()

Closes all open dockable editor windows.

GetLayout

SPtr<EditorWindowLayout> GetLayout() const

Retrieves the layout of all currently docked windows.

You may later use this layout to restore exact position of the windows.

SetLayout

void SetLayout(const SPtr<EditorWindowLayout> &layout)

Positions all windows according to the provided layout.

It will open new windows or close current ones if needed.

staticPreRegisterWindow

static void PreRegisterWindow(const String &name, Function<SPtr<DockableEditorWindow> (EditorWindowTabGroup &)> createCallback)

Allows you to queue up windows that will be registered as soon as an instance of DockableEditorWindows is created.

staticInstance

static T &Instance()

Returns a reference to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticInstancePtr

static T *InstancePtr()

Returns a pointer to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticShutDown

static void ShutDown()

Shuts down this module and frees any resources it is using.

staticIsStarted

static bool IsStarted()

Query if the module has been started.

Protected

Methods

~Module<T>

virtual ~Module<T>() = default

OnStartUp

virtual void OnStartUp()

Override if you want your module to be notified once it has been constructed and started.

OnShutDown

virtual void OnShutDown()

Override if you want your module to be notified just before it is deleted.

staticInstanceInternal

static T *&InstanceInternal()

Returns a singleton instance of this module.

staticIsDestroyed

static bool &IsDestroyed()

Checks has the Module been shut down.

staticIsStartedUp

static bool &IsStartedUp()

Checks has the Module been started up.

Private

Methods

DoOnFocusGained

void DoOnFocusGained(const RenderWindow &renderWindow)

Triggered whenever a window gains focus.

DoOnFocusLost

void DoOnFocusLost(const RenderWindow &renderWindow)

Triggered whenever a window loses focus.

Fields

mActiveWindows

UnorderedMap<String, SPtr<DockableEditorWindow>> mActiveWindows

mSavedFocusedWindows

UnorderedMap<const RenderWindow *, DockableEditorWindow *> mSavedFocusedWindows

mCreateCallbacks

UnorderedMap<String, std::function<SPtr<DockableEditorWindow> (EditorWindowTabGroup &)>> mCreateCallbacks

mOnFocusLostConnection

HEvent mOnFocusLostConnection

mOnFocusGainedConnection

HEvent mOnFocusGainedConnection