1 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 2 // 3 // Copyright (c) 2004, Haiku 4 // 5 // This software is part of the Haiku distribution and is covered 6 // by the Haiku license. 7 // 8 // 9 // File: Keymap.h 10 // Author: Jérôme Duval 11 // Description: keymap bin 12 // Created : July 30, 2004 13 // 14 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 15 16 #ifndef KEYMAP_H 17 #define KEYMAP_H 18 19 #include <InterfaceDefs.h> 20 #include <Entry.h> 21 #include <stdio.h> 22 23 class Keymap 24 { 25 public: 26 Keymap(); 27 ~Keymap(); 28 status_t LoadCurrent(); 29 status_t Load(entry_ref &ref); 30 status_t Save(entry_ref &ref); 31 status_t LoadSource(FILE *f); 32 status_t LoadSourceFromRef(entry_ref &ref); 33 void SaveAsCurrent(); 34 void SaveAsHeader(entry_ref &ref); 35 status_t Use(); 36 void Dump(); 37 bool IsModifierKey(uint32 keyCode); 38 uint8 IsDeadKey(uint32 keyCode, uint32 modifiers); 39 bool IsDeadSecondKey(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey); 40 void GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** chars, int32* numBytes); 41 void RestoreSystemDefault(); 42 static void GetKey( char *chars, int32 offset, char* string); 43 private: 44 void ComputeChars(const char *buffer, struct re_registers ®s, int i, int &offset); 45 void ComputeTables(const char *buffer, struct re_registers ®s, uint32 &table); 46 char *fChars; 47 key_map fKeys; 48 uint32 fCharsSize; 49 }; 50 51 52 #endif //KEYMAP_H 53