Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

keytrans.h

Go to the documentation of this file.
00001 /* -------------------------------------------------------------------------- */
00002 /*                                                                            */
00003 /* [keytrans.h]             X Terminal Emulation                              */
00004 /*                                                                            */
00005 /* -------------------------------------------------------------------------- */
00006 /*                                                                            */
00007 /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>            */
00008 /*                                                                            */
00009 /* This file is part of Konsole - an X terminal for KDE                       */
00010 /*                                                                            */
00011 /* -------------------------------------------------------------------------- */
00012 /*                                                                            */
00013 /* Ported Konsole to Qt/Embedded                                              */
00014 /*                                                                            */
00015 /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com>                  */
00016 /*                                                                            */
00017 /* -------------------------------------------------------------------------- */
00018 
00019 #ifndef KEYTRANS_H
00020 #define KEYTRANS_H
00021 
00022 #include <qstring.h>
00023 #include <qlist.h>
00024 #include <qiodevice.h>
00025 
00026 #define BITS_NewLine    0
00027 #define BITS_BsHack     1
00028 #define BITS_Ansi       2
00029 #define BITS_AppCuKeys  3
00030 #define BITS_Control    4
00031 #define BITS_Shift      5
00032 #define BITS_Alt        6
00033 #define BITS_COUNT      7
00034 
00035 #define CMD_send           0
00036 #define CMD_emitSelection  1
00037 #define CMD_scrollPageUp   2
00038 #define CMD_scrollPageDown 3
00039 #define CMD_scrollLineUp   4
00040 #define CMD_scrollLineDown 5
00041 #define CMD_prevSession    6
00042 #define CMD_nextSession    7
00043 
00044 #define BITS(x,v) ((((v)!=0)<<(x)))
00045 
00046 
00047 class KeyTrans
00048 {
00049 public:
00050   KeyTrans();
00051   ~KeyTrans();
00052   static KeyTrans* defaultKeyTrans();
00053   static KeyTrans* fromFile(const char* path);
00054   static KeyTrans* find(int numb);
00055   static KeyTrans* find(const char* path);
00056 public:
00057   static int count();
00058   static void loadAll();
00059 public:
00060   bool findEntry(int key, int bits, int* cmd, const char** txt, int* len);
00061 private:
00062   void addKeyTrans();
00063   static KeyTrans* fromDevice(QString path, QIODevice &buf);
00064 public:
00065   class KeyEntry
00066   {
00067   public:
00068     KeyEntry(int ref, int key, int bits, int mask, int cmd, QString txt);
00069     ~KeyEntry();
00070   public:
00071     bool matches(int key, int bits, int mask);
00072     QString text();
00073   public:
00074     int ref;
00075   private:
00076     int     key;
00077     int     bits;
00078     int     mask;
00079   public:
00080     int cmd;
00081     QString txt;
00082   };
00083 public:
00084   KeyEntry* addEntry(int ref, int key, int bits, int mask, int cmd, QString txt);
00085 private:
00086   QList<KeyEntry> table;
00087 public: //FIXME: we'd do better
00088   QString         hdr;
00089   int numb;
00090   QString path;
00091 };
00092 
00093 #endif

Generated on Sat Nov 5 16:15:26 2005 for OPIE by  doxygen 1.4.2