1#ifndef YAZE_APP_EDITOR_SYSTEM_COMMAND_MANAGER_H
2#define YAZE_APP_EDITOR_SYSTEM_COMMAND_MANAGER_H
7#include <unordered_map>
10#ifndef IMGUI_DEFINE_MATH_OPERATORS
11#define IMGUI_DEFINE_MATH_OPERATORS
14#include "imgui/imgui.h"
32 const std::string &
desc)
50 const std::string &name,
const std::string &desc) {
51 commands_[group_name].main_command = {
nullptr, prefix, name, desc};
55 const std::string &shortcut,
const char mnemonic,
56 const std::string &name,
const std::string &desc,
58 commands_[group_name].subcommands[shortcut] = {command, mnemonic, name, desc};
62 char mnemonic,
const std::string &name,
63 const std::string &desc) {
64 commands_[shortcut].main_command = {std::move(command), mnemonic, name, desc};
69 commands_[shortcut].main_command.command();
79 std::unordered_map<std::string, CommandGroup>
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)
void LoadKeybindings(const std::string &filepath)
std::function< void()> Command
void ExecuteCommand(const std::string &shortcut)
std::unordered_map< std::string, CommandGroup > commands_
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)
Main namespace for the application.
CommandGroup(CommandInfo main)
std::unordered_map< std::string, CommandInfo > subcommands
CommandInfo(Command command, char mnemonic, const std::string &name, const std::string &desc)