Diffstat (limited to 'inputmethods/multikey/keyboard.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/multikey/keyboard.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h index b524195..e61b76c 100644 --- a/inputmethods/multikey/keyboard.h +++ b/inputmethods/multikey/keyboard.h | |||
@@ -1,148 +1,152 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qframe.h> | 20 | #include <qframe.h> |
21 | #include <qmap.h> | 21 | #include <qmap.h> |
22 | #include "../pickboard/pickboardcfg.h" | 22 | #include "../pickboard/pickboardcfg.h" |
23 | #include "../pickboard/pickboardpicks.h" | 23 | #include "../pickboard/pickboardpicks.h" |
24 | #include "configdlg.h" | ||
24 | 25 | ||
25 | class QTimer; | 26 | class QTimer; |
26 | 27 | ||
27 | class KeyboardConfig : public DictFilterConfig | 28 | class KeyboardConfig : public DictFilterConfig |
28 | { | 29 | { |
29 | public: | 30 | public: |
30 | KeyboardConfig(PickboardPicks* p) : DictFilterConfig(p), backspaces(0) { nrows = 1; } | 31 | KeyboardConfig(PickboardPicks* p) : DictFilterConfig(p), backspaces(0) { nrows = 1; } |
31 | virtual void generateText(const QString &s); | 32 | virtual void generateText(const QString &s); |
32 | void decBackspaces() { if (backspaces) backspaces--; } | 33 | void decBackspaces() { if (backspaces) backspaces--; } |
33 | void incBackspaces() { backspaces++; } | 34 | void incBackspaces() { backspaces++; } |
34 | void resetBackspaces() { backspaces = 0; } | 35 | void resetBackspaces() { backspaces = 0; } |
35 | private: | 36 | private: |
36 | int backspaces; | 37 | int backspaces; |
37 | }; | 38 | }; |
38 | 39 | ||
39 | 40 | ||
40 | class KeyboardPicks : public PickboardPicks | 41 | class KeyboardPicks : public PickboardPicks |
41 | { | 42 | { |
42 | Q_OBJECT | 43 | Q_OBJECT |
43 | public: | 44 | public: |
44 | KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0) | 45 | KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0) |
45 | : PickboardPicks(parent, name, f) { } | 46 | : PickboardPicks(parent, name, f) { } |
46 | void initialise(); | 47 | void initialise(); |
47 | virtual QSize sizeHint() const; | 48 | virtual QSize sizeHint() const; |
48 | KeyboardConfig *dc; | 49 | KeyboardConfig *dc; |
49 | }; | 50 | }; |
50 | 51 | ||
51 | 52 | ||
52 | class Keys { | 53 | class Keys { |
53 | public: | 54 | public: |
54 | 55 | ||
55 | Keys(); | 56 | Keys(); |
56 | Keys(const char * filename); | 57 | Keys(const char * filename); |
57 | ushort uni(const int row, const int col); | 58 | ushort uni(const int row, const int col); |
58 | int qcode(const int row, const int col); | 59 | int qcode(const int row, const int col); |
59 | int width(const int row, const int col); | 60 | int width(const int row, const int col); |
60 | bool pressed(const int row, const int col); | 61 | bool pressed(const int row, const int col); |
61 | bool *pressedPtr(const int row, const int col); | 62 | bool *pressedPtr(const int row, const int col); |
62 | ushort shift(const ushort); | 63 | ushort shift(const ushort); |
63 | QPixmap *pix(const int row, const int col); | 64 | QPixmap *pix(const int row, const int col); |
64 | int numKeys(const int row); | 65 | int numKeys(const int row); |
65 | void setKeysFromFile(const char *filename); | 66 | void setKeysFromFile(const char *filename); |
66 | void setKey(const int row, const int qcode, const ushort unicode, | 67 | void setKey(const int row, const int qcode, const ushort unicode, |
67 | const int width, QPixmap *pix); | 68 | const int width, QPixmap *pix); |
68 | void setPressed(const int row, const int col, const bool pressed); | 69 | void setPressed(const int row, const int col, const bool pressed); |
69 | 70 | ||
70 | private: | 71 | private: |
71 | 72 | ||
72 | typedef struct Key { | 73 | typedef struct Key { |
73 | int qcode; // are qt key codes just unicode values? | 74 | int qcode; // are qt key codes just unicode values? |
74 | ushort unicode; | 75 | ushort unicode; |
75 | int width; // not pixels but relative key width. normal key is 2 | 76 | int width; // not pixels but relative key width. normal key is 2 |
76 | 77 | ||
77 | // only needed for keys like ctrl that can have multiple keys pressed at once | 78 | // only needed for keys like ctrl that can have multiple keys pressed at once |
78 | bool *pressed; | 79 | bool *pressed; |
79 | QPixmap *pix; | 80 | QPixmap *pix; |
80 | }; | 81 | }; |
81 | 82 | ||
82 | QList<Key> keys[6]; | 83 | QList<Key> keys[6]; |
83 | QMap<ushort,ushort> shiftMap; | 84 | QMap<ushort,ushort> shiftMap; |
84 | 85 | ||
85 | }; | 86 | }; |
86 | 87 | ||
87 | class Keyboard : public QFrame | 88 | class Keyboard : public QFrame |
88 | { | 89 | { |
89 | Q_OBJECT | 90 | Q_OBJECT |
90 | public: | 91 | public: |
91 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 92 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
92 | 93 | ||
93 | void resetState(); | 94 | void resetState(); |
94 | 95 | ||
95 | void mousePressEvent(QMouseEvent*); | 96 | void mousePressEvent(QMouseEvent*); |
96 | void mouseReleaseEvent(QMouseEvent*); | 97 | void mouseReleaseEvent(QMouseEvent*); |
97 | void resizeEvent(QResizeEvent*); | 98 | void resizeEvent(QResizeEvent*); |
98 | void paintEvent(QPaintEvent* e); | 99 | void paintEvent(QPaintEvent* e); |
99 | //void timerEvent(QTimerEvent* e); | 100 | //void timerEvent(QTimerEvent* e); |
100 | void drawKeyboard( QPainter &p, int row = -1, int col = -1); | 101 | void drawKeyboard( QPainter &p, int row = -1, int col = -1); |
101 | 102 | ||
102 | QSize sizeHint() const; | 103 | QSize sizeHint() const; |
103 | 104 | ||
104 | signals: | 105 | signals: |
105 | void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool ); | 106 | void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool ); |
106 | 107 | ||
107 | private slots: | 108 | private slots: |
108 | void repeat(); | 109 | void repeat(); |
110 | void togglePickboard(bool on_off); | ||
109 | 111 | ||
110 | private: | 112 | private: |
111 | int getKey( int &w, int j = -1 ); | 113 | int getKey( int &w, int j = -1 ); |
112 | void clearHighlight(); | 114 | void clearHighlight(); |
113 | 115 | ||
114 | bool *shift; | 116 | bool *shift; |
115 | bool *lock; | 117 | bool *lock; |
116 | bool *ctrl; | 118 | bool *ctrl; |
117 | bool *alt; | 119 | bool *alt; |
118 | uint useLargeKeys:1; | 120 | uint useLargeKeys:1; |
119 | uint usePicks:1; | 121 | uint usePicks:1; |
120 | 122 | ||
121 | int pressedKeyRow; | 123 | int pressedKeyRow; |
122 | int pressedKeyCol; | 124 | int pressedKeyCol; |
123 | 125 | ||
124 | KeyboardPicks *picks; | 126 | KeyboardPicks *picks; |
125 | 127 | ||
126 | int keyHeight; | 128 | int keyHeight; |
127 | int defaultKeyWidth; | 129 | int defaultKeyWidth; |
128 | int xoffs; | 130 | int xoffs; |
129 | 131 | ||
130 | int unicode; | 132 | int unicode; |
131 | int qkeycode; | 133 | int qkeycode; |
132 | int modifiers; | 134 | int modifiers; |
133 | 135 | ||
134 | int pressTid; | 136 | int pressTid; |
135 | bool pressed; | 137 | bool pressed; |
136 | 138 | ||
137 | Keys keys; | 139 | Keys keys; |
138 | QString LANG; | 140 | QString LANG; |
139 | /* for korean input */ | 141 | /* for korean input */ |
140 | ushort schar, mchar, echar; | 142 | ushort schar, mchar, echar; |
141 | ushort parseKoreanInput(ushort c); | 143 | ushort parseKoreanInput(ushort c); |
142 | ushort combineKoreanChars(const ushort s, const ushort m, const ushort e); | 144 | ushort combineKoreanChars(const ushort s, const ushort m, const ushort e); |
143 | ushort constoe(const ushort c); | 145 | ushort constoe(const ushort c); |
144 | 146 | ||
145 | QTimer *repeatTimer; | 147 | QTimer *repeatTimer; |
148 | |||
149 | ConfigDlg *configdlg; | ||
146 | }; | 150 | }; |
147 | 151 | ||
148 | 152 | ||