MeshLib C++ Docs
Loading...
Searching...
No Matches

#include <MRViewer/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 void setShortcut (const ShortcutKey &key, const ShortcutCommand &command)
const ShortcutListgetShortcutList () const
bool isEnabled () const
 processShortcut does nothing if not enabled
void enable (bool on)
virtual 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;
bool onKeyDown_ (int key, int modifier) override
bool onKeyRepeat_ (int key, int modifier) override
std::optional< ShortcutKeyfindShortcutByName (const std::string &name) const
 if action with given name is present in shortcut list - returns it
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 const char * getModifierString (int mod)
 make string from strictly one modifier
static std::string getKeyString (int key)
 make string from a key without modifiers, for arrow characters it uses icons font
static 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 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< ShortcutListlistCache_

Detailed Description

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


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