summaryrefslogtreecommitdiff
path: root/inputmethods/pickboard/pickboardcfg.h
Unidiff
Diffstat (limited to 'inputmethods/pickboard/pickboardcfg.h') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/pickboard/pickboardcfg.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/inputmethods/pickboard/pickboardcfg.h b/inputmethods/pickboard/pickboardcfg.h
index b1913df..92c6420 100644
--- a/inputmethods/pickboard/pickboardcfg.h
+++ b/inputmethods/pickboard/pickboardcfg.h
@@ -1,16 +1,16 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the 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
@@ -67,25 +67,26 @@ public:
67 QString word() const; 67 QString word() const;
68 bool exec(); 68 bool exec();
69 69
70private slots: 70private slots:
71 void checkAllDone(); 71 void checkAllDone();
72 72
73private: 73private:
74 QPushButton *yes; 74 QPushButton *yes;
75 LetterChoice **lc; 75 LetterChoice **lc;
76 int nlc; 76 int nlc;
77}; 77};
78 78
79class PickboardConfig : QObject { 79class PickboardConfig : public QObject {
80 Q_OBJECT
80public: 81public:
81 PickboardConfig(PickboardPicks* p) : parent(p), nrows(2), pressx(-1) { } 82 PickboardConfig(PickboardPicks* p) : parent(p), nrows(2), pressx(-1) { }
82 virtual ~PickboardConfig(); 83 virtual ~PickboardConfig();
83 virtual void pickPoint(const QPoint& p, bool press); 84 virtual void pickPoint(const QPoint& p, bool press);
84 virtual void draw(QPainter*)=0; 85 virtual void draw(QPainter*)=0;
85 virtual void fillMenu(QPopupMenu&); 86 virtual void fillMenu(QPopupMenu&);
86 virtual void doMenu(int); 87 virtual void doMenu(int);
87 88
88protected: 89protected:
89 void updateRows(int from, int to); 90 void updateRows(int from, int to);
90 virtual void updateItem(int r, int i); 91 virtual void updateItem(int r, int i);
91 virtual void pickInRow(int r, int xpos, bool press)=0; 92 virtual void pickInRow(int r, int xpos, bool press)=0;
@@ -95,114 +96,118 @@ protected:
95 void generateKey( int k ); 96 void generateKey( int k );
96 97
97 virtual void pick(bool press, int row, int item)=0; 98 virtual void pick(bool press, int row, int item)=0;
98 99
99protected: 100protected:
100 PickboardPicks* parent; 101 PickboardPicks* parent;
101 int nrows; 102 int nrows;
102private: 103private:
103 int pressrow, pressx; 104 int pressrow, pressx;
104}; 105};
105 106
106class StringConfig : public PickboardConfig { 107class StringConfig : public PickboardConfig {
108 Q_OBJECT
107public: 109public:
108 StringConfig(PickboardPicks* p) : PickboardConfig(p) { } 110 StringConfig(PickboardPicks* p) : PickboardConfig(p) { }
109 111
110 void draw(QPainter* p); 112 void draw(QPainter* p);
111 113
112protected: 114protected:
113 virtual QString text(int r, int i)=0; 115 virtual QString text(int r, int i)=0;
114 virtual bool spreadRow(int i)=0; 116 virtual bool spreadRow(int i)=0;
115 virtual QColor rowColor(int) { return ::Qt::black; } 117 virtual QColor rowColor(int) { return Qt::black; }
116 virtual void pickInRow(int r, int xpos, bool press); 118 virtual void pickInRow(int r, int xpos, bool press);
117 virtual void updateItem(int r, int i); 119 virtual void updateItem(int r, int i);
118 virtual bool highlight(int,int) const; 120 virtual bool highlight(int,int) const;
119}; 121};
120 122
121class CharStringConfig : public StringConfig { 123class CharStringConfig : public StringConfig {
124 Q_OBJECT
122 QString input; 125 QString input;
123 QStringList chars; 126 QStringList chars;
124public: 127public:
125 CharStringConfig(PickboardPicks* p) : StringConfig(p) { } 128 CharStringConfig(PickboardPicks* p) : StringConfig(p) { }
126 129
127 void addChar(const QString& s); 130 void addChar(const QString& s);
128 virtual void doMenu(int); 131 virtual void doMenu(int);
129 132
130protected: 133protected:
131 QString text(int r, int i); 134 QString text(int r, int i);
132 bool spreadRow(int i); 135 bool spreadRow(int i);
133 void pick(bool press, int row, int item); 136 void pick(bool press, int row, int item);
134}; 137};
135 138
136class DictFilterConfig : public StringConfig { 139class DictFilterConfig : public StringConfig {
140 Q_OBJECT
137 QStringList matches; 141 QStringList matches;
142 QStringList sets_a;
138 QStringList sets; 143 QStringList sets;
139 QStringList othermodes; 144 QStringList othermodes;
140 int lit0; 145 int lit0;
141 int lit1; 146 int lit1;
142 int shift; 147 int shift;
143 QString capitalize(const QString& s); 148 QString capitalize(const QString& s);
144 QStringList capitalize(const QStringList& s); 149 QStringList capitalize(const QStringList& s);
145 150
146public: 151public:
147 QStringList input; 152 QStringList input;
148 DictFilterConfig(PickboardPicks* p) : StringConfig(p) 153 DictFilterConfig(PickboardPicks* p) : StringConfig(p)
149 { 154 {
150 shift = 0; 155 shift = 0;
151 lit0 = -1; 156 lit0 = -1;
152 lit1 = -1; 157 lit1 = -1;
153 } 158 }
154 159
155 void addSet(const QString& s); 160 void addSet(const QString& apperance, const QString& set);
156 void addMode(const QString& s); 161 void addMode(const QString& s);
157 162
158 void fillMenu(QPopupMenu& menu); 163 void fillMenu(QPopupMenu& menu);
159 void doMenu(int i); 164 void doMenu(int i);
160 165
161 void add(const QString& set); 166 void add(const QString& set);
162 167
163protected: 168protected:
164 QString text(int r, int i); 169 QString text(int r, int i);
165 170
166 bool spreadRow(int i); 171 bool spreadRow(int i);
167 172
168 void pick(bool press, int row, int item); 173 void pick(bool press, int row, int item);
169 174
170 bool scanMatch(const QString& set, const QChar& l) const; 175 bool scanMatch(const QString& set, const QChar& l) const;
171 void scan(const QDawg::Node* n, int ipos, const QString& str, int length, bool extend); 176 void scan(const QDawg::Node* n, int ipos, const QString& str, int length, bool extend);
172 void scanLengths(const QDawg::Node* n, int ipos, int& bitarray); 177 void scanLengths(const QDawg::Node* n, int ipos, int& bitarray);
173 178
174 bool highlight(int r,int c) const; 179 bool highlight(int r,int c) const;
175}; 180};
176 181
177class CharConfig : public StringConfig { 182class CharConfig : public StringConfig {
183 Q_OBJECT
178 QStringList chars1; 184 QStringList chars1;
179 QStringList chars2; 185 QStringList chars2;
180public: 186public:
181 CharConfig(PickboardPicks* p) : StringConfig(p) { } 187 CharConfig(PickboardPicks* p) : StringConfig(p) { }
182 void addChar(int r, const QString& s); 188 void addChar(int r, const QString& s);
183 189
184protected: 190protected:
185 QString text(int r, int i); 191 QString text(int r, int i);
186 bool spreadRow(int); 192 bool spreadRow(int);
187 void pick(bool press, int row, int item); 193 void pick(bool press, int row, int item);
188}; 194};
189 195
190class KeycodeConfig : public PickboardConfig { 196class KeycodeConfig : public PickboardConfig {
191 QValueList<int> keys1; 197 QValueList<int> keys1;
192 QValueList<int> keys2; 198 QValueList<int> keys2;
193 QValueList<QPixmap> keypm1; 199 QValueList<QPixmap> keypm1;
194 QValueList<QPixmap> keypm2; 200 QValueList<QPixmap> keypm2;
195 static const int xw = 8; 201 enum { xw = 8, xmarg = 8 };
196 static const int xmarg = 8;
197 202
198public: 203public:
199 KeycodeConfig(PickboardPicks* p) : PickboardConfig(p) { } 204 KeycodeConfig(PickboardPicks* p) : PickboardConfig(p) { }
200 void addKey(int r, const QPixmap& pm, int code); 205 void addKey(int r, const QPixmap& pm, int code);
201 void addGap(int r, int w); 206 void addGap(int r, int w);
202 207
203 void draw(QPainter* p); 208 void draw(QPainter* p);
204 209
205protected: 210protected:
206 void pickInRow(int r, int xpos, bool press); 211 void pickInRow(int r, int xpos, bool press);
207 QValueList<QPixmap> row(int i); 212 QValueList<QPixmap> row(int i);
208 213