MeVisLab Toolbox Reference
|
SoCommandAction is the base class for instantaneous actions. More...
#include <SoCommandAction.h>
Public Types | |
enum | { TypeId = TypeCommandAction } |
typedef ManagedKeyboardShortcut | Shortcut |
Class Shortcut encapsulates the combination of modifier keys and another key that activates a command. More... | |
typedef std::list< Shortcut > | ShortcutList |
A list of shortcuts. More... | |
typedef ManagedKeyboardShortcut | Trigger |
Also define Trigger as synonym for Shortcut, since that name is used by the other interactions. More... | |
typedef std::list< Shortcut > | TriggerList |
Defines TriggerList as synonym for ShortcutList. More... | |
Public Types inherited from SoInteraction | |
enum | { NoModifier = ManagedActionTrigger::NoModifier , ShiftModifier = ManagedActionTrigger::ShiftModifier , ControlModifier = ManagedActionTrigger::ControlModifier , AltModifier = ManagedActionTrigger::AltModifier , AllModifiersMask = ManagedActionTrigger::AllModifiersMask , ShiftMask = ShiftModifier , CtrlMask = ControlModifier , AltMask = AltModifier } |
Constants to use where keyboard modifiers must be specified. More... | |
enum | InteractionType { TypePointingAction , TypeCommandAction , TypeOffsetAction } |
Enum identifying subtypes of this class. More... | |
Public Member Functions | |
SoCommandAction (SoInteractionOwner *owner, std::string id) | |
Standard constructor. More... | |
bool | setShortcut (const std::string &shortcut) |
Sets the (only) default key shortcut (as string describing the shortcut, see ManagedKeyboardShortcut::fromString). More... | |
void | setShortcut (const Shortcut &shortcut) |
Sets the (only) default key shortcut. More... | |
void | addShortcut (const Shortcut &shortcut) |
Adds another default key shortcut. More... | |
void | clearShortcuts () |
Clears all currently set shortcuts. More... | |
ShortcutList | getShortcuts () const |
Returns the default key shortcuts. More... | |
TriggerList | getTriggers () const |
Alternative name for getShortcuts() More... | |
virtual bool | isShortcut (int modifiers, SoKeyboardEvent::Key keyCode) const |
Checks whether the given key with the given modifiers is a shortcut for this action; see SoInteraction for possible modifiers. More... | |
virtual void | execute ()=0 |
Executes the action. Must be overridden by user. More... | |
Public Member Functions inherited from SoInteraction | |
SoInteraction (InteractionType type, SoInteractionOwner *owner, const std::string &id, bool registerWithOwner=true) | |
Standard constructor. More... | |
virtual | ~SoInteraction () |
Virtual destructor. More... | |
SoInteractionOwner * | getOwner () const |
Returns the interaction provider of this entry. More... | |
virtual bool | isEnabled () const |
Returns the enabled status of this interaction - if this returns false , the action is not selectable (but if a mouse action has already been started, it will not be aborted if this returns false ). More... | |
virtual void | setEnabled (bool enabled) |
Sets the enabled status of this interaction. More... | |
std::string | getID () const |
Returns the ID of this interaction. More... | |
void | setID (const std::string &id) |
Sets the ID of this interaction. More... | |
std::string | getFullID () const |
Returns the ID string consisting of the ID of the provider and this action's ID, separated by '. More... | |
InteractionType | getInteractionType () const |
Returns type of interaction object. More... | |
template<class T > | |
bool | isOfType () const |
Convenience method for checking type. More... | |
int | getMenuPriority () const |
void | setMenuPriority (int priority) |
Sets the priority value for ordered display in menus/tool boxes. More... | |
virtual std::string | getUserName () const |
Returns user-visible name of this item for direct display (e.g., in tool box or menu). More... | |
virtual void | setUserName (const std::string &name) |
Sets the user name of this interaction entry. More... | |
virtual std::string | getIconFile () const |
Returns the filename of an icon (e.g., for use in a tool box or in menu). More... | |
virtual void | setIconFile (const std::string &file) |
Sets the filename of an icon used for this interaction entry. More... | |
virtual std::string | getDescription () const |
Returns the description for user help. More... | |
virtual void | setDescription (const std::string &descr) |
Sets the description for user help. More... | |
virtual void | ref () |
virtual void | unref () |
int | getStateVersion () const |
void | touch () |
Increments the version number of attribute state to mark attribute changes. More... | |
SoCommandAction is the base class for instantaneous actions.
You need to override execute() in derived classes!
Some special action IDs should be reserved for special purposes (or rather for standard edit commands): undo, redo, cut, copy, paste, and selectAll; - if you implement these, implement the expected behavior!
Definition at line 44 of file SoCommandAction.h.
Class Shortcut encapsulates the combination of modifier keys and another key that activates a command.
Definition at line 53 of file SoCommandAction.h.
typedef std::list<Shortcut> SoCommandAction::ShortcutList |
A list of shortcuts.
Definition at line 56 of file SoCommandAction.h.
Also define Trigger as synonym for Shortcut, since that name is used by the other interactions.
Definition at line 59 of file SoCommandAction.h.
typedef std::list<Shortcut> SoCommandAction::TriggerList |
Defines TriggerList as synonym for ShortcutList.
Definition at line 62 of file SoCommandAction.h.
anonymous enum |
Enumerator | |
---|---|
TypeId |
Definition at line 49 of file SoCommandAction.h.
SoCommandAction::SoCommandAction | ( | SoInteractionOwner * | owner, |
std::string | id | ||
) |
Standard constructor.
owner | The SoInteractionOwner to which the action is added. Ownership is automatically transferred, you do not need to free this object. |
id | The name of this interaction, it should hint at its purpose |
void SoCommandAction::addShortcut | ( | const Shortcut & | shortcut | ) |
Adds another default key shortcut.
|
inline |
Clears all currently set shortcuts.
Definition at line 81 of file SoCommandAction.h.
|
pure virtual |
Executes the action. Must be overridden by user.
Implemented in SoView2DKeyboardAction, CSORemoveAllCommandAction, CSOCancelCommandAction, CSORedoCommandAction, CSOUndoCommandAction, CSODeleteCSOCommandAction, CSODeleteSeedPointCommandAction, CSOPasteCommandAction, CSOCutCommandAction, CSOCopyCommandAction, SoCSODrawOnSurfaceRedoCommandAction, SoCSODrawOnSurfaceUndoCommandAction, and SoCSODrawOnSurfaceCancelCommandAction.
|
inline |
Returns the default key shortcuts.
Definition at line 84 of file SoCommandAction.h.
|
inline |
Alternative name for getShortcuts()
Definition at line 87 of file SoCommandAction.h.
|
virtual |
Checks whether the given key with the given modifiers is a shortcut for this action; see SoInteraction for possible modifiers.
Overrides from the interaction controller are ignored by this method.
void SoCommandAction::setShortcut | ( | const Shortcut & | shortcut | ) |
Sets the (only) default key shortcut.
bool SoCommandAction::setShortcut | ( | const std::string & | shortcut | ) |
Sets the (only) default key shortcut (as string describing the shortcut, see ManagedKeyboardShortcut::fromString).
Referenced by SoCSODrawOnSurfaceCancelCommandAction::SoCSODrawOnSurfaceCancelCommandAction(), SoCSODrawOnSurfaceRedoCommandAction::SoCSODrawOnSurfaceRedoCommandAction(), and SoCSODrawOnSurfaceUndoCommandAction::SoCSODrawOnSurfaceUndoCommandAction().