Editor API
UnigineEditor public API
UnigineEditor::Shortcut Class Reference

This class is used to manage shortcuts (hotkeys). The shortcut can be set up to contain all the key presses necessary to describe a keyboard and mouse input combination, including the states of modifier keys such as Shift, Ctrl, Alt, Cmd as well as mouse buttons. More...

Inherits APIInterface.

Public Types

enum  MODIFIER_MATCH_TYPE { MODIFIER_MATCH_TYPE_EXACT = 0, MODIFIER_MATCH_TYPE_PARTIAL }
 Modifier match type to be used to activate a shortcut (hotkey combination). More...
 
enum  MOUSE_WHEEL {
  MOUSE_WHEEL_NONE = 0, MOUSE_WHEEL_UP, MOUSE_WHEEL_DOWN, MOUSE_WHEEL_RIGHT,
  MOUSE_WHEEL_LEFT
}
 Mouse wheel actions. More...
 
enum  MODIFIER_MASK {
  MODIFIER_MASK_SHIFT = 1 << 0, MODIFIER_MASK_CTRL = 1 << 1, MODIFIER_MASK_ALT = 1 << 2, MODIFIER_MASK_CMD = 1 << 3,
  MODIFIER_MASK_MOUSE_LEFT = 1 << 4, MODIFIER_MASK_MOUSE_RIGHT = 1 << 5, MODIFIER_MASK_MOUSE_MIDDLE = 1 << 6, MODIFIER_MASK_MOUSE_AUX_0 = 1 << 7,
  MODIFIER_MASK_MOUSE_AUX_1 = 1 << 8, MODIFIER_MASK_MOUSE_AUX_2 = 1 << 9, MODIFIER_MASK_MOUSE_AUX_3 = 1 << 10
}
 Modifier mask used to identify a set of modifiers. More...
 
enum  MOUSE_MASK {
  MOUSE_MASK_LEFT = 1 << 0, MOUSE_MASK_MIDDLE = 1 << 1, MOUSE_MASK_RIGHT = 1 << 2, MOUSE_MASK_DCLICK = 1 << 3,
  MOUSE_MASK_AUX_0 = 1 << 4, MOUSE_MASK_AUX_1 = 1 << 5, MOUSE_MASK_AUX_2 = 1 << 6, MOUSE_MASK_AUX_3 = 1 << 7
}
 Mouse mask used to identify mouse buttons currently pressed. More...
 

Public Member Functions

const char * getID () const
 Returns the ID of the shortcut, that is used to refer to it (e.g., from the ShortcutManager). More...
 
void setEnabled (bool enabled)
 Sets the value indicating if the shortcut is enabled (taken into account in the framework of input processing). You can set this value to 'false' to temporarily ignore a specific shortcut without disabling the whole context (ShortcutContext::setEnabled). More...
 
bool isEnabled () const
 Returns the value indicating if the shortcut is enabled (taken into account in the framework of input processing). You can set this value to 'false' to temporarily ignore a specific shortcut without disabling the whole context (ShortcutContext::setEnabled). More...
 
void setTitle (const char *title)
 Sets the title to be displayed for the shortcut in UnigineEditor. More...
 
const char * getTitle () const
 Returns the title to be displayed for the shortcut in UnigineEditor. More...
 
void setTooltip (const char *tooltip)
 Sets the tooltip to be displayed for the shortcut in UnigineEditor. More...
 
const char * getTooltip () const
 Returns the tooltip to be displayed for the shortcut in UnigineEditor. More...
 
void setKey (Unigine::Input::KEY key)
 Sets the key for the shortcut. More...
 
Unigine::Input::KEY getKey () const
 Returns the key for the shortcut. More...
 
void setMouseButtonMask (int mask)
 Sets the mask that defines mouse inputs combination for the shortcut. More...
 
int getMouseButtonMask () const
 Returns the mask that defines mouse inputs combination for the shortcut. More...
 
