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 status_t LoadCurrent(); 28 status_t Load(entry_ref &ref); 29 status_t Save(entry_ref &ref); 30 status_t LoadSource(FILE *f); 31 status_t LoadSourceFromRef(entry_ref &ref); 32 void SaveAsCurrent(); 33 void SaveAsHeader(entry_ref &ref); 34 status_t Use(); 35 void Dump(); 36 bool IsModifierKey(uint32 keyCode); 37 uint8 IsDeadKey(uint32 keyCode, uint32 modifiers); 38 bool IsDeadSecondKey(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey); 39 void GetChars(uint32 keyCode, uint32 modifiers, uint8 activeDeadKey, char** chars, int32* numBytes); 40 void RestoreSystemDefault(); 41 static void GetKey( char *chars, int32 offset, char* string); 42 private: 43 void ComputeChars(const char *buffer, struct re_registers ®s, int i, int &offset); 44 void ComputeTables(const char *buffer, struct re_registers ®s, uint32 &table); 45 char *fChars; 46 key_map fKeys; 47 uint32 fCharsSize; 48 }; 49 50 51 #endif //KEYMAP_H 52