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_ |
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.
|
explicit |
Definition at line 25 of file widget_id_registry.cc.
References id_stack_.
yaze::gui::WidgetIdScope::~WidgetIdScope | ( | ) |
Definition at line 35 of file widget_id_registry.cc.
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().
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().
|
private |
Definition at line 49 of file widget_id_registry.h.
Referenced by ~WidgetIdScope().
|
staticprivate |
Definition at line 50 of file widget_id_registry.h.
Referenced by GetFullPath(), WidgetIdScope(), and ~WidgetIdScope().