author | hash <hash> | 2002-08-22 16:30:01 (UTC) |
---|---|---|
committer | hash <hash> | 2002-08-22 16:30:01 (UTC) |
commit | 4b0db964f77e4b3caa1f95ea753c89094b86e0d6 (patch) (unidiff) | |
tree | 1be74ef5d6bf3101815b5ecdafb21c0db470715e /inputmethods/multikey/keyboard.h | |
parent | 8503abdc93f6f3ce93cee0f1176faa919dbd04f5 (diff) | |
download | opie-4b0db964f77e4b3caa1f95ea753c89094b86e0d6.zip opie-4b0db964f77e4b3caa1f95ea753c89094b86e0d6.tar.gz opie-4b0db964f77e4b3caa1f95ea753c89094b86e0d6.tar.bz2 |
xpm images now are the same color as the text
Diffstat (limited to 'inputmethods/multikey/keyboard.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/multikey/keyboard.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h index b692975..1aa7a35 100644 --- a/inputmethods/multikey/keyboard.h +++ b/inputmethods/multikey/keyboard.h | |||
@@ -18,115 +18,115 @@ | |||
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 | #include "configdlg.h" |
25 | 25 | ||
26 | class QTimer; | 26 | class QTimer; |
27 | 27 | ||
28 | class KeyboardConfig : public DictFilterConfig | 28 | class KeyboardConfig : public DictFilterConfig |
29 | { | 29 | { |
30 | public: | 30 | public: |
31 | KeyboardConfig(PickboardPicks* p) : DictFilterConfig(p), backspaces(0) { nrows = 1; } | 31 | KeyboardConfig(PickboardPicks* p) : DictFilterConfig(p), backspaces(0) { nrows = 1; } |
32 | virtual void generateText(const QString &s); | 32 | virtual void generateText(const QString &s); |
33 | void decBackspaces() { if (backspaces) backspaces--; } | 33 | void decBackspaces() { if (backspaces) backspaces--; } |
34 | void incBackspaces() { backspaces++; } | 34 | void incBackspaces() { backspaces++; } |
35 | void resetBackspaces() { backspaces = 0; } | 35 | void resetBackspaces() { backspaces = 0; } |
36 | private: | 36 | private: |
37 | int backspaces; | 37 | int backspaces; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | 40 | ||
41 | class KeyboardPicks : public PickboardPicks | 41 | class KeyboardPicks : public PickboardPicks |
42 | { | 42 | { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | public: | 44 | public: |
45 | KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0) | 45 | KeyboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0) |
46 | : PickboardPicks(parent, name, f) { } | 46 | : PickboardPicks(parent, name, f) { } |
47 | void initialise(); | 47 | void initialise(); |
48 | virtual QSize sizeHint() const; | 48 | virtual QSize sizeHint() const; |
49 | KeyboardConfig *dc; | 49 | KeyboardConfig *dc; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | 52 | ||
53 | class Keys { | 53 | class Keys { |
54 | public: | 54 | public: |
55 | 55 | ||
56 | Keys(); | 56 | Keys(); |
57 | Keys(const char * filename); | 57 | Keys(const char * filename); |
58 | ~Keys(); | 58 | ~Keys(); |
59 | ushort uni(const int row, const int col); | 59 | ushort uni(const int row, const int col); |
60 | int qcode(const int row, const int col); | 60 | int qcode(const int row, const int col); |
61 | int width(const int row, const int col); | 61 | int width(const int row, const int col); |
62 | bool pressed(const int row, const int col); | 62 | bool pressed(const int row, const int col); |
63 | bool *pressedPtr(const int row, const int col); | 63 | bool *pressedPtr(const int row, const int col); |
64 | ushort shift(const ushort); | 64 | ushort shift(const ushort); |
65 | ushort meta(const ushort); | 65 | ushort meta(const ushort); |
66 | QPixmap *pix(const int row, const int col); | 66 | QImage *pix(const int row, const int col); |
67 | int numKeys(const int row); | 67 | int numKeys(const int row); |
68 | void setKeysFromFile(const char *filename); | 68 | void setKeysFromFile(const char *filename); |
69 | void setKey(const int row, const int qcode, const ushort unicode, | 69 | void setKey(const int row, const int qcode, const ushort unicode, |
70 | const int width, QPixmap *pix); | 70 | const int width, QImage *pix); |
71 | void setPressed(const int row, const int col, const bool pressed); | 71 | void setPressed(const int row, const int col, const bool pressed); |
72 | QString lang; | 72 | QString lang; |
73 | QString label; | 73 | QString label; |
74 | 74 | ||
75 | private: | 75 | private: |
76 | 76 | ||
77 | typedef struct Key { | 77 | typedef struct Key { |
78 | int qcode; // are qt key codes just unicode values? | 78 | int qcode; // are qt key codes just unicode values? |
79 | ushort unicode; | 79 | ushort unicode; |
80 | int width; // not pixels but relative key width. normal key is 2 | 80 | int width; // not pixels but relative key width. normal key is 2 |
81 | 81 | ||
82 | // only needed for keys like ctrl that can have multiple keys pressed at once | 82 | // only needed for keys like ctrl that can have multiple keys pressed at once |
83 | bool *pressed; | 83 | bool *pressed; |
84 | QPixmap *pix; | 84 | QImage *pix; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | QList<Key> keys[6]; | 87 | QList<Key> keys[6]; |
88 | QMap<ushort,ushort> shiftMap; | 88 | QMap<ushort,ushort> shiftMap; |
89 | QMap<ushort,ushort> metaMap; | 89 | QMap<ushort,ushort> metaMap; |
90 | 90 | ||
91 | }; | 91 | }; |
92 | 92 | ||
93 | class Keyboard : public QFrame | 93 | class Keyboard : public QFrame |
94 | { | 94 | { |
95 | Q_OBJECT | 95 | Q_OBJECT |
96 | public: | 96 | public: |
97 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 97 | Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
98 | ~Keyboard(); | 98 | ~Keyboard(); |
99 | 99 | ||
100 | void resetState(); | 100 | void resetState(); |
101 | 101 | ||
102 | void mousePressEvent(QMouseEvent*); | 102 | void mousePressEvent(QMouseEvent*); |
103 | void mouseReleaseEvent(QMouseEvent*); | 103 | void mouseReleaseEvent(QMouseEvent*); |
104 | void resizeEvent(QResizeEvent*); | 104 | void resizeEvent(QResizeEvent*); |
105 | void paintEvent(QPaintEvent* e); | 105 | void paintEvent(QPaintEvent* e); |
106 | //void timerEvent(QTimerEvent* e); | 106 | //void timerEvent(QTimerEvent* e); |
107 | void drawKeyboard( QPainter &p, int row = -1, int col = -1); | 107 | void drawKeyboard( QPainter &p, int row = -1, int col = -1); |
108 | 108 | ||
109 | QSize sizeHint() const; | 109 | QSize sizeHint() const; |
110 | 110 | ||
111 | signals: | 111 | signals: |
112 | void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool ); | 112 | void key( ushort scancode, ushort unicode, ushort modifiers, bool, bool ); |
113 | 113 | ||
114 | private slots: | 114 | private slots: |
115 | void repeat(); | 115 | void repeat(); |
116 | void togglePickboard(bool on_off); | 116 | void togglePickboard(bool on_off); |
117 | void toggleRepeat(bool on_off); | 117 | void toggleRepeat(bool on_off); |
118 | void setMapToDefault(); | 118 | void setMapToDefault(); |
119 | void setMapToFile(QString map); | 119 | void setMapToFile(QString map); |
120 | 120 | ||
121 | // used to redraw keyboard after edited colors | 121 | // used to redraw keyboard after edited colors |
122 | void reloadKeyboard(); | 122 | void reloadKeyboard(); |
123 | 123 | ||
124 | private: | 124 | private: |
125 | int getKey( int &w, int j = -1 ); | 125 | int getKey( int &w, int j = -1 ); |
126 | void clearHighlight(); | 126 | void clearHighlight(); |
127 | 127 | ||
128 | bool *shift; | 128 | bool *shift; |
129 | bool *lock; | 129 | bool *lock; |
130 | bool *ctrl; | 130 | bool *ctrl; |
131 | bool *alt; | 131 | bool *alt; |
132 | bool *meta; | 132 | bool *meta; |