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

keyboard.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 #include <qframe.h>
00021 #include <pickboardcfg.h>
00022 #include <pickboardpicks.h>
00023 
00024 class QTimer;
00025 
00026 namespace KeyboardInput
00027 {
00028 
00029 class KeyboardConfig : public DictFilterConfig
00030 {
00031 public:
00032     KeyboardConfig(PickboardPicks* p) : DictFilterConfig(p), backspaces(0) { nrows = 1; }
00033     virtual void generateText(const QString &s);
00034     void decBackspaces() { if (backspaces) backspaces--; }
00035     void incBackspaces() { backspaces++; }
00036     void resetBackspaces() { backspaces = 0; }
00037 private:
00038     int backspaces;
00039 };
00040 
00041 
00042 class KeyboardPicks : public PickboardPicks
00043 {
00044     Q_OBJECT
00045 public:
00046     KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0)
00047         : PickboardPicks(parent, name, f) { }
00048     void initialise();
00049     virtual QSize sizeHint() const;
00050     KeyboardConfig *dc;
00051 };
00052 
00053 class Keyboard : public QFrame
00054 {
00055     Q_OBJECT
00056 public:
00057     Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 );
00058 
00059     void resetState();
00060 
00061     void mousePressEvent(QMouseEvent*);
00062     void mouseReleaseEvent(QMouseEvent*);
00063     void resizeEvent(QResizeEvent*);
00064     void paintEvent(QPaintEvent* e);
00065     void timerEvent(QTimerEvent* e);
00066     void drawKeyboard( QPainter &p, int key = -1 );
00067 
00068     void setMode(int mode) { useOptiKeys = mode; }
00069 
00070     QSize sizeHint() const;
00071 
00072 signals:
00073     void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool );
00074 
00075 private slots:
00076     void repeat();
00077     
00078 private:
00079     int getKey( int &w, int j = -1 );
00080     void clearHighlight();
00081 
00082     uint shift:1;
00083     uint lock:1;
00084     uint ctrl:1;
00085     uint alt:1;
00086     uint useLargeKeys:1;
00087     uint useOptiKeys:1;
00088     
00089     int pressedKey;
00090 
00091     KeyboardPicks *picks;
00092 
00093     int keyHeight;
00094     int defaultKeyWidth;
00095     int xoffs;
00096 
00097     int unicode;
00098     int qkeycode;
00099     int modifiers;
00100 
00101     int pressTid;
00102     bool pressed;
00103 
00104     QTimer *repeatTimer;
00105 };
00106 
00107 } // namespace KeyboardInput
00108 

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