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