00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KEYTRANS_H
00022 #define KEYTRANS_H
00023
00024 #include <tqstring.h>
00025 #include <tqptrlist.h>
00026 #include <tqiodevice.h>
00027
00028 #define BITS_NewLine 0
00029 #define BITS_BsHack 1
00030 #define BITS_Ansi 2
00031 #define BITS_AppCuKeys 3
00032 #define BITS_Control 4
00033 #define BITS_Shift 5
00034 #define BITS_Alt 6
00035 #define BITS_AppScreen 7
00036 #define BITS_COUNT 8
00037 #define BITS_AnyMod 9
00038
00039 #define CMD_none -1
00040 #define CMD_send 0
00041 #define CMD_scrollPageUp 2
00042 #define CMD_scrollPageDown 3
00043 #define CMD_scrollLineUp 4
00044 #define CMD_scrollLineDown 5
00045 #define CMD_scrollLock 6
00046
00047 #define BITS(x,v) ((((v)!=0)<<(x)))
00048
00049 class KeytabReader;
00050
00051 class KeyTrans
00052 {
00053 friend class KeytabReader;
00054 public:
00055 static KeyTrans* find(int numb);
00056 static KeyTrans* find(const TQString &id);
00057 static int count();
00058 static void loadAll();
00059
00060 KeyTrans(const TQString& p);
00061 ~KeyTrans();
00062 bool findEntry(int key, int bits, int* cmd, const char** txt, int* len,
00063 bool* metaspecified);
00064 const TQString& hdr() {if (!m_fileRead) readConfig(); return m_hdr;}
00065 int numb() {return m_numb;}
00066 const TQString& id() { return m_id;}
00067
00068 class KeyEntry
00069 {
00070 public:
00071 KeyEntry(int ref, int key, int bits, int mask, int cmd, TQString txt);
00072 ~KeyEntry();
00073 bool matches(int key, int bits, int mask);
00074 bool metaspecified(void);
00075 bool anymodspecified(void);
00076 TQString text();
00077 int ref;
00078 private:
00079 int key;
00080 int bits;
00081 int mask;
00082 public:
00083 int cmd;
00084 TQString txt;
00085 };
00086
00087 private:
00088 KeyEntry* addEntry(int ref, int key, int bits, int mask, int cmd, TQString txt);
00089 void addKeyTrans();
00090 void readConfig();
00091 TQPtrList<KeyEntry> tableX;
00092 TQString m_hdr;
00093 TQString m_path;
00094 TQString m_id;
00095 int m_numb;
00096 bool m_fileRead;
00097 KeyTrans();
00098 };
00099
00100 #endif