Skip to content

Class ImguiLayer

ClassList > ImguiLayer

Base class for all UI panels (dockable ImGui windows).More...

  • #include <ImguiLayer.h>

Inherited by the following classes: MaterialViewer, Outliner, ParamControl, RenderConfigViewer, ShaderEditor, TransformPanel, Viewport

Public Attributes

Type Name
bool fixed_size = false
Whether layer size is fixed (non-resizable)
bool is_docking = true
Whether layer can dock into dockspace.
bool is_mouse_hovered = false
Whether mouse is hovering over layer.
bool is_size_changed = false
Size change tracking flags.
bool is_size_changed_b = true
Previous frame size change flag.
std::vector< std::shared_ptr< ImguiItem > > item_list
Widgets contained in this layer.
GLuint uly_ID = -1
Unique layer ID assigned by ImguiManager .
bool uly_activate = true
Whether layer is active (receives events)
bool uly_is_rendered = true
Whether layer is rendered (visible)
std::string uly_name
Layer name for display and lookup.
ImVec2 uly_pos
Layer position in screen space.
bool uly_show_type = false
Whether to display layer type in title.
ImVec2 uly_size
Current layer size.
ImVec2 uly_size_b
Previous layer size.
ImLayerType uly_type = NONE\_UILAYER
Layer type identifier.
bool using_size = false
Whether to apply custom size constraints.

Public Functions

Type Name
ImguiItem * FindImguiItem (const std::string & name) const
Finds an item by name.
ImguiItem * FindImguiItem (int id) const
Finds an item by index.
ImVec2 GetLayerPos ()
Returns current layer position.
ImVec2 GetLayerSize ()
Returns current layer size.
ImguiLayer ()
Default constructor.
ImguiLayer (const std::string & name)
Constructs layer with specified name.
bool IsResized () const
Checks if layer was resized since last frame.
void PushItem (Args... args)
Adds a typed item to the layer.
void PushItem (std::shared_ptr< ImguiItem > item)
Adds an item to the layer.
void PushItem (ImItemType type)
Quick-creates and adds an item by type.
virtual void RegisterEvents (EventPool & evt)
Registers layer's event subscriptions.
virtual void RenderLayer (const Context & ctx, EventPool & evt)
Renders the layer's UI elements.
virtual ~ImguiLayer ()
Virtual destructor for proper cleanup of derived classes.

Detailed Description

ImguiLayer represents a single UI panel that can be docked, resized, and independently activated. Derived classes implement specific functionality: * Viewport: Displays rendered scene * Outliner: Shows scene hierarchy * TransformPanel: Edits object transforms * MaterialViewer: Manages material properties

Lifecycle: * Construction - Layer created with name * RegisterEvents() - Subscribe to relevant events * RenderLayer() - Called each frame when active * Destruction - Cleanup resources

Data Flow: * Context (read) → Display state in UI * User action → Emit Event via EventPool

Note:

Thread-safety: Not thread-safe. Must be used from main thread only.

Note:

Ownership: ImguiManager owns layers via shared_ptr

Public Attributes Documentation

variable fixed_size

Whether layer size is fixed (non-resizable)

bool ImguiLayer::fixed_size;


variable is_docking

Whether layer can dock into dockspace.

bool ImguiLayer::is_docking;


variable is_mouse_hovered

Whether mouse is hovering over layer.

bool ImguiLayer::is_mouse_hovered;


variable is_size_changed

Size change tracking flags.

bool ImguiLayer::is_size_changed;

Note:

TODO: Refactor to cleaner design pattern Current frame size change flag


variable is_size_changed_b

Previous frame size change flag.

bool ImguiLayer::is_size_changed_b;


variable item_list

Widgets contained in this layer.

std::vector<std::shared_ptr<ImguiItem> > ImguiLayer::item_list;


variable uly_ID

Unique layer ID assigned by ImguiManager .

GLuint ImguiLayer::uly_ID;


variable uly_activate

