00001 #ifndef _KEY_REPEATER_H_
00002 #define _KEY_REPEATER_H_
00003
00004 #include <qobject.h>
00005 #include <qtimer.h>
00006 #include <qvaluelist.h>
00007 #include <qwindowsystem_qws.h>
00008
00009 #include <syslog.h>
00010
00011 class KeyRepeater : public QObject
00012 {
00013 Q_OBJECT
00014 public:
00015 KeyRepeater();
00016 virtual ~KeyRepeater();
00017
00018 typedef enum {
00019 DISABLE=0,
00020 ENABLE=1,
00021 KILL=2,
00022 } RepeaterMode;
00023
00024 void start(int unicode, int keycode, int modifieres);
00025 void stop(int keycode = 0);
00026 void reset();
00027
00028 void setRepeatable(int keycode, bool enable);
00029 bool isRepeatable(int keycode);
00030
00031 void setMode(int mode){
00032 switch(mode){
00033 case DISABLE:
00034 m_mode = DISABLE;
00035 break;
00036 case ENABLE:
00037 m_mode = ENABLE;
00038 break;
00039 case KILL:
00040 m_mode = KILL;
00041 break;
00042 default:
00043 m_mode = ENABLE;
00044 break;
00045 }
00046 }
00047 RepeaterMode getMode(){
00048 return(m_mode);
00049 }
00050
00051 void setDelay(int msec)
00052 {
00053 m_repeatdelay = msec;
00054 }
00055 void setPeriod(int msec)
00056 {
00057 m_repeatperiod = msec;
00058 }
00059
00060 void statistics();
00061 private slots:
00062 void autoRepeat();
00063 private:
00064 int m_unicode;
00065 int m_keycode;
00066 int m_modifiers;
00067
00068 int m_repeatdelay;
00069 int m_repeatperiod;
00070
00071 QCString m_hookChannel;
00072
00073 RepeaterMode m_mode;
00074
00075 QValueList<int> m_disablekeys;
00076
00077 QTimer* m_pTimer;
00078
00079 void init();
00080 void clear();
00081 signals:
00082 void keyEvent(int unicode, int keycode, int modifiers,
00083 bool isPress, bool autoRepeat);
00084 };
00085
00086 #endif