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

Centralized registry for discoverable GUI widgets. More...

#include <widget_id_registry.h>

Classes

struct  WidgetBounds
 
struct  WidgetInfo
 
struct  WidgetMetadata
 

Public Member Functions

void BeginFrame ()
 
void EndFrame ()
 
void RegisterWidget (const std::string &full_path, const std::string &type, ImGuiID imgui_id, const std::string &description="", const WidgetMetadata &metadata=WidgetMetadata())
 
std::vector< std::string > FindWidgets (const std::string &pattern) const
 
ImGuiID GetWidgetId (const std::string &full_path) const
 
std::optional< WidgetInfoGetWidgetInfo (const std::string &full_path) const
 
std::unordered_map< std::string, WidgetInfoGetAllWidgets () const
 
void Clear ()
 
std::string ExportCatalog (const std::string &format="yaml") const
 
void ExportCatalogToFile (const std::string &output_file, const std::string &format="yaml") const
 

Static Public Member Functions

static WidgetIdRegistryInstance ()
 
static std::string NormalizeLabel (absl::string_view label)
 
static std::string NormalizePathSegment (absl::string_view segment)
 

Private Member Functions

 WidgetIdRegistry ()=default
 
void TrimStaleEntries ()
 
bool ShouldPrune (const WidgetInfo &info) const
 
std::unordered_map< std::string, WidgetInfo > widgets_ ABSL_GUARDED_BY (mutex_)
 
int current_frame_ ABSL_GUARDED_BY (mutex_)
 
absl::Time frame_time_ ABSL_GUARDED_BY (mutex_)
 

Private Attributes

absl::Mutex mutex_
 
int stale_frame_limit_ = 600
 

Detailed Description

Centralized registry for discoverable GUI widgets.

This singleton maintains a catalog of all registered widgets in the application, enabling test automation and AI-driven GUI interaction. Widgets are identified by hierarchical paths like: "Overworld/Main/Toolset/button:DrawTile"

The registry provides:

  • Widget discovery by pattern matching
  • Mapping widget paths to ImGui IDs
  • Export to machine-readable formats for z3ed agent

Definition at line 68 of file widget_id_registry.h.

Constructor & Destructor Documentation

◆ WidgetIdRegistry()

yaze::gui::WidgetIdRegistry::WidgetIdRegistry ( )
privatedefault

Member Function Documentation

◆ Instance()

◆ BeginFrame()

void yaze::gui::WidgetIdRegistry::BeginFrame ( )

Definition at line 64 of file widget_id_registry.cc.

References mutex_.

Referenced by yaze::Controller::OnLoad().

◆ EndFrame()

void yaze::gui::WidgetIdRegistry::EndFrame ( )

Definition at line 80 of file widget_id_registry.cc.

References mutex_, and TrimStaleEntries().

Referenced by yaze::Controller::OnLoad().

Here is the call graph for this function:

◆ RegisterWidget()

void yaze::gui::WidgetIdRegistry::RegisterWidget ( const std::string & full_path,
const std::string & type,
ImGuiID imgui_id,
const std::string & description = "",
const WidgetMetadata & metadata = WidgetMetadata() )

◆ FindWidgets()

std::vector< std::string > yaze::gui::WidgetIdRegistry::FindWidgets ( const std::string & pattern) const

Definition at line 232 of file widget_id_registry.cc.

References mutex_.

◆ GetWidgetId()

ImGuiID yaze::gui::WidgetIdRegistry::GetWidgetId ( const std::string & full_path) const

Definition at line 269 of file widget_id_registry.cc.

References mutex_.

◆ GetWidgetInfo()

std::optional< WidgetIdRegistry::WidgetInfo > yaze::gui::WidgetIdRegistry::GetWidgetInfo ( const std::string & full_path) const

Definition at line 278 of file widget_id_registry.cc.

References mutex_.

◆ GetAllWidgets()

std::unordered_map< std::string, WidgetIdRegistry::WidgetInfo > yaze::gui::WidgetIdRegistry::GetAllWidgets ( ) const

Definition at line 289 of file widget_id_registry.cc.

References mutex_.

Referenced by yaze::test::WidgetDiscoveryService::CollectWidgets().

◆ Clear()

void yaze::gui::WidgetIdRegistry::Clear ( )

Definition at line 294 of file widget_id_registry.cc.

References mutex_.

◆ ExportCatalog()

std::string yaze::gui::WidgetIdRegistry::ExportCatalog ( const std::string & format = "yaml") const

Definition at line 300 of file widget_id_registry.cc.

References mutex_.

Referenced by ExportCatalogToFile().

◆ ExportCatalogToFile()

void yaze::gui::WidgetIdRegistry::ExportCatalogToFile ( const std::string & output_file,
const std::string & format = "yaml" ) const

Definition at line 419 of file widget_id_registry.cc.

References ExportCatalog().

Here is the call graph for this function:

◆ NormalizeLabel()

std::string yaze::gui::WidgetIdRegistry::NormalizeLabel ( absl::string_view label)
static

◆ NormalizePathSegment()

std::string yaze::gui::WidgetIdRegistry::NormalizePathSegment ( absl::string_view segment)
static

Definition at line 438 of file widget_id_registry.cc.

References NormalizeLabel().

Referenced by RegisterWidget().

Here is the call graph for this function:

◆ TrimStaleEntries()

void yaze::gui::WidgetIdRegistry::TrimStaleEntries ( )
private

Definition at line 442 of file widget_id_registry.cc.

References ShouldPrune().

Referenced by EndFrame().

Here is the call graph for this function:

◆ ShouldPrune()

bool yaze::gui::WidgetIdRegistry::ShouldPrune ( const WidgetInfo & info) const
private

◆ ABSL_GUARDED_BY() [1/3]

std::unordered_map< std::string, WidgetInfo > widgets_ yaze::gui::WidgetIdRegistry::ABSL_GUARDED_BY ( mutex_ )
private

◆ ABSL_GUARDED_BY() [2/3]

int current_frame_ yaze::gui::WidgetIdRegistry::ABSL_GUARDED_BY ( mutex_ )
private

◆ ABSL_GUARDED_BY() [3/3]

absl::Time frame_time_ yaze::gui::WidgetIdRegistry::ABSL_GUARDED_BY ( mutex_ )
private

Member Data Documentation

◆ mutex_

absl::Mutex yaze::gui::WidgetIdRegistry::mutex_
mutableprivate

◆ stale_frame_limit_

int yaze::gui::WidgetIdRegistry::stale_frame_limit_ = 600
private

Definition at line 144 of file widget_id_registry.h.

Referenced by ShouldPrune().


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