Whether layer is active (receives events)

bool ImguiLayer::uly_activate;


variable uly_is_rendered

Whether layer is rendered (visible)

bool ImguiLayer::uly_is_rendered;


variable uly_name

Layer name for display and lookup.

std::string ImguiLayer::uly_name;


variable uly_pos

Layer position in screen space.

ImVec2 ImguiLayer::uly_pos;


variable uly_show_type

Whether to display layer type in title.

bool ImguiLayer::uly_show_type;


variable uly_size

Current layer size.

ImVec2 ImguiLayer::uly_size;


variable uly_size_b

Previous layer size.

ImVec2 ImguiLayer::uly_size_b;


variable uly_type

Layer type identifier.

ImLayerType ImguiLayer::uly_type;


variable using_size

Whether to apply custom size constraints.

bool ImguiLayer::using_size;


Public Functions Documentation

function FindImguiItem [1/2]

Finds an item by name.

ImguiItem * ImguiLayer::FindImguiItem (
    const std::string & name
) const

Parameters:

Returns:

Pointer to item, or nullptr if not found


function FindImguiItem [2/2]

Finds an item by index.

ImguiItem * ImguiLayer::FindImguiItem (
    int id
) const

Parameters:

  • id Item index in item_list (starts at 0)

Returns:

Pointer to item, or nullptr if invalid index


function GetLayerPos

Returns current layer position.

ImVec2 ImguiLayer::GetLayerPos () 

Returns:

Layer position in pixels


function GetLayerSize

Returns current layer size.

ImVec2 ImguiLayer::GetLayerSize () 

Returns:

Layer size in pixels


function ImguiLayer [1/2]

Default constructor.

ImguiLayer::ImguiLayer () 

Note:

Layer must be given a name before use


function ImguiLayer [2/2]

Constructs layer with specified name.

ImguiLayer::ImguiLayer (
    const std::string & name
) 

Parameters:

  • name Unique layer name for lookup and display

function IsResized

Checks if layer was resized since last frame.

inline bool ImguiLayer::IsResized () const

Returns:

true if layer was just resized

Note:

TODO: Replace with event-based resize notification


function PushItem [1/3]

Adds a typed item to the layer.

template<class ItemType, class... Args>
void ImguiLayer::PushItem (
    Args... args
) 

Template factory for creating and adding items of specific types.

Template parameters:

  • ItemType Derived type of ImguiItem
  • Args Constructor argument types

Parameters:

  • args Arguments forwarded to ItemType constructor

function PushItem [2/3]

Adds an item to the layer.

void ImguiLayer::PushItem (
    std::shared_ptr< ImguiItem > item
) 

Parameters:

  • item Shared pointer to item to add

function PushItem [3/3]

Quick-creates and adds an item by type.

void ImguiLayer::PushItem (
    ImItemType type
) 

Convenience method for standard item types (e.g., BUTTON_INP, FLOAT_INP).

Parameters:

  • type Item type to create

function RegisterEvents

Registers layer's event subscriptions.

inline virtual void ImguiLayer::RegisterEvents (
    EventPool & evt
) 

Override this to subscribe to relevant events (e.g., viewport resize, selection change). Called by ImguiManager during initialization.

Parameters:


function RenderLayer

Renders the layer's UI elements.

inline virtual void ImguiLayer::RenderLayer (
    const Context & ctx,
    EventPool & evt
) 

Override this to implement layer-specific rendering logic. Called every frame when layer is active and visible.

Typical implementation: * Begin ImGui window with layer name * Render items and custom UI * Handle user input * Emit events for state changes * End ImGui window

Parameters:

  • ctx Context for read-only access to scene/editor state
  • evt EventPool for emitting events

Note:

Must not mutate Context - emit Events instead


function ~ImguiLayer

Virtual destructor for proper cleanup of derived classes.

virtual ImguiLayer::~ImguiLayer () 



The documentation for this class was generated from the following file src/UI/ImguiLayer.h