1 ///////////////////////////////////////////////////////// 2 // TkeyDef - Key Definitions class // 3 // - keeped in an array container // 4 ///////////////////////////////////////////////////////// 5 6 #pragma once 7 8 //#include <windows.h> 9 10 #ifndef __BORLANDC__ // Ioannou Dec. 8, 1998 11 // We need these for MSVC6 (Sam Robertson Oct. 8, 1998) 12 class TKeyDef; 13 bool operator==(const TKeyDef &t1, const TKeyDef &t2); 14 bool operator<(const TKeyDef &t1, const TKeyDef &t2); 15 //// 16 #endif 17 18 // Paul Brannan Feb. 5, 1999 19 enum tn_ops {TN_ESCAPE, TN_SCROLLBACK, TN_DIAL, TN_PASTE, TN_NULL, TN_CR, TN_CRLF}; 20 21 typedef struct { 22 char sendstr; 23 tn_ops the_op; 24 } optype; 25 26 union KeyDefType { 27 char *szKeyDef; 28 optype *op; 29 }; 30 31 union KeyDefType_const { 32 const char *szKeyDef; 33 const optype *op; 34 }; 35 36 class TKeyDef { 37 private: 38 KeyDefType uKeyDef; 39 DWORD vk_code; 40 DWORD dwState; 41 42 public: 43 TKeyDef(); 44 TKeyDef(char *def, DWORD state, DWORD code); 45 TKeyDef(optype op, DWORD state, DWORD code); 46 TKeyDef(const TKeyDef &t); 47 48 char *operator=(char *def); 49 DWORD operator=(DWORD code); 50 TKeyDef& operator=(const TKeyDef &t); 51 const optype& operator=(optype op); 52 53 ~TKeyDef(); 54 55 #ifdef __BORLANDC__ 56 int operator==(TKeyDef &t); 57 #else 58 // made these into friends for compatibility with stl 59 // (Paul Brannan 5/7/98) 60 friend bool operator==(const TKeyDef &t1, const TKeyDef &t2); 61 friend bool operator<(const TKeyDef &t1, const TKeyDef &t2); 62 #endif 63 64 const char *GetszKey() { return uKeyDef.szKeyDef; } 65 const KeyDefType GetKeyDef() { return uKeyDef; } 66 DWORD GetCodeKey() { return vk_code; } 67 68 }; 69