Editor API
UnigineEditor public API
UnigineEditor::ShortcutContext Class Reference

This class is used to manage a shortcut context (add, remove shortcuts, define interaction with other contexts). More...

Inherits APIInterface.

Public Types

enum  TYPE { TYPE_SHARED = 0, TYPE_EXCLUSIVE }
 Context type, defines the way the shortcuts of this and other contexts are processed when this context is active. More...
 

Public Member Functions

Unigine::Ptr< ShortcutcreateShortcut (const char *shortcut_id)
 Creates a new shortcut with the given ID in the context and returns the created shortcut. More...
 
bool removeShortcut (const char *shortcut_id)
 Removes the shortcut with the given ID from the context. More...
 
bool hasShortcut (const char *shortcut_id)
 Returns a value indicating if a shortcut with the given ID exists in the context. More...
 
Unigine::Ptr< ShortcutgetShortcut (const char *shortcut_id)
 Returns the shortcut with the given ID. More...
 
void getShortcuts (Unigine::Vector< Unigine::Ptr< Shortcut >> &shortcuts)
 Collects all shortcuts of the context and puts them to the specified output vector. More...
 
void setEnabled (bool enabled)
 Sets the value indicating if the context is enabled and can become active. This parameter (unlike the setActive) can be changed from anywhere (not only by the context creator). For example, from a plugin to use the same shortcuts as the Editor by simply disabling the unwanted context (you can also disable unwanted shortcuts individually via Shortcut::setEnabled). More...
 
bool isEnabled () const
 Returns the value indicating if the context is enabled and can become active. This parameter (unlike the setActive) can be changed from anywhere (not only by the context creator). For example, from a plugin to use the same shortcuts as the Editor by simply disabling the unwanted context (you can also disable unwanted shortcuts individually via Shortcut::setEnabled). More...
 
void setActive (bool active)
 Sets the value indicating if the context is currently active (its shortcuts are taken into account in the framework of input processing). This parameter can only be changed by the context creator. More...
 
bool isActive () const
 Returns the value indicating if the context is currently active (its shortcuts are taken into account in the framework of input processing). This parameter can only be changed by the context creator. More...
 
const char * getID () const
 Returns the ID of the context. More...
 
const char * getTitle () const
 Returns the title of the context to be displayed in UnigineEditor. More...
 
ShortcutContext::TYPE getType () const
 Returns the type of the context, defining the way the shortcuts of this and other contexts are processed when this context is active. More...
 
int getPriority () const
 Returns the priority of the context. The priority defines which of the identical shortcuts of several active concurring contexts are to be processed (a context with a higher priority value takes precedence over others). More...
 

Detailed Description

This class is used to manage a shortcut context (add, remove shortcuts, define interaction with other contexts).

Member Enumeration Documentation

◆ TYPE

Context type, defines the way the shortcuts of this and other contexts are processed when this context is active.

Enumerator
TYPE_SHARED 

Shared context, when active this type of context does not block shortcuts from other contexts.

TYPE_EXCLUSIVE 

Exclusive context, when active this type of context grabs shortcuts processing blocking shortcuts of other contexts.

Member Function Documentation

◆ createShortcut()

Unigine::Ptr<Shortcut> UnigineEditor::ShortcutContext::createShortcut ( const char *  shortcut_id)

Creates a new shortcut with the given ID in the context and returns the created shortcut.

Parameters
shortcut_idID of the shortcut to be created.

◆ getID()

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

Returns the ID of the context.

◆ getPriority()

int UnigineEditor::ShortcutContext::getPriority ( ) const

Returns the priority of the context. The priority defines which of the identical shortcuts of several active concurring contexts are to be processed (a context with a higher priority value takes precedence over others).

◆ getShortcut()

Unigine::Ptr<Shortcut> UnigineEditor::ShortcutContext::getShortcut ( const char *  shortcut_id)

Returns the shortcut with the given ID.

Parameters
shortcut_idID of the shortcut to be retrieved.

◆ getShortcuts()

void UnigineEditor::ShortcutContext::getShortcuts ( Unigine::Vector< Unigine::Ptr< Shortcut >> &  shortcuts)

Collects all shortcuts of the context and puts them to the specified output vector.

Parameters
shortcutsOutput vector, to receive the list of shortcuts.

◆ getTitle()

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

Returns the title of the context to be displayed in UnigineEditor.

◆ getType()

ShortcutContext::TYPE UnigineEditor::ShortcutContext::getType ( ) const

Returns the type of the context, defining the way the shortcuts of this and other contexts are processed when this context is active.

◆ hasShortcut()

bool UnigineEditor::ShortcutContext::hasShortcut ( const char *  shortcut_id)

Returns a value indicating if a shortcut with the given ID exists in the context.

Parameters
shortcut_idID of the shortcut to be checked.

◆ isActive()

bool UnigineEditor::ShortcutContext::isActive ( ) const

Returns the value indicating if the context is currently active (its shortcuts are taken into account in the framework of input processing). This parameter can only be changed by the context creator.

◆ isEnabled()

bool UnigineEditor::ShortcutContext::isEnabled ( ) const

Returns the value indicating if the context is enabled and can become active. This parameter (unlike the setActive) can be changed from anywhere (not only by the context creator). For example, from a plugin to use the same shortcuts as the Editor by simply disabling the unwanted context (you can also disable unwanted shortcuts individually via Shortcut::setEnabled).

◆ removeShortcut()

bool UnigineEditor::ShortcutContext::removeShortcut ( const char *  shortcut_id)

Removes the shortcut with the given ID from the context.

Parameters
shortcut_idID of the shortcut to be removed.
Returns
true if the shortcut was removed successfully.

◆ setActive()

void UnigineEditor::ShortcutContext::setActive ( bool  active)

Sets the value indicating if the context is currently active (its shortcuts are taken into account in the framework of input processing). This parameter can only be changed by the context creator.

Parameters
activeValue indicating if the context is active.

◆ setEnabled()

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

Sets the value indicating if the context is enabled and can become active. This parameter (unlike the setActive) can be changed from anywhere (not only by the context creator). For example, from a plugin to use the same shortcuts as the Editor by simply disabling the unwanted context (you can also disable unwanted shortcuts individually via Shortcut::setEnabled).

Parameters
enabledValue indicating if the context is enabled.