emulkbd.h
Go to the documentation of this file.00001
00041 #if !defined(EMULKBD_H)
00042 #define EMULKBD_H
00043
00044 #if defined (_MSC_VER) && (_MSC_VER > 1000)
00045 #pragma once
00046 #endif // _MSC_VER > 1000
00047
00048 #include <QtGui/QFrame>
00049
00050
00051 class QGridLayout;
00052 class EmulKey;
00053
00054 class EmulKbd : public QFrame
00055 {
00056 Q_OBJECT
00057
00058
00059 protected:
00060 QGridLayout *layout;
00061 int frame_width;
00062 int active_row;
00063
00064
00065 public:
00066 EmulKbd(QWidget *parent = 0, Qt::WFlags f = 0);
00067 virtual ~EmulKbd();
00068
00069
00070 void addKey(const char *label, int keycode, int row, int col, int matrix_row = -1, int matrix_col = -1);
00071 void setRow(int row);
00072 int readCols(void);
00073
00074
00075 protected:
00076 void setKey(int row, int col, bool on);
00077
00078
00079 protected:
00080 virtual QSizePolicy sizePolicy() const;
00081 virtual void resizeEvent(QResizeEvent *e);
00082 virtual bool event(QEvent *e);
00083
00084
00085 friend class EmulKey;
00086 };
00087
00088
00089
00090
00091 #include <QtGui/qpushbutton.h>
00092 class EmulKey : public QPushButton
00093 {
00094 Q_OBJECT
00095
00096
00097 protected:
00098 int row, col;
00099 int keycode;
00100
00101
00102 public:
00103 EmulKey(EmulKbd *parent, const char *label, int keycode, int _row, int _col);
00104 virtual ~EmulKey();
00105
00106
00107 void setDown(bool enable);
00108
00109 protected slots:
00110 void keyPressed(void);
00111 void keyReleased(void);
00112
00113
00114 public:
00115 friend class EmulKbd;
00116 };
00117
00118 #endif // !defined(EMULKBD_H)
00119