MeVisLab Toolbox Reference
SoCommandAction.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2008, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef SO_COMMAND_ACTION_H
14#define SO_COMMAND_ACTION_H
15
16#include "SoInteraction.h"
17
18#include <ThirdPartyWarningsDisable.h>
19#include <Inventor/events/SoKeyboardEvent.h>
20
21#include <map>
22#include <ThirdPartyWarningsRestore.h>
23
25
26class SoNode;
27
45 : public SoInteraction
46{
47public:
48
50
54
56 typedef std::list<Shortcut> ShortcutList;
57
60
62 typedef std::list<Shortcut> TriggerList;
63
68 SoCommandAction(SoInteractionOwner* owner, std::string id);
69
72 bool setShortcut(const std::string& shortcut);
73
75 void setShortcut(const Shortcut& shortcut);
76
78 void addShortcut(const Shortcut& shortcut);
79
81 void clearShortcuts() { _shortcuts.clear(); }
82
84 ShortcutList getShortcuts() const { return _shortcuts; }
85
87 TriggerList getTriggers() const { return _shortcuts; }
88
93 virtual bool isShortcut(int modifiers, SoKeyboardEvent::Key keyCode) const;
94
96 virtual void execute() = 0;
97
98private:
99 ShortcutList _shortcuts;
100};
101
102#endif // __SoCommandAction_H
#define SOMANAGEDINTERACTION_API
File to resolve system dependencies in View2D library.
ManagedKeyboardShortcut Shortcut
SoCommandAction(SoInteractionOwner *owner, std::string id)
ManagedKeyboardShortcut Trigger
Also define Trigger as synonym for Shortcut, since that name is used by the other interactions.
void setShortcut(const Shortcut &shortcut)
Sets the (only) default key shortcut.
virtual bool isShortcut(int modifiers, SoKeyboardEvent::Key keyCode) const
bool setShortcut(const std::string &shortcut)
virtual void execute()=0
Executes the action. Must be overridden by user.
void addShortcut(const Shortcut &shortcut)
Adds another default key shortcut.
void clearShortcuts()
Clears all currently set shortcuts.
ShortcutList getShortcuts() const
Returns the default key shortcuts.
std::list< Shortcut > TriggerList
Defines TriggerList as synonym for ShortcutList.
std::list< Shortcut > ShortcutList
A list of shortcuts.
TriggerList getTriggers() const
Alternative name for getShortcuts().
SoInteraction(InteractionType type, SoInteractionOwner *owner, const std::string &id, bool registerWithOwner=true)