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)
37 std::unordered_map<std::string, CommandInfoOrPrefix>
subcommands;
44 const std::string &name,
const std::string &desc) {
45 commands_[group_name].command_info = {
nullptr, prefix, name, desc};
49 const std::string &shortcut,
const char mnemonic,
50 const std::string &name,
const std::string &desc,
52 commands_[group_name].subcommands[shortcut].command_info = {
53 command, mnemonic, name, desc};
57 char mnemonic,
const std::string &name,
58 const std::string &desc) {
59 commands_[shortcut].command_info = {std::move(command), mnemonic, name,
65 commands_[shortcut].command_info.command();
75 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.
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)