3#include "MRMesh/MRphmap.h"
56 bool repeatable =
true;
59 inline static const std::string categoryNames[6] = {
"Info",
"Edit",
"View",
"Scene",
"Objects",
"Selection " };
66 using ShortcutList = std::vector<std::tuple<ShortcutKey, Category, std::string>>;
80 void enable(
bool on ) { enabled_ = on; }
85 MRVIEWER_API
bool onKeyDown_(
int key,
int modifier )
override;
110 bool enabled_{
true };
Definition MRShortcutManager.h:44
static ShortcutKey kayAndModFromMapKey(int mapKey)
Definition MRShortcutManager.h:105
MRVIEWER_API const ShortcutList & getShortcutList() const
HashMap< std::string, int > ShourtcutsBackMap
Definition MRShortcutManager.h:108
Reason
Definition MRShortcutManager.h:73
static MRVIEWER_API std::string getKeyString(int key)
MRVIEWER_API bool onKeyDown_(int key, int modifier) override
virtual MRVIEWER_API bool processShortcut(const ShortcutKey &key, Reason=Reason::KeyDown) const
void enable(bool on)
Definition MRShortcutManager.h:80
MRVIEWER_API void clear()
virtual MRVIEWER_API void setShortcut(const ShortcutKey &key, const ShortcutCommand &command)
std::vector< std::tuple< ShortcutKey, Category, std::string > > ShortcutList
Definition MRShortcutManager.h:66
HashMap< int, ShortcutCommand > ShourtcutsMap
Definition MRShortcutManager.h:107
ShourtcutsBackMap backMap_
Definition MRShortcutManager.h:113
ShourtcutsMap map_
Definition MRShortcutManager.h:112
bool isEnabled() const
Definition MRShortcutManager.h:79
virtual ~ShortcutManager()=default
static MRVIEWER_API int mapKeyFromKeyAndMod(const ShortcutKey &key, bool respectKeyboard)
static MRVIEWER_API std::string getModifierString(int mod)
static MRVIEWER_API std::string getKeyFullString(const ShortcutKey &key, bool respectKey=true)
MRVIEWER_API std::optional< ShortcutKey > findShortcutByName(const std::string &name) const
std::optional< ShortcutList > listCache_
Definition MRShortcutManager.h:115
MRVIEWER_API bool onKeyRepeat_(int key, int modifier) override
Definition MRCameraOrientationPlugin.h:8
ShortcutCategory
Definition MRShortcutManager.h:28
phmap::flat_hash_map< K, V, Hash, Eq > HashMap
Definition MRMesh/MRMeshFwd.h:460
Definition MRViewerEventsListener.h:29
Definition MRShortcutManager.h:13
int key
Definition MRShortcutManager.h:14
bool operator<(const ShortcutKey &other) const
Definition MRShortcutManager.h:17
int mod
Definition MRShortcutManager.h:15
Definition MRShortcutManager.h:52
std::function< void()> action
Definition MRShortcutManager.h:55
std::string name
Definition MRShortcutManager.h:54
Category category
Definition MRShortcutManager.h:53