MeshLib Documentation
Loading...
Searching...
No Matches
MR::ShortcutManager Class Reference

#include <MRShortcutManager.h>

+ Inheritance diagram for MR::ShortcutManager:

Classes

struct  ShortcutCommand
 

Public Types

enum class  Reason { KeyDown , 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 ShortcutListgetShortcutList () const
 
bool isEnabled () const
 
void enable (bool on)
 
virtual MRVIEWER_API bool processShortcut (const ShortcutKey &key, Reason=Reason::KeyDown) const
 
MRVIEWER_API bool onKeyDown_ (int key, int modifier) override
 
MRVIEWER_API bool onKeyRepeat_ (int key, int modifier) override
 
MRVIEWER_API std::optional< ShortcutKeyfindShortcutByName (const std::string &name) const
 
MRVIEWER_API void clear ()
 
- 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 std::string getModifierString (int mod)
 
static MRVIEWER_API std::string getKeyString (int key)
 
static MRVIEWER_API std::string getKeyFullString (const ShortcutKey &key, bool respectKey=true)
 

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)
 

Protected Attributes

bool enabled_ { true }
 
ShourtcutsMap map_
 
ShourtcutsBackMap backMap_
 
std::optional< ShortcutListlistCache_
 

Member Typedef Documentation

◆ Category

◆ ShortcutKey

◆ ShortcutList

using MR::ShortcutManager::ShortcutList = std::vector<std::tuple<ShortcutKey, Category, std::string>>

◆ ShourtcutsBackMap

using MR::ShortcutManager::ShourtcutsBackMap = HashMap<std::string, int>
protected

◆ ShourtcutsMap

Member Enumeration Documentation

◆ Reason

enum class MR::ShortcutManager::Reason
strong
Enumerator
KeyDown 
KeyRepeat 

Constructor & Destructor Documentation

◆ ~ShortcutManager()

virtual MR::ShortcutManager::~ShortcutManager ( )
virtualdefault

Member Function Documentation

◆ clear()

MRVIEWER_API void MR::ShortcutManager::clear ( )

◆ enable()

void MR::ShortcutManager::enable ( bool on)
inline

◆ findShortcutByName()

MRVIEWER_API std::optional< ShortcutKey > MR::ShortcutManager::findShortcutByName ( const std::string & name) const

◆ getKeyFullString()

static MRVIEWER_API std::string MR::ShortcutManager::getKeyFullString ( const ShortcutKey & key,
bool respectKey = true )
static

◆ getKeyString()

static MRVIEWER_API std::string MR::ShortcutManager::getKeyString ( int key)
static

◆ getModifierString()

static MRVIEWER_API std::string MR::ShortcutManager::getModifierString ( int mod)
static

◆ getShortcutList()

MRVIEWER_API const ShortcutList & MR::ShortcutManager::getShortcutList ( ) const

◆ isEnabled()

bool MR::ShortcutManager::isEnabled ( ) const
inline

◆ kayAndModFromMapKey()

static ShortcutKey MR::ShortcutManager::kayAndModFromMapKey ( int mapKey)
inlinestaticprotected

◆ mapKeyFromKeyAndMod()

static MRVIEWER_API int MR::ShortcutManager::mapKeyFromKeyAndMod ( const ShortcutKey & key,
bool respectKeyboard )
staticprotected

◆ onKeyDown_()

MRVIEWER_API bool MR::ShortcutManager::onKeyDown_ ( int key,
int modifier )
override

◆ onKeyRepeat_()

MRVIEWER_API bool MR::ShortcutManager::onKeyRepeat_ ( int key,
int modifier )
override

◆ processShortcut()

virtual MRVIEWER_API bool MR::ShortcutManager::processShortcut ( const ShortcutKey & key,
Reason = Reason::KeyDown ) const
virtual

◆ setShortcut()

virtual MRVIEWER_API void MR::ShortcutManager::setShortcut ( const ShortcutKey & key,
const ShortcutCommand & command )
virtual

Member Data Documentation

◆ backMap_

ShourtcutsBackMap MR::ShortcutManager::backMap_
protected

◆ categoryNames

const std::string MR::ShortcutManager::categoryNames[6] = { "Info", "Edit", "View", "Scene", "Objects", "Selection " }
inlinestatic

◆ enabled_

bool MR::ShortcutManager::enabled_ { true }
protected

◆ listCache_

std::optional<ShortcutList> MR::ShortcutManager::listCache_
mutableprotected

◆ map_

ShourtcutsMap MR::ShortcutManager::map_
protected

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