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
 
const WidgetInfoGetWidgetInfo (const std::string &full_path) const
 
const std::unordered_map< std::string, WidgetInfo > & GetAllWidgets () 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
 

Private Attributes

std::unordered_map< std::string, WidgetInfowidgets_
 
int current_frame_ = -1
 
absl::Time frame_time_
 
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 67 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 63 of file widget_id_registry.cc.

References current_frame_, frame_time_, and widgets_.

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

◆ EndFrame()

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

Definition at line 78 of file widget_id_registry.cc.

References TrimStaleEntries(), and widgets_.

Referenced by yaze::core::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 229 of file widget_id_registry.cc.

References widgets_.

◆ GetWidgetId()

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

Definition at line 264 of file widget_id_registry.cc.

References widgets_.

◆ GetWidgetInfo()

const WidgetIdRegistry::WidgetInfo * yaze::gui::WidgetIdRegistry::GetWidgetInfo ( const std::string &  full_path) const

Definition at line 272 of file widget_id_registry.cc.

References widgets_.

◆ GetAllWidgets()

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

Definition at line 120 of file widget_id_registry.h.

References widgets_.

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

◆ Clear()

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

Definition at line 281 of file widget_id_registry.cc.

References current_frame_, and widgets_.

◆ ExportCatalog()

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

Definition at line 286 of file widget_id_registry.cc.

References widgets_.

Referenced by ExportCatalogToFile().

◆ ExportCatalogToFile()

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

Definition at line 401 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 420 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 424 of file widget_id_registry.cc.

References ShouldPrune(), and widgets_.

Referenced by EndFrame().

Here is the call graph for this function:

◆ ShouldPrune()

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

Member Data Documentation

◆ widgets_

std::unordered_map<std::string, WidgetInfo> yaze::gui::WidgetIdRegistry::widgets_
private

◆ current_frame_

int yaze::gui::WidgetIdRegistry::current_frame_ = -1
private

Definition at line 143 of file widget_id_registry.h.

Referenced by BeginFrame(), Clear(), RegisterWidget(), and ShouldPrune().

◆ frame_time_

absl::Time yaze::gui::WidgetIdRegistry::frame_time_
private

Definition at line 144 of file widget_id_registry.h.

Referenced by BeginFrame().

◆ stale_frame_limit_

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

Definition at line 145 of file widget_id_registry.h.

Referenced by ShouldPrune().


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