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 WidgetInfo * | GetWidgetInfo (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 WidgetIdRegistry & | Instance () |
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, WidgetInfo > | widgets_ |
int | current_frame_ = -1 |
absl::Time | frame_time_ |
int | stale_frame_limit_ = 600 |
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:
Definition at line 67 of file widget_id_registry.h.
|
privatedefault |
|
static |
Definition at line 58 of file widget_id_registry.cc.
Referenced by yaze::gui::Toolset::AddAction(), yaze::gui::AutoRegisterLastItem(), yaze::gui::EditorCard::Begin(), yaze::test::WidgetDiscoveryService::CollectWidgets(), and yaze::core::Controller::OnLoad().
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().
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().
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() |
||
) |
Definition at line 158 of file widget_id_registry.cc.
References yaze::gui::WidgetIdRegistry::WidgetMetadata::bounds, yaze::gui::WidgetIdRegistry::WidgetInfo::bounds, current_frame_, yaze::gui::WidgetIdRegistry::WidgetInfo::description, yaze::gui::WidgetIdRegistry::WidgetMetadata::enabled, yaze::gui::WidgetIdRegistry::WidgetInfo::enabled, yaze::gui::WidgetIdRegistry::WidgetInfo::full_path, yaze::gui::WidgetIdRegistry::WidgetInfo::imgui_id, yaze::gui::WidgetIdRegistry::WidgetMetadata::label, yaze::gui::WidgetIdRegistry::WidgetInfo::label, yaze::gui::WidgetIdRegistry::WidgetInfo::last_seen_frame, yaze::gui::WidgetIdRegistry::WidgetInfo::last_seen_time, NormalizeLabel(), NormalizePathSegment(), yaze::gui::WidgetIdRegistry::WidgetInfo::seen_in_current_frame, yaze::gui::WidgetIdRegistry::WidgetInfo::stale_frame_count, yaze::gui::WidgetIdRegistry::WidgetInfo::type, yaze::gui::WidgetIdRegistry::WidgetBounds::valid, yaze::gui::WidgetIdRegistry::WidgetMetadata::visible, yaze::gui::WidgetIdRegistry::WidgetInfo::visible, widgets_, yaze::gui::WidgetIdRegistry::WidgetMetadata::window_name, and yaze::gui::WidgetIdRegistry::WidgetInfo::window_name.
Referenced by yaze::gui::Toolset::AddAction(), yaze::gui::AutoRegisterLastItem(), and yaze::gui::EditorCard::Begin().
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_.
ImGuiID yaze::gui::WidgetIdRegistry::GetWidgetId | ( | const std::string & | full_path | ) | const |
Definition at line 264 of file widget_id_registry.cc.
References widgets_.
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_.
|
inline |
Definition at line 120 of file widget_id_registry.h.
References widgets_.
Referenced by yaze::test::WidgetDiscoveryService::CollectWidgets().
void yaze::gui::WidgetIdRegistry::Clear | ( | ) |
Definition at line 281 of file widget_id_registry.cc.
References current_frame_, and widgets_.
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().
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().
|
static |
Definition at line 411 of file widget_id_registry.cc.
Referenced by yaze::gui::AutoRegisterLastItem(), NormalizePathSegment(), and RegisterWidget().
|
static |
Definition at line 420 of file widget_id_registry.cc.
References NormalizeLabel().
Referenced by RegisterWidget().
|
private |
Definition at line 424 of file widget_id_registry.cc.
References ShouldPrune(), and widgets_.
Referenced by EndFrame().
|
private |
Definition at line 435 of file widget_id_registry.cc.
References current_frame_, yaze::gui::WidgetIdRegistry::WidgetInfo::last_seen_frame, and stale_frame_limit_.
Referenced by TrimStaleEntries().
|
private |
Definition at line 142 of file widget_id_registry.h.
Referenced by BeginFrame(), Clear(), EndFrame(), ExportCatalog(), FindWidgets(), GetAllWidgets(), GetWidgetId(), GetWidgetInfo(), RegisterWidget(), and TrimStaleEntries().
|
private |
Definition at line 143 of file widget_id_registry.h.
Referenced by BeginFrame(), Clear(), RegisterWidget(), and ShouldPrune().
|
private |
Definition at line 144 of file widget_id_registry.h.
Referenced by BeginFrame().
|
private |
Definition at line 145 of file widget_id_registry.h.
Referenced by ShouldPrune().