#include <MRShortcutManager.h>
Inheritance diagram for MR::ShortcutManager:Classes | |
| struct | ShortcutCommand |
Public Types | |
| enum class | Reason { Reason::KeyDown , Reason::KeyRepeat } |
| using | ShortcutKey = MR::ShortcutKey |
| using | Category = MR::ShortcutCategory |
| using | ShortcutList = std::vector<std::tuple<ShortcutKey, Category, std::string>> |
Public Member Functions | |
| virtual | ~ShortcutManager ()=default |
| virtual MRVIEWER_API void | setShortcut (const ShortcutKey &key, const ShortcutCommand &command) |
| MRVIEWER_API const ShortcutList & | getShortcutList () const |
| bool | isEnabled () const |
| processShortcut does nothing if not enabled | |
| void | enable (bool on) |
| virtual MRVIEWER_API bool | processShortcut (const ShortcutKey &key, Reason=Reason::KeyDown) const |
| if given key has action in shortcut map - process it and returns true, otherwise returns false; | |
| MRVIEWER_API bool | onKeyDown_ (int key, int modifier) override |
| MRVIEWER_API bool | onKeyRepeat_ (int key, int modifier) override |
| MRVIEWER_API std::optional< ShortcutKey > | findShortcutByName (const std::string &name) const |
| if action with given name is present in shortcut list - returns it | |
| MRVIEWER_API void | clear () |
| clear all saved shortcuts | |
Public Member Functions inherited from MR::MultiListener< KeyDownListener, KeyRepeatListener > | |
| virtual | ~MultiListener ()=default |
| virtual void | connect (Viewer *viewer, int group=0, boost::signals2::connect_position pos=boost::signals2::connect_position::at_back) |
| virtual void | disconnect () |
Static Public Member Functions | |
| static MRVIEWER_API const char * | getModifierString (int mod) |
| make string from strictly one modifier | |
| static MRVIEWER_API std::string | getKeyString (int key) |
| make string from a key without modifiers, for arrow characters it uses icons font | |
| static MRVIEWER_API std::string | getKeyFullString (const ShortcutKey &key, bool respectKey=true) |
| make string from all modifiers and with/without key and returns it | |
Static Public Attributes | |
| static const std::string | categoryNames [6] = { "Info", "Edit", "View", "Scene", "Objects", "Selection " } |
Protected Types | |
| using | ShourtcutsMap = HashMap<int, ShortcutCommand> |
| using | ShourtcutsBackMap = HashMap<std::string, int> |
Static Protected Member Functions | |
| static MRVIEWER_API int | mapKeyFromKeyAndMod (const ShortcutKey &key, bool respectKeyboard) |
| static ShortcutKey | kayAndModFromMapKey (int mapKey) |
| returns key with modifier (alt, ctrl, shift, etc.) from simple map key | |
Protected Attributes | |
| bool | enabled_ { true } |
| ShourtcutsMap | map_ |
| ShourtcutsBackMap | backMap_ |
| std::optional< ShortcutList > | listCache_ |
this class stores two maps: 1) shortcut to action 2) action name to shortcut it can be used to process, customize and print shortcuts indifferent to literals register