void setMouseWheel (Shortcut::MOUSE_WHEEL wheel)
 Sets the mask that defines the mouse wheel combination for the shortcut MOUSE_WHEEL. More...
 
Shortcut::MOUSE_WHEEL getMouseWheel () const
 Returns the mask that defines the mouse wheel combination for the shortcut MOUSE_WHEEL. More...
 
void setModifierMask (int mask)
 Sets the modifier mask that defines the set of modifiers to be used for the shortcut MODIFIER_MASK. More...
 
int getModifierMask () const
 Returns the modifier mask that defines the set of modifiers to be used for the shortcut MODIFIER_MASK. More...
 
void setModifierMatchType (Shortcut::MODIFIER_MATCH_TYPE type)
 Sets the modifier match type to be used for the shortcut (see MODIFIER_MATCH_TYPE). It defines whether the shortcut is tolerant to other keys, modifiers, and buttons (will be activated even if they are pressed in addition to the shortcut combination). For example, the 'Shift' modifier combined with arrow keys increases movement speed in UnigineEditor, but you can also press RMB to rotate the camera (because these shortcuts use the PARTIAL type). The default type is EXACT (to activate a shortcut nothing else should be pressed in addition to its combination). More...
 
Shortcut::MODIFIER_MATCH_TYPE getModifierMatchType () const
 Returns the modifier match type to be used for the shortcut (see MODIFIER_MATCH_TYPE). It defines whether the shortcut is tolerant to other keys, modifiers, and buttons (will be activated even if they are pressed in addition to the shortcut combination). For example, the 'Shift' modifier combined with arrow keys increases movement speed in UnigineEditor, but you can also press RMB to rotate the camera (because these shortcuts use the PARTIAL type). The default type is EXACT (to activate a shortcut nothing else should be pressed in addition to its combination). More...
 
void setTransparent (bool transparent)
 Sets the value indicating if the shortcut is 'transparent' for input events that have triggered it (passes them further through the Input system). The default value is 'false'. More...
 
bool isTransparent () const
 Returns the value indicating if the shortcut is 'transparent' for input events that have triggered it (passes them further through the Input system). The default value is 'false'. More...
 
void setVisible (bool visible)
 Sets the value indicating if the shortcut is to be displayed in UnigineEditor (Windows - Settings - Hotkeys). The default value is 'true'. More...
 
bool isVisible () const
 Returns the value indicating if the shortcut is to be displayed in UnigineEditor (Windows - Settings - Hotkeys). The default value is 'true'. More...
 
void setModeModifierEnabled (bool enabled)
 Sets the value indicating if the shortcut is to act like a modifier (e.g., can be used to define how to interpret the 'Ctrl' key). More...
 
bool isModeModifierEnabled () const
 Returns the value indicating if the shortcut is to act like a modifier (e.g., can be used to define how to interpret the 'Ctrl' key). More...
 
bool addFriend (const Unigine::Ptr< Shortcut > &friend_shortcut)
 Adds a shortcut with the specified ID as a friend for the shortcut. Friends can be activated together with the shortcut (in case of identical concurrent shortcuts the context priority decides - see ShortcutContext::setPriority). More...
 
bool removeFriend (const Unigine::Ptr< Shortcut > &friend_shortcut)
 Removes a shortcut with the specified ID from the list of friends. Friends can be activated together with the shortcut (in case of identical concurrent shortcuts the context priority decides - see ShortcutContext::setPriority). More...
 
Unigine::String toString () const
 Returns the shortcut combination as a text string (e.g., 'Ctrl + A'). More...
 
bool isPressed () const
 Returns a value indicating if the shortcut is currently pressed and held down. More...
 
bool isDown () const
 Returns a value indicating if the shortcut has been pressed. More...
 
bool isUp () const
 Returns a value indicating if the shortcut has been released. More...
 
Unigine::Event & getEventChanged ()
 Event triggered on changing the shortcut (e.g., setting a new combination in UnigineEditor). More...
 
