1#ifndef YAZE_APP_GUI_AUTOMATION_WIDGET_ID_REGISTRY_H_
2#define YAZE_APP_GUI_AUTOMATION_WIDGET_ID_REGISTRY_H_
7#include <unordered_map>
10#include "absl/strings/string_view.h"
11#include "absl/time/time.h"
12#include "imgui/imgui.h"
46 const std::string& widget_name)
const;
50 static thread_local std::vector<std::string>
id_stack_;
78 std::optional<std::string>
label;
109 void RegisterWidget(
const std::string& full_path,
const std::string& type,
110 ImGuiID imgui_id,
const std::string& description =
"",
114 std::vector<std::string>
FindWidgets(
const std::string& pattern)
const;
115 ImGuiID
GetWidgetId(
const std::string& full_path)
const;
128 std::string
ExportCatalog(
const std::string& format =
"yaml")
const;
130 const std::string& format =
"yaml")
const;
141 std::unordered_map<std::string, WidgetInfo>
widgets_;
148#define YAZE_WIDGET_SCOPE(name) \
149 yaze::gui::WidgetIdScope _yaze_scope_##__LINE__(name)
152#define YAZE_REGISTER_WIDGET(widget_type, widget_name) \
154 if (ImGui::GetItemID() != 0) { \
155 yaze::gui::WidgetIdRegistry::Instance().RegisterWidget( \
156 _yaze_scope_##__LINE__.GetWidgetPath(#widget_type, widget_name), \
157 #widget_type, ImGui::GetItemID()); \
163#define YAZE_REGISTER_CURRENT_WIDGET(widget_type) \
165 if (ImGui::GetItemID() != 0) { \
166 yaze::gui::WidgetIdRegistry::Instance().RegisterWidget( \
167 _yaze_scope_##__LINE__.GetWidgetPath(widget_type, \
168 ImGui::GetLastItemLabel()), \
169 widget_type, ImGui::GetItemID()); \