1 /////////////////////////////////////////////////////////////////////////
2 // $Id: keymap.h,v 1.11 2008/02/05 22:57:41 sshwarts Exp $
3 /////////////////////////////////////////////////////////////////////////
5 // Copyright (C) 2002 MandrakeSoft S.A.
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Lesser General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Lesser General Public License for more details.
17 // You should have received a copy of the GNU Lesser General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 /////////////////////////////////////////////////////////////////////////
23 // Methods of bx_keymap_c :
25 // - loadKeymap(Bit32u convertStringToSymbol(const char*));
26 // loads the configuration specified keymap file if keymapping is enabled
27 // using convertStringToSymbol to convert strings to client constants
29 // - loadKeymap(Bit32u convertStringToSymbol(const char*), const char* filename);
30 // loads the specified keymap file
31 // using convertStringToSymbol to convert strings to client constants
33 // - isKeymapLoaded () returns true if the keymap contains any valid key
36 // - convertStringToBXKey
37 // convert a null-terminate string to a BX_KEY code
39 // - findHostKey(Bit32u key)
40 // - findAsciiChar(Bit8u ch)
41 // Each of these methods returns a pointer to a BXKeyEntry structure
42 // corresponding to a key. findHostKey() finds an entry whose hostKey
43 // value matches the target value, and findAsciiChar() finds an entry
44 // whose ASCII code matches the search value.
46 // In case of unknown symbol
47 #define BX_KEYMAP_UNKNOWN 0xFFFFFFFF
49 // Structure of an element of the keymap table
50 typedef struct BOCHSAPI
{
51 Bit32u baseKey
; // base key
52 Bit32u modKey
; // modifier key that must be held down
53 Bit32s ascii
; // ascii equivalent, if any
54 Bit32u hostKey
; // value that the host's OS or library recognizes
57 class BOCHSAPI bx_keymap_c
: public logfunctions
{
62 void loadKeymap(Bit32u(*)(const char*));
63 void loadKeymap(Bit32u(*)(const char*),const char *filename
);
64 bx_bool
isKeymapLoaded ();
66 BXKeyEntry
*findHostKey(Bit32u hostkeynum
);
67 BXKeyEntry
*findAsciiChar(Bit8u ascii
);
68 const char *getBXKeyName(Bit32u key
);
71 Bit32u
convertStringToBXKey(const char *);
73 BXKeyEntry
*keymapTable
;
77 BOCHSAPI
extern bx_keymap_c bx_keymap
;