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);
145 for (
const auto& menu :
menus_) {
147 std::string menu_label = tr(menu.label.c_str());
149 const bool open = ImGui::BeginMenu(menu_label.c_str());
151 std::string(
"MainMenu/menu:") + menu.label,
"menu", ImGui::GetItemID());
154 if (menu.is_custom) {
155 if (menu.custom_draw)
160 for (
const auto& item : menu.items)
185 ? std::string(tr(item.
label.c_str()))
186 : absl::StrCat(item.
icon,
" ", tr(item.
label.c_str()));
187 ImGui::BeginDisabled();
188 ImGui::MenuItem(label.c_str(),
nullptr,
false,
false);
189 ImGui::EndDisabled();
204 ? std::string(tr(item.
label.c_str()))
205 : absl::StrCat(item.
icon,
" ", tr(item.
label.c_str()));
212 ImGui::BeginDisabled();
213 ImGui::MenuItem(label.c_str(),
nullptr,
false,
false);
214 ImGui::EndDisabled();
219 opened = ImGui::BeginMenu(label.c_str());
251 ? std::string(tr(item.
label.c_str()))
252 : absl::StrCat(item.
icon,
" ", tr(item.
label.c_str()));
257 const char* shortcut_str =
260 const bool activated =
261 ImGui::MenuItem(label.c_str(), shortcut_str, checked, enabled);
262 if (item.
label ==
"Save ROM" || item.
label ==
"Quit") {
264 "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.