1#ifndef YAZE_APP_EDITOR_SYSTEM_COMMAND_MANAGER_H
2#define YAZE_APP_EDITOR_SYSTEM_COMMAND_MANAGER_H
6#include <unordered_map>
8#include "imgui/imgui.h"
26 const std::string &
desc)
35 std::unordered_map<std::string, CommandInfoOrPrefix>
subcommands;
42 const std::string &name,
const std::string &desc) {
43 commands_[group_name].command_info = {
nullptr, prefix, name, desc};
47 const std::string &shortcut,
const char mnemonic,
48 const std::string &name,
const std::string &desc,
50 commands_[group_name].subcommands[shortcut].command_info = {
51 command, mnemonic, name, desc};
55 char mnemonic,
const std::string &name,
56 const std::string &desc) {
57 commands_[shortcut].command_info = {std::move(command), mnemonic, name,
63 commands_[shortcut].command_info.command();
73 std::unordered_map<std::string, CommandInfoOrPrefix>
commands_;
void RegisterSubcommand(const std::string &group_name, const std::string &shortcut, const char mnemonic, const std::string &name, const std::string &desc, Command command)
void LoadKeybindings(const std::string &filepath)
void SaveKeybindings(const std::string &filepath)
std::unordered_map< std::string, CommandInfoOrPrefix > commands_
void RegisterPrefix(const std::string &group_name, const char prefix, const std::string &name, const std::string &desc)
std::function< void()> Command
void RegisterCommand(const std::string &shortcut, Command command, char mnemonic, const std::string &name, const std::string &desc)
void ExecuteCommand(const std::string &shortcut)
ImGuiKey MapKeyToImGuiKey(char key)
CommandInfoOrPrefix()=default
std::unordered_map< std::string, CommandInfoOrPrefix > subcommands
CommandInfoOrPrefix(CommandInfo command_info)
CommandInfo(Command command, char mnemonic, const std::string &name, const std::string &desc)