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