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"
28 const std::string &
desc)
39 std::unordered_map<std::string, CommandInfoOrPrefix>
subcommands;
46 const std::string &name,
const std::string &desc) {
47 commands_[group_name].command_info = {
nullptr, prefix, name, desc};
51 const std::string &shortcut,
const char mnemonic,
52 const std::string &name,
const std::string &desc,
54 commands_[group_name].subcommands[shortcut].command_info = {
55 command, mnemonic, name, desc};
59 char mnemonic,
const std::string &name,
60 const std::string &desc) {
61 commands_[shortcut].command_info = {std::move(command), mnemonic, name,
67 commands_[shortcut].command_info.command();
77 std::unordered_map<std::string, CommandInfoOrPrefix>
commands_;
~CommandManager()=default
void RegisterSubcommand(const std::string &group_name, const std::string &shortcut, const char mnemonic, const std::string &name, const std::string &desc, Command command)
std::unordered_map< std::string, CommandInfoOrPrefix > commands_
void LoadKeybindings(const std::string &filepath)
std::function< void()> Command
void ExecuteCommand(const std::string &shortcut)
void SaveKeybindings(const std::string &filepath)
void RegisterCommand(const std::string &shortcut, Command command, char mnemonic, const std::string &name, const std::string &desc)
void RegisterPrefix(const std::string &group_name, const char prefix, const std::string &name, const std::string &desc)
Editors are the view controllers for the application.
ImGuiKey MapKeyToImGuiKey(char key)
Main namespace for the application.
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)