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

function_keyboard.h

Go to the documentation of this file.
00001 #ifndef OPIE_FUNCTION_KEYBOARD_H
00002 #define OPIE_FUNCTION_KEYBOARD_H
00003 
00004 #include <opie2/oresource.h>
00005 
00006 #include <qpe/config.h>
00007 #include <qpe/qpeapplication.h>
00008 #include <qframe.h>
00009 #include <qpainter.h>
00010 #include <qvbox.h>
00011 #include <qgroupbox.h>
00012 #include <qmap.h>
00013 #include <qspinbox.h>
00014 #include <qcombobox.h>
00015 #include "profiledialogwidget.h"
00016 
00017 
00018 struct FKey {
00019 
00020     FKey(): qcode(0), unicode(0) {};
00021     FKey(const QString &l, const QString &f, ushort q, ushort u):
00022             label(l), pixFile(f), qcode(q), unicode(u) {
00023 
00024         if (!f.isEmpty()) {
00025 
00026             pix = new QPixmap ( Opie::Core::OResource::loadPixmap("console/keys/" + f ) );
00027         }
00028     };
00029 
00030     QString label;
00031     QPixmap *pix;
00032     QString pixFile;
00033     ushort qcode;
00034     ushort unicode;
00035 };
00036 
00037 class FunctionKeyboard : public QFrame {
00038     Q_OBJECT
00039 
00040 public:
00041     FunctionKeyboard(QWidget *parent = 0);
00042     ~FunctionKeyboard();
00043 
00044     friend class FunctionKeyboardConfig;
00045 
00046     void changeRows(int);
00047     void changeCols(int);
00048 
00049     void load(const Profile &);
00050     void loadDefaults();
00051 
00052     void paintEvent(QPaintEvent *);
00053     void paintKey(uint, uint);
00054     void mousePressEvent(QMouseEvent*);
00055     void mouseReleaseEvent(QMouseEvent*);
00056     void resizeEvent(QResizeEvent*);
00057     QSize sizeHint() const;
00058 
00059 signals:
00060 
00061     void keyPressed(FKey, ushort, ushort, bool);
00062 
00063 
00064 private:
00065 
00066     // thie key for the map is the row/col
00067     QMap<QString, FKey> keys;
00068 
00069     uint numRows;
00070     int test;
00071     uint numCols;
00072     uint keyHeight;
00073     double keyWidth; // decimal point matters!
00074 
00075     int pressedRow, pressedCol;
00076 
00077     QObject *parent;
00078 
00079 };
00080 
00081 class FunctionKeyboardConfig : public ProfileDialogKeyWidget {
00082 
00083     Q_OBJECT
00084 
00085 public:
00086     FunctionKeyboardConfig(const QString& name, QWidget *wid, const char* name = 0l );
00087     ~FunctionKeyboardConfig();
00088 
00089     void load(const Profile&);
00090     void save(Profile&);
00091 
00092 private slots:
00093 
00094     void slotKeyPressed(FKey, ushort, ushort, bool);
00095     void slotChangeRows(int);
00096     void slotChangeCols(int);
00097     void slotChangeIcon(int);
00098     void slotChangeLabelText(const QString &);
00099     void slotChangeQCode(const QString &);
00100     void slotChangeUnicode(const QString &);
00101 
00102 private:
00103 
00104     QString selectedHandle;
00105     ushort selectedRow, selectedCol;
00106 
00107     FunctionKeyboard *kb;
00108     QSpinBox *m_rowBox, *m_colBox;
00109     QComboBox *m_labels, *m_qvalues, *m_uniValues;
00110 
00111 };
00112 
00113 #endif

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