Unigine::Event & getEventPressed ()
 Event triggered when the shortcut is pressed. More...
 
Unigine::Event & getEventDown ()
 Event triggered on pressing the shortcut combination. More...
 
Unigine::Event & getEventUp ()
 Event triggered on releasing the shortcut combination. More...
 

Detailed Description

This class is used to manage shortcuts (hotkeys). The shortcut can be set up to contain all the key presses necessary to describe a keyboard and mouse input combination, including the states of modifier keys such as Shift, Ctrl, Alt, Cmd as well as mouse buttons.

Member Enumeration Documentation

◆ MODIFIER_MASK

Modifier mask used to identify a set of modifiers.

Enumerator
MODIFIER_MASK_SHIFT 

Shift key.

MODIFIER_MASK_CTRL 

Ctrl key.

MODIFIER_MASK_ALT 

Alt key.

MODIFIER_MASK_CMD 

Command key.

MODIFIER_MASK_MOUSE_LEFT 

Left mouse button.

MODIFIER_MASK_MOUSE_RIGHT 

Right mouse button.

MODIFIER_MASK_MOUSE_MIDDLE 

Middle mouse button.

MODIFIER_MASK_MOUSE_AUX_0 

First extra mouse button.

MODIFIER_MASK_MOUSE_AUX_1 

Second extra mouse button.

MODIFIER_MASK_MOUSE_AUX_2 

Third extra mouse button.

MODIFIER_MASK_MOUSE_AUX_3 

Fourth extra mouse button.

◆ MODIFIER_MATCH_TYPE

Modifier match type to be used to activate a shortcut (hotkey combination).

Enumerator
MODIFIER_MATCH_TYPE_EXACT 

Exact match - a shortcut (hotkey combination) will be activated only if the specified key/button combination is pressed, while all other buttons and keys are not.

MODIFIER_MATCH_TYPE_PARTIAL 

Partial match - a shortcut (hotkey combination) will be activated if the specified key/button combination is pressed, other buttons and keys can be also pressed (e.g. the 'Shift' modifier combined with arrow keys increases movement speed in UnigineEditor, but you can also press RMB to rotate the camera).

◆ MOUSE_MASK

Mouse mask used to identify mouse buttons currently pressed.

Enumerator
MOUSE_MASK_LEFT 

Left mouse button.

MOUSE_MASK_MIDDLE 

Middle mouse button.

MOUSE_MASK_RIGHT 

Right mouse button.

MOUSE_MASK_DCLICK 

Mouse double-click.

MOUSE_MASK_AUX_0 

First auxiliary mouse mask (used for extra buttons).

MOUSE_MASK_AUX_1 

Second auxiliary mouse mask (used for extra buttons).

MOUSE_MASK_AUX_2 

Third auxiliary mouse mask (used for extra buttons).

MOUSE_MASK_AUX_3 

Fourth auxiliary mouse mask (used for extra buttons).

◆ MOUSE_WHEEL

Mouse wheel actions.

Enumerator
MOUSE_WHEEL_NONE 

No wheel action.

MOUSE_WHEEL_UP 

Mouse wheel upward scrolling (vertical).

MOUSE_WHEEL_DOWN 

Mouse wheel downward scrolling (vertical).

MOUSE_WHEEL_RIGHT 

Mouse wheel right scrolling (horizontal).

MOUSE_WHEEL_LEFT 

Mouse wheel left scrolling (horizontal).

Member Function Documentation

◆ addFriend()

bool UnigineEditor::Shortcut::addFriend ( const Unigine::Ptr< Shortcut > &  friend_shortcut)

Adds a shortcut with the specified ID as a friend for the shortcut. Friends can be activated together with the shortcut (in case of identical concurrent shortcuts the context priority decides - see ShortcutContext::setPriority).

Parameters
friend_shortcutID of the friend shortcut to be added as a friend.

◆ getEventChanged()

Unigine::Event& UnigineEditor::Shortcut::getEventChanged ( )

