yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
menu_shortcut_labels.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_MENU_MENU_SHORTCUT_LABELS_H_
2#define YAZE_APP_EDITOR_MENU_MENU_SHORTCUT_LABELS_H_
3
4#include <string>
5
6#include "absl/strings/string_view.h"
7
8namespace yaze {
9namespace editor {
10
11class ShortcutManager;
12
13// Returns the display label ("Ctrl+Shift+Z", "Cmd+O", ...) for the live
14// binding registered under `action` in `shortcut_manager`, or an empty string
15// when the manager is null, the action is unknown, or the action has no keys.
16//
17// Menus must use this instead of hard-coded key hints so a label can never
18// drift from the binding that actually fires. This is the single place that
19// reads ShortcutManager for menu labels. After claude/ui-shortcuts (ece5e6d9d)
20// merges, switch the body to ShortcutManager::GetDisplayString(name), which
21// has the same contract (platform-formatted, rebind-aware, "" when unknown or
22// unbound). Menus must reference primary names ("Redo", "Window Browser"),
23// not palette-only aliases ("Redo (Alt)", legacy "Panel ..." names).
24std::string ShortcutLabelForAction(const ShortcutManager* shortcut_manager,
25 absl::string_view action);
26
27} // namespace editor
28} // namespace yaze
29
30#endif // YAZE_APP_EDITOR_MENU_MENU_SHORTCUT_LABELS_H_
std::string ShortcutLabelForAction(const ShortcutManager *shortcut_manager, absl::string_view action)