Hot Keys
Keystrokes that can be managed by others. These are lower-level than window keyboard handlers (i.e., callbacks you attach to your XPLMCreateWindow_t), but higher level than key sniffers.
XPLMHotKey_f
callback
Your hot key callback simply takes a pointer of your choosing.
typedef void (* XPLMHotKey_f)(
void * inRefcon
);
XPLMHotKeyID
typedef
An opaque ID used to identify a hot key.
typedef void * XPLMHotKeyID;
XPLMRegisterHotKey
function deprecated XPLM300
This routine registers a hot key. You specify your preferred key stroke virtual key/flag combination, a description of what your callback does (so other plug-ins can describe the plug-in to the user for remapping) and a callback function and opaque pointer to pass in). A new hot key ID is returned. During execution, the actual key associated with your hot key may change, but you are insulated from this.
XPLM_API XPLMHotKeyIDXPLMRegisterHotKey(
char inVirtualKey,
XPLMKeyFlags inFlags,
const char * inDescription,
XPLMHotKey_f inCallback,
void * inRefcon
);
XPLMUnregisterHotKey
function deprecated XPLM300
Unregisters a hot key. You can only unregister your own hot keys.
XPLM_API void XPLMUnregisterHotKey(
XPLMHotKeyID inHotKey
);
XPLMCountHotKeys
function
Returns the number of current hot keys.
XPLM_API int XPLMCountHotKeys(void);
XPLMGetNthHotKey
function
Returns a hot key by index, for iteration on all hot keys.
XPLM_API XPLMHotKeyIDXPLMGetNthHotKey(
int inIndex
);
XPLMGetHotKeyInfo
function
Returns information about the hot key. Return NULL for any parameter you don't want info about. The description should be at least 512 chars long.
XPLM_API void XPLMGetHotKeyInfo(
XPLMHotKeyID inHotKey,
char * outVirtualKey, /* Can be NULL */
XPLMKeyFlags * outFlags, /* Can be NULL */
char * outDescription, /* Can be NULL */
XPLMPluginID * outPlugin /* Can be NULL */
);
XPLMSetHotKeyCombination
function
Remaps a hot key's keystrokes. You may remap another plugin's keystrokes.
XPLM_API void XPLMSetHotKeyCombination(
XPLMHotKeyID inHotKey,
char inVirtualKey,
XPLMKeyFlags inFlags
);