Event triggered on changing the shortcut (e.g., setting a new combination in UnigineEditor).

◆ getEventDown()

Unigine::Event& UnigineEditor::Shortcut::getEventDown ( )

Event triggered on pressing the shortcut combination.

◆ getEventPressed()

Unigine::Event& UnigineEditor::Shortcut::getEventPressed ( )

Event triggered when the shortcut is pressed.

◆ getEventUp()

Unigine::Event& UnigineEditor::Shortcut::getEventUp ( )

Event triggered on releasing the shortcut combination.

◆ getID()

const char* UnigineEditor::Shortcut::getID ( ) const

Returns the ID of the shortcut, that is used to refer to it (e.g., from the ShortcutManager).

◆ getKey()

Unigine::Input::KEY UnigineEditor::Shortcut::getKey ( ) const

Returns the key for the shortcut.

◆ getModifierMask()

int UnigineEditor::Shortcut::getModifierMask ( ) const

Returns the modifier mask that defines the set of modifiers to be used for the shortcut MODIFIER_MASK.

◆ getModifierMatchType()

Shortcut::MODIFIER_MATCH_TYPE UnigineEditor::Shortcut::getModifierMatchType ( ) const

Returns the modifier match type to be used for the shortcut (see MODIFIER_MATCH_TYPE). It defines whether the shortcut is tolerant to other keys, modifiers, and buttons (will be activated even if they are pressed in addition to the shortcut combination). For example, the 'Shift' modifier combined with arrow keys increases movement speed in UnigineEditor, but you can also press RMB to rotate the camera (because these shortcuts use the PARTIAL type). The default type is EXACT (to activate a shortcut nothing else should be pressed in addition to its combination).

◆ getMouseButtonMask()

int UnigineEditor::Shortcut::getMouseButtonMask ( ) const

Returns the mask that defines mouse inputs combination for the shortcut.

◆ getMouseWheel()

Shortcut::MOUSE_WHEEL UnigineEditor::Shortcut::getMouseWheel ( ) const

Returns the mask that defines the mouse wheel combination for the shortcut MOUSE_WHEEL.

◆ getTitle()

const char* UnigineEditor::Shortcut::getTitle ( ) const

Returns the title to be displayed for the shortcut in UnigineEditor.

◆ getTooltip()

const char* UnigineEditor::Shortcut::getTooltip ( ) const

Returns the tooltip to be displayed for the shortcut in UnigineEditor.

◆ isDown()

bool UnigineEditor::Shortcut::isDown ( ) const

Returns a value indicating if the shortcut has been pressed.

◆ isEnabled()

bool UnigineEditor::Shortcut::isEnabled ( ) const

Returns the value indicating if the shortcut is enabled (taken into account in the framework of input processing). You can set this value to 'false' to temporarily ignore a specific shortcut without disabling the whole context (ShortcutContext::setEnabled).

◆ isModeModifierEnabled()

bool UnigineEditor::Shortcut::isModeModifierEnabled ( ) const

Returns the value indicating if the shortcut is to act like a modifier (e.g., can be used to define how to interpret the 'Ctrl' key).

◆ isPressed()

bool UnigineEditor::Shortcut::isPressed ( ) const

Returns a value indicating if the shortcut is currently pressed and held down.

◆ isTransparent()

bool UnigineEditor::Shortcut::isTransparent ( ) const

Returns the value indicating if the shortcut is 'transparent' for input events that have triggered it (passes them further through the Input system). The default value is 'false'.

◆ isUp()

bool UnigineEditor::Shortcut::isUp ( ) const

Returns a value indicating if the shortcut has been released.

◆ isVisible()

bool UnigineEditor::Shortcut::isVisible ( ) const

Returns the value indicating if the shortcut is to be displayed in UnigineEditor (Windows - Settings - Hotkeys). The default value is 'true'.

◆ removeFriend()

bool UnigineEditor::Shortcut::removeFriend ( const Unigine::Ptr< Shortcut > &  friend_shortcut)

Removes a shortcut with the specified ID from the list of friends. Friends can be activated together with the shortcut (in case of identical concurrent shortcuts the context priority decides - see ShortcutContext::setPriority).

Parameters
friend_shortcutID of the friend shortcut to be removed.

◆ setEnabled()

void UnigineEditor::Shortcut::setEnabled ( bool  enabled)

Sets the value indicating if the shortcut is enabled (taken into account in the framework of input processing). You can set this value to 'false' to temporarily ignore a specific shortcut without disabling the whole context (ShortcutContext::setEnabled).

Parameters
enabledtrue to enable the shortcut; false - to make it ignored.

◆ setKey()

void UnigineEditor::Shortcut::setKey ( Unigine::Input::KEY  key)

Sets the key for the shortcut.

Parameters
keyKey to be set.

◆ setModeModifierEnabled()

void UnigineEditor::Shortcut::setModeModifierEnabled ( bool  enabled)

Sets the value indicating if the shortcut is to act like a modifier (e.g., can be used to define how to interpret the 'Ctrl' key).

Parameters
enabledtrue to make the shortcut act like a modifier; false - to make it act like a shortcut.

◆ setModifierMask()

void UnigineEditor::Shortcut::setModifierMask ( int  mask)

Sets the modifier mask that defines the set of modifiers to be used for the shortcut MODIFIER_MASK.

Parameters
maskMask to be set.

◆ setModifierMatchType()

void UnigineEditor::Shortcut::setModifierMatchType ( Shortcut::MODIFIER_MATCH_TYPE  type)

Sets the modifier match type to be used for the shortcut (see MODIFIER_MATCH_TYPE). It defines whether the shortcut is tolerant to other keys, modifiers, and buttons (will be activated even if they are pressed in addition to the shortcut combination). For example, the 'Shift' modifier combined with arrow keys increases movement speed in UnigineEditor, but you can also press RMB to rotate the camera (because these shortcuts use the PARTIAL type). The default type is EXACT (to activate a shortcut nothing else should be pressed in addition to its combination).

Parameters
typeMatch type to be set.

◆ setMouseButtonMask()

void UnigineEditor::Shortcut::setMouseButtonMask ( int  mask)

Sets the mask that defines mouse inputs combination for the shortcut.

Parameters
maskMouse mask to be set (see MOUSE_MASK).

◆ setMouseWheel()

void UnigineEditor::Shortcut::setMouseWheel ( Shortcut::MOUSE_WHEEL  wheel)

Sets the mask that defines the mouse wheel combination for the shortcut MOUSE_WHEEL.

Parameters
wheelMask to be set.

◆ setTitle()

void UnigineEditor::Shortcut::setTitle ( const char *  title)

Sets the title to be displayed for the shortcut in UnigineEditor.

Parameters
titleTitle text to be set.

◆ setTooltip()

void UnigineEditor::Shortcut::setTooltip ( const char *  tooltip)

Sets the tooltip to be displayed for the shortcut in UnigineEditor.

Parameters
tooltipTooltip text to be set.

◆ setTransparent()

void UnigineEditor::Shortcut::setTransparent ( bool  transparent)

Sets the value indicating if the shortcut is 'transparent' for input events that have triggered it (passes them further through the Input system). The default value is 'false'.

Parameters
transparenttrue to make the shortcut 'transparent' for input events (pass them further); false - to make the shortcut consume input events without passing them further.

◆ setVisible()

void UnigineEditor::Shortcut::setVisible ( bool  visible)

Sets the value indicating if the shortcut is to be displayed in UnigineEditor (Windows - Settings - Hotkeys). The default value is 'true'.

Parameters
visibletrue to make it displayed in UnigineEditor (Windows - Settings - Hotkeys); false - to make it hidden.

◆ toString()

Unigine::String UnigineEditor::Shortcut::toString ( ) const

Returns the shortcut combination as a text string (e.g., 'Ctrl + A').