QVISH 0.1
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
Wizt::ShortcutActivatorArray< SubindexType > Struct Template Reference

One VParameter, multiple shortcuts, identified via some subindex of an arbitrary type, e.g. More...

#include <ShortcutEmitter.hpp>

Inheritance diagram for Wizt::ShortcutActivatorArray< SubindexType >:

Classes

struct  MyActivator
 Internal activator class. More...
 

Public Types

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

Public Member Functions

void insertShortcutAction (const string &ShortcutSequence, const SubindexType &SubIndex, const string &theName, const string &tooltip, const action_t &theAction)
 Insert the action that is supposed to be associated with a given shortcut sequence.
 
RefPtr< MyActivatormkActivator (const SubindexType &SubIndex, const string &theName, const string &tooltip, const action_t &theAction)
 

Public Attributes

std::unordered_map< SubindexType, RefPtr< MyActivator > > myShortcutActivators
 

Detailed Description

template<typename SubindexType>
struct Wizt::ShortcutActivatorArray< SubindexType >

One VParameter, multiple shortcuts, identified via some subindex of an arbitrary type, e.g.

some integer. The shortcut action disappears once the parameter dies.

Use case: radio buttons, or list of labels.

Usage:

  1. Associate this ShortcutActivatorArray with a VParameter:
    VParameter&param = ... ;
    auto &SAA = interface_cast<ShortcutActivatorArray<int>(param) ();
  2. Use the ShortcutActivatorArray to create an Activator with the index type (e.g. 42) and insert it globally:
    SAA.insertShortcutAction( "CTRL+4", 42, "My Action", "Tooltip: This Action does something",
    [](){ Assert(false); }
    );
Todo:
Handle removal of shortcuts

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