Maps an input state to the name of an event handler. MapFunction returns a pointer to the internal representation of the input state, which may be used to define sequences.
The value of code can either be a standard wxWindows key code, or one of the following special values that indicate mouse states:
To specify an N-time button click, you can use the constant WXK_CLICK_ADDER. Each addition of WXK_CLICK_ADDER specifies one more click. For example, a left quadruple-click is specified by WXK_MOUSE_LEFT + 3 * WXK_CLICK_ADDER.
If prevkey is non-NULL, then the input state is the continuation of a sequence. The value of type specifies whether the sequence continues further: wxKEY_FINAL indicates that this is the last input state in the sequence; wxKEY_PREFIX indicates that there will be more input states in the sequence (which will be connected to this one using the MapFunction's return value), and the value of fname is ignored.
If an attempt is made to use a particular key sequence both as a prefix
and as a complete sequence, an error is set to the handler installed
with wxKeymap::SetErrorCallback (section
).
If the last input state in a sequence is a keyboard state, then fname should be the name of a keyboard event handler; if the last
input state is a mouse state, fname should be the name of a
mouse event handler. Event handlers are mapped to their names using
wxKeymap::AddKeyFunction (section
) and
wxKeymap::AddMouseFunction (section
).
The function names do not have to be mapped to handlers before input states are mapped to the names; the handler is dispatched by name at the time of invocation. The event handler mapped to a name can be changed without affecting the map from input states to function names.
void MapFunction (char *keyname, char *fname)
Maps an input state sequence to a function name using a string-encoded sequence in keyname. The format of keyname is a sequence of semicolon-delimited input states; each state is made up of a sequence of modifier identifiers followed by a key identifier.
The modifier identifiers are ``s:'' (for Shift), ``c:'' (for Control), ``a:'' (for Alt), ``m:'' (for Meta; Unix only), and ``d:'' (for Command; Macintosh only). They can appear in any order within a key state.
A key identifier can be a character on the keyboard -- e.g., ``a'', ``2'', ``?'' -- or a special input name. The special names are:
For a special keyword, the capitalization does not matter. However, capitalization is important for single-letter keynames (e.g., ``A'' is interpreted as ``s:a'').
As an example, this string describes the keysequence escape-control-C: ``ecs;c:c''.
See also wxKeymap::ImpliesShift (section
).