yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::CommandManager Class Reference

#include <command_manager.h>

Classes

struct  CommandGroup
 
struct  CommandInfo
 

Public Types

using Command = std::function< void()>
 

Public Member Functions

 CommandManager ()=default
 
 ~CommandManager ()=default
 
void RegisterPrefix (const std::string &group_name, const char prefix, const std::string &name, const std::string &desc)
 
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 RegisterCommand (const std::string &shortcut, Command command, char mnemonic, const std::string &name, const std::string &desc)
 
void ExecuteCommand (const std::string &shortcut)
 
void ShowWhichKey ()
 
void ShowWhichKeyHierarchical ()
 
void HandleWhichKeyInput ()
 
void SaveKeybindings (const std::string &filepath)
 
void LoadKeybindings (const std::string &filepath)
 
bool IsWhichKeyActive () const
 
std::string GetCurrentPrefix () const
 

Private Attributes

std::unordered_map< std::string, CommandGroupcommands_
 
bool whichkey_active_ = false
 
std::string current_prefix_
 
float whichkey_timer_ = 0.0f
 

Detailed Description

Definition at line 19 of file command_manager.h.

Member Typedef Documentation

◆ Command

using yaze::editor::CommandManager::Command = std::function<void()>

Definition at line 24 of file command_manager.h.

Constructor & Destructor Documentation

◆ CommandManager()

yaze::editor::CommandManager::CommandManager ( )
default

◆ ~CommandManager()

yaze::editor::CommandManager::~CommandManager ( )
default

Member Function Documentation

◆ RegisterPrefix()

void yaze::editor::CommandManager::RegisterPrefix ( const std::string &  group_name,
const char  prefix,
const std::string &  name,
const std::string &  desc 
)
inline

Definition at line 49 of file command_manager.h.

References commands_.

◆ RegisterSubcommand()

void yaze::editor::CommandManager::RegisterSubcommand ( const std::string &  group_name,
const std::string &  shortcut,
const char  mnemonic,
const std::string &  name,
const std::string &  desc,
Command  command 
)
inline

Definition at line 54 of file command_manager.h.

References commands_.

◆ RegisterCommand()

void yaze::editor::CommandManager::RegisterCommand ( const std::string &  shortcut,
Command  command,
char  mnemonic,
const std::string &  name,
const std::string &  desc 
)
inline

Definition at line 61 of file command_manager.h.

References commands_.

◆ ExecuteCommand()

void yaze::editor::CommandManager::ExecuteCommand ( const std::string &  shortcut)
inline

Definition at line 67 of file command_manager.h.

References commands_.

◆ ShowWhichKey()

void yaze::editor::CommandManager::ShowWhichKey ( )

Definition at line 14 of file command_manager.cc.

References commands_.

◆ ShowWhichKeyHierarchical()

void yaze::editor::CommandManager::ShowWhichKeyHierarchical ( )

Definition at line 80 of file command_manager.cc.

References commands_, current_prefix_, whichkey_active_, and whichkey_timer_.

◆ HandleWhichKeyInput()

void yaze::editor::CommandManager::HandleWhichKeyInput ( )

Definition at line 186 of file command_manager.cc.

References commands_, current_prefix_, yaze::gui::MapKeyToImGuiKey(), whichkey_active_, and whichkey_timer_.

Here is the call graph for this function:

◆ SaveKeybindings()

void yaze::editor::CommandManager::SaveKeybindings ( const std::string &  filepath)

Definition at line 55 of file command_manager.cc.

References commands_.

◆ LoadKeybindings()

void yaze::editor::CommandManager::LoadKeybindings ( const std::string &  filepath)

Definition at line 66 of file command_manager.cc.

References commands_.

◆ IsWhichKeyActive()

bool yaze::editor::CommandManager::IsWhichKeyActive ( ) const
inline

Definition at line 83 of file command_manager.h.

References whichkey_active_.

◆ GetCurrentPrefix()

std::string yaze::editor::CommandManager::GetCurrentPrefix ( ) const
inline

Definition at line 84 of file command_manager.h.

References current_prefix_.

Member Data Documentation

◆ commands_

std::unordered_map<std::string, CommandGroup> yaze::editor::CommandManager::commands_
private

◆ whichkey_active_

bool yaze::editor::CommandManager::whichkey_active_ = false
private

◆ current_prefix_

std::string yaze::editor::CommandManager::current_prefix_
private

◆ whichkey_timer_

float yaze::editor::CommandManager::whichkey_timer_ = 0.0f
private

Definition at line 92 of file command_manager.h.

Referenced by HandleWhichKeyInput(), and ShowWhichKeyHierarchical().


The documentation for this class was generated from the following files: