Skip to content

IWindow

ImGui GUIWindow abstract class. More...

#include "GUI/Elements/IWindow.h"

Inherits from std::enable_shared_from_this< IWindow >

Inherited by AboutWindow, DescriptionDialog, ImportedModelsDialog, LogWindow, ModalWindow, SetupDialog, StartWindow, TutorialWindow, UI::Console, UI::StyleEditor, UI::ViewportWindow, WorkspaceWindow

Public Functions

Name
IWindow(std::string title, bool show =false)
virtual~IWindow() =default
virtual const char *getID() const =0
WPtr< InputController >getInput()<br>Returns window input controller.
const char *getName()
bool *getShowPtr()
const std::string &getTitle() const
voidhide()
boolisVisible() const
virtual voidrender() =0
const voidsetTitle(std::string title)
voidshow()

Protected Functions

Name
voidupdateWindowInfo()<br>Collect information about the current window.

Public Attributes

Name
boolm_autoFocus <br>When true the window will get focus immediately upon hovering over it.
std::stringm_title <br>Visible window title.
boolm_windowInfoUpdated <br>A flag indicating the updateWindowInfo() method was called.
WindowManager *m_windowManager <br>Weak reference to a WindowManager set when this window is added to it.
glm::vec2m_windowMax <br>Bottom right corner of the window.
glm::vec2m_windowMin <br>Top left corner of the window, same as m_windowPos (separate variable for clarity)
glm::vec2m_windowPos <br>Top-left corner of the window in screen coordinates.
glm::ivec2m_windowSize <br>Window width and height dimensions.

Protected Attributes

Name
Ptr< InputController >m_input
std::stringm_name <br>Full ImGui window identifier.
boolm_nameNeedsUpdate <br>Workaround to avoid setting the name in the constructor (cannot call getID there)
boolm_show

Friends

Name
classWindowManager

Detailed Description

cpp
class IWindow;
class IWindow;

ImGui GUIWindow abstract class.

See: WindowManager for lifecycle information.

Every window should call its IWindow::updateWindowInfo() method after ImGui::Begin() call.

Public Functions Documentation

function IWindow

cpp
explicit IWindow(
    std::string title,
    bool show =false
)
explicit IWindow(
    std::string title,
    bool show =false
)

function ~IWindow

cpp
virtual ~IWindow() =default
virtual ~IWindow() =default

Precondition: Window cannot be destroyed at runtime. It may cause crash.

function getID

cpp
virtual const char * getID() const =0
virtual const char * getID() const =0

Reimplemented by: ModalWindow::getID

function getInput

cpp
inline WPtr< InputController > getInput()
inline WPtr< InputController > getInput()

Returns window input controller.

function getName

cpp
const char * getName()
const char * getName()

Return: ImGui window name.

function getShowPtr

cpp
inline bool * getShowPtr()
inline bool * getShowPtr()

function getTitle

cpp
const std::string & getTitle() const
const std::string & getTitle() const

function hide

cpp
inline void hide()
inline void hide()

function isVisible

cpp
inline bool isVisible() const
inline bool isVisible() const

function render

cpp
virtual void render() =0
virtual void render() =0

Reimplemented by: WorkspaceWindow::render, DescriptionDialog::render, ImportedModelsDialog::render, SetupDialog::render, ModalWindow::render, AboutWindow::render, UI::Console::render, LogWindow::render, StartWindow::render, UI::StyleEditor::render, TutorialWindow::render, UI::ViewportWindow::render

function setTitle

cpp
const void setTitle(
    std::string title
)
const void setTitle(
    std::string title
)

function show

cpp
inline void show()
inline void show()

Protected Functions Documentation

function updateWindowInfo

cpp
void updateWindowInfo()
void updateWindowInfo()

Collect information about the current window.

Should be called right after ImGui's Begin() function to store and supply window's screen position and size to any code being called until another window starts being constructed. If this call is omitted after beginning a window anything querying the WindowManager for window position and dimensions may receive invalid information.

Public Attributes Documentation

variable m_autoFocus

cpp
bool m_autoFocus {false};
bool m_autoFocus {false};

When true the window will get focus immediately upon hovering over it.

variable m_title

cpp
std::string m_title;
std::string m_title;

Visible window title.

variable m_windowInfoUpdated

cpp
bool m_windowInfoUpdated {false};
bool m_windowInfoUpdated {false};

A flag indicating the updateWindowInfo() method was called.

variable m_windowManager

cpp
WindowManager * m_windowManager {nullptr};
WindowManager * m_windowManager {nullptr};

Weak reference to a WindowManager set when this window is added to it.

variable m_windowMax

cpp
glm::vec2 m_windowMax;
glm::vec2 m_windowMax;

Bottom right corner of the window.

variable m_windowMin

cpp
glm::vec2 m_windowMin;
glm::vec2 m_windowMin;

Top left corner of the window, same as m_windowPos (separate variable for clarity)

variable m_windowPos

cpp
glm::vec2 m_windowPos;
glm::vec2 m_windowPos;

Top-left corner of the window in screen coordinates.

variable m_windowSize

cpp
glm::ivec2 m_windowSize;
glm::ivec2 m_windowSize;

Window width and height dimensions.

Protected Attributes Documentation

variable m_input

cpp
Ptr< InputController > m_input {std::make_shared<InputController>()};
Ptr< InputController > m_input {std::make_shared<InputController>()};

variable m_name

cpp
std::string m_name;
std::string m_name;

Full ImGui window identifier.

variable m_nameNeedsUpdate

cpp
bool m_nameNeedsUpdate {true};
bool m_nameNeedsUpdate {true};

Workaround to avoid setting the name in the constructor (cannot call getID there)

variable m_show

cpp
bool m_show {false};
bool m_show {false};

Friends

friend WindowManager

cpp
friend class WindowManager(
    WindowManager 
);
friend class WindowManager(
    WindowManager 
);

Updated on 2024-11-06 at 20:16:53 +0000