yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::gui::WidgetIdScope Class Reference

RAII helper for managing hierarchical ImGui ID scopes. More...

#include <widget_id_registry.h>

Public Member Functions

 WidgetIdScope (const std::string &name)
 
 ~WidgetIdScope ()
 
std::string GetFullPath () const
 
std::string GetWidgetPath (const std::string &widget_type, const std::string &widget_name) const
 

Private Attributes

std::string name_
 

Static Private Attributes

static thread_local std::vector< std::string > id_stack_
 

Detailed Description

RAII helper for managing hierarchical ImGui ID scopes.

This class automatically pushes/pops ImGui IDs and maintains a thread-local stack for building hierarchical widget paths. Use this to create predictable, stable widget IDs for test automation.

Example: { WidgetIdScope editor("Overworld"); // Widgets here have "Overworld/" prefix { WidgetIdScope section("Canvas"); // Widgets here have "Overworld/Canvas/" prefix ImGui::BeginChild("Map", ...); // Full path: Overworld/Canvas/Map } }

Definition at line 36 of file widget_id_registry.h.

Constructor & Destructor Documentation

◆ WidgetIdScope()

yaze::gui::WidgetIdScope::WidgetIdScope ( const std::string &  name)
explicit

Definition at line 25 of file widget_id_registry.cc.

References id_stack_.

◆ ~WidgetIdScope()

yaze::gui::WidgetIdScope::~WidgetIdScope ( )

Definition at line 35 of file widget_id_registry.cc.

References id_stack_, and name_.

Member Function Documentation

◆ GetFullPath()

std::string yaze::gui::WidgetIdScope::GetFullPath ( ) const

Definition at line 43 of file widget_id_registry.cc.

References id_stack_.

Referenced by yaze::gui::AutoWidgetScope::GetPath(), and GetWidgetPath().

◆ GetWidgetPath()

std::string yaze::gui::WidgetIdScope::GetWidgetPath ( const std::string &  widget_type,
const std::string &  widget_name 
) const

Definition at line 47 of file widget_id_registry.cc.

References GetFullPath().

Here is the call graph for this function:

Member Data Documentation

◆ name_

std::string yaze::gui::WidgetIdScope::name_
private

Definition at line 49 of file widget_id_registry.h.

Referenced by ~WidgetIdScope().

◆ id_stack_

thread_local std::vector< std::string > yaze::gui::WidgetIdScope::id_stack_
staticprivate

Definition at line 50 of file widget_id_registry.h.

Referenced by GetFullPath(), WidgetIdScope(), and ~WidgetIdScope().


The documentation for this class was generated from the following files: