3#include "absl/strings/str_cat.h"
43 bool is_submenu =
false;
72 Callback callback,
const char* shortcut,
95 return Item(label,
nullptr, callback, shortcut, enabled,
nullptr);
134 for (
const auto& menu :
menus_) {
136 std::string menu_label = tr(menu.label.c_str());
138 const bool open = ImGui::BeginMenu(menu_label.c_str());
140 std::string(
"MainMenu/menu:") + menu.label,
"menu", ImGui::GetItemID());
143 if (menu.is_custom) {
144 if (menu.custom_draw)
149 for (
const auto& item : menu.items)
168 ? std::string(tr(item.
label.c_str()))
169 : absl::StrCat(item.
icon,
" ", tr(item.
label.c_str()));
170 ImGui::BeginDisabled();
171 ImGui::MenuItem(label.c_str(),
nullptr,
false,
false);
172 ImGui::EndDisabled();
187 ? std::string(tr(item.
label.c_str()))
188 : absl::StrCat(item.
icon,
" ", tr(item.
label.c_str()));
195 ImGui::BeginDisabled();
196 ImGui::MenuItem(label.c_str(),
nullptr,
false,
false);
197 ImGui::EndDisabled();
202 opened = ImGui::BeginMenu(label.c_str());
234 ? std::string(tr(item.
label.c_str()))
235 : absl::StrCat(item.
icon,
" ", tr(item.
label.c_str()));
240 const char* shortcut_str =
243 const bool activated =
244 ImGui::MenuItem(label.c_str(), shortcut_str, checked, enabled);
245 if (item.
label ==
"Save ROM" || item.
label ==
"Quit") {
247 "Stable file-menu harness action");
void AutoRegisterLastItem(const std::string &widget_type, const std::string &explicit_label, const std::string &description)
Automatically register the last ImGui item.