![]() | InDesign SDK 20.5 |
#include <IShortcutManager.h>

Public Types | |
| enum | { kDefaultIID = IID_ISHORTCUTMANAGER } |
| enum | ShortcutFileError { kKBSCFileNoError = 0, kKBSCFileNotFound, kKBSCFileWrongPlatform, kKBSCFileFormatWrongOrCorrupt, kKBSCFileFormatIncompatible, kKBSCFileWriteError } |
Public Member Functions | |
| virtual void | AddShortcut (ActionID actionToAddTo, const PMString &contextStr, const VirtualKey &key, int16 mods)=0 |
| virtual void | RemoveAllShortcutsForAction (ActionID id)=0 |
| virtual void | RemoveShortcut (const PMString &context, const VirtualKey &key, int16 mods)=0 |
| virtual void | PerformShortcut (const IShortcutContext *context, const VirtualKey &key, int16 mods)=0 |
| virtual bool16 | IsEnabledShortcut (const IShortcutContext *context, const VirtualKey &key, int16 mods)=0 |
| virtual ActionID | GetActionIDOfShortcut (const PMString &contextString, const VirtualKey &key, int16 mods) const =0 |
| virtual ActionID | GetActionIDInContextChain (const IShortcutContext *context, const VirtualKey &key, int16 mods) const =0 |
| virtual void | ClearShortcuts ()=0 |
| virtual int32 | GetNumShortcutsForAction (ActionID actionID) const =0 |
| virtual void | GetNthShortcutForAction (ActionID actionID, int32 index, PMString *contextStrOut, VirtualKey *keyOut, int16 *modsOut) const =0 |
| virtual int32 | GetNumShortcutContexts () const =0 |
| virtual IShortcutContext * | QueryNthShortcutContext (int32 index) const =0 |
| virtual IShortcutContext * | QueryShortcutContextByName (const PMString &contextName) const =0 |
| virtual PMString | GetShortcutSetFilename () const =0 |
| virtual IKBSCSetsManager::KBSCArea | GetShortcutKBSCArea () const =0 |
| virtual ShortcutFileError | ChangeShortcutSetFile (const PMString &filename, IKBSCSetsManager::KBSCArea area)=0 |
| virtual ShortcutFileError | SaveCurrentShortcutSetFile ()=0 |
| virtual ShortcutFileError | LoadDefaultShortcutSetFile (const PMLocaleId &locale)=0 |
| virtual void | GetCurrentShortcut (PMString *contextOut, VirtualKey *keyOut, int16 *modsOut) const =0 |
| virtual const PMString & | GetPersistedActionName (const ActionID &actionID) const =0 |
| virtual bool16 | Startup (const PMLocaleId &locale)=0 |
| virtual void | Shutdown (const PMLocaleId &locale)=0 |
Public Member Functions inherited from IPMUnknown | |
| virtual IPMUnknown * | QueryInterface (PMIID interfaceID) const =0 |
| virtual void | AddRef () const =0 |
| virtual void | Release () const =0 |
This is the interface that manages the keyboard shortcuts for the application. It maintains a mapping of key combo(which is a key + 0 or more modifier keys) + shortcut context to ActionID. Whenever we get a key event that isn't handled by whatever eventhandler currently has the key focus, we check to see if it's a shortcut(by calling IsEnabledShortcut), and if it is, we execute the action by calling PerformShortcut. This interface also supports the functionality in the keyboard shortcut editor dialog, including adding & removing shortcuts, and reading and writing shortcut sets. In a Debug build, you can see some information about the shortcut matching that happens if you enable TRACE for the category "Shortcuts" from the test menu.
| pure virtual |
Add a shortcut
| actionToAddTo | The action that this new shortcut should invoke. |
| contextStr | The string for the context this shortcut should be assigned in. |
| key | The key for the new shortcut |
| mods | The modifier keys for the new shortcut. |
| pure virtual |
Update the current shortcuts to those in a file
| filename | The name of the new shortcut file to use |
| pure virtual |
Clear all shortcuts
| pure virtual |
Retrieve the action associated with a shortcut. This one looks in the context passed in, as well as all the 'next' contexts.
| context | The starting context. This method will also look in the rest of the context chain if the current context does not have an entry for this shortcut. Often retrieved from a call to IShortcutUtils::QueryCurrentContext() |
| key | The key for the shortcut |
| mods | The modifier keys for the shortcut. |
| pure virtual |
Retrieve the action associated with a shortcut in a single context
| contextStr | The string for the context to look for this shortcut. |
| key | The key for the shortcut |
| mods | The modifier keys for the shortcut. |
| pure virtual |
Retrieve information about the shortcut that has been invoked. Only valid during a call to PerformShortcut. Pass nil for things you don't care about. It's quite rare for client code to need this information.
| contextStrOut | filled out with the context string for the current shortcut. Pass nil if you don't need this info. |
| keyOut | filled out with the key for the current shortcut. Pass nil if you don't need this info. |
| modsOut | filled out with the modifier keys for the current shortcut. Pass nil if you don't need this info. |
| pure virtual |
Retrieve information about the nth shortcut associated with a particular action. Pass nil for things you don't care about.
| actionID | The action to get the shortcuts for. |
| index | Index of which shortcut for this action to return. |
| contextStrOut | filled out with the context string for the nth action. Pass nil if you don't need this info. |
| keyOut | filled out with the key for the nth action. Pass nil if you don't need this info. |
| modsOut | filled out with the modifier keys for the nth action. Pass nil if you don't need this info. |
| pure virtual |
Retrieve the number of shortcut contexts
| pure virtual |
Retrieve the number of shortcuts associated with a particular action
| actionID | the action to investigate |
| pure virtual |
Retrieve the action name that was persisted with shortcuts for a particular action id. Can be used to determine whether the shortcuts assigned to this action id are assigned to the wrong action by comparing with the name currently associated with the action (see IActionManager::GetActionName). This could happen if the id/name mapping for an action is dynamic and had been persisted in the preferences folder but then discarded. It's quite rare for client code to need this information.
| actionID | the action to get the name of |
| pure virtual |
Retrieve the area of the current shortcut set
| pure virtual |
Retrieve the filename of the current shortcut set
| pure virtual |
Check whether a shortcut is enabled
| context | The starting context. This method will also look in the rest of the context chain if the current context does not have an entry for this shortcut. |
| key | The key for the shortcut |
| mods | The modifier keys for the shortcut. |
| pure virtual |
Load the default shortcut set file. For English, this is Default.indk, but in general is the file corresponding to the translation of the "#defaultKBSCSetName" string.
| pure virtual |
Invoke the action associated with a shortcut. Should only be called if you know there is an enabled shortcut for this set of parameters.
| context | The starting context. This method will also look in the rest of the context chain if the current context does not have an entry for this shortcut. |
| key | The key for the shortcut |
| mods | The modifier keys for the shortcut. |
| pure virtual |
Query the nth shortcut context
| pure virtual |
Query a shortcut context by name
| contextName | the name of the shortcut context |
| pure virtual |
Remove all shortcuts associated with a particular action
| id | The action to remove shortcuts for |
| pure virtual |
Remove a shortcut
| contextStr | The string for the context this existing shortcut. |
| key | The key for the existing shortcut |
| mods | The modifier keys for the existing shortcut. |
| pure virtual |
Save the current shortcut set to the current shortcut file
| pure virtual |
Shut down the shortcut manager. Internal use only.
| pure virtual |
Start up the shortcut manager. Internal use only.