Diffstat (limited to 'core/launcher/inputmethods.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/inputmethods.h | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/core/launcher/inputmethods.h b/core/launcher/inputmethods.h index 286a818..93b69de 100644 --- a/core/launcher/inputmethods.h +++ b/core/launcher/inputmethods.h | |||
@@ -1,12 +1,12 @@ | |||
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. |
@@ -16,61 +16,95 @@ | |||
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 | 20 | ||
21 | #ifndef __INPUT_METHODS_H__ | 21 | #ifndef __INPUT_METHODS_H__ |
22 | #define __INPUT_METHODS_H__ | 22 | #define __INPUT_METHODS_H__ |
23 | 23 | ||
24 | 24 | #include <qtopia/qlibrary.h> | |
25 | #include <qpe/inputmethodinterface.h> | 25 | #include <qtopia/inputmethodinterface.h> |
26 | 26 | ||
27 | #include <qwidget.h> | 27 | #include <qwidget.h> |
28 | #include <qvaluelist.h> | 28 | #include <qvaluelist.h> |
29 | 29 | ||
30 | class QToolButton; | 30 | class QToolButton; |
31 | class QLibrary; | 31 | class QWidgetStack; |
32 | 32 | ||
33 | struct InputMethod | 33 | struct InputMethod |
34 | { | 34 | { |
35 | #ifndef QT_NO_COMPONENT | 35 | #ifndef QT_NO_COMPONENT |
36 | QLibrary *library; | 36 | QLibrary *library; |
37 | #endif | 37 | #endif |
38 | QWidget *widget; | 38 | QWidget *widget; |
39 | InputMethodInterface *interface; | 39 | QString libName; |
40 | bool newIM; | ||
41 | union { | ||
42 | InputMethodInterface *interface; | ||
43 | ExtInputMethodInterface *extInterface; | ||
44 | }; | ||
45 | |||
46 | inline void releaseInterface() { | ||
47 | newIM ? (void)extInterface->release() : (void)interface->release(); | ||
48 | library->unload(); | ||
49 | delete library; library = 0l; | ||
50 | } | ||
51 | inline QString name() const { return newIM ? extInterface->name() : interface->name(); } | ||
52 | inline QPixmap *icon() const { return newIM ? extInterface->icon() : interface->icon(); } | ||
53 | inline QUnknownInterface *iface() { return newIM ? (QUnknownInterface *)extInterface : (QUnknownInterface *)interface; } | ||
54 | inline void resetState() { if ( !newIM ) interface->resetState(); } | ||
55 | |||
56 | int operator <(const InputMethod& o) const; | ||
57 | int operator >(const InputMethod& o) const; | ||
58 | int operator <=(const InputMethod& o) const; | ||
40 | }; | 59 | }; |
41 | 60 | ||
42 | class InputMethods : public QWidget | 61 | class InputMethods : public QWidget |
43 | { | 62 | { |
44 | Q_OBJECT | 63 | Q_OBJECT |
45 | public: | 64 | public: |
46 | InputMethods( QWidget * ); | 65 | InputMethods( QWidget * ); |
47 | ~InputMethods(); | 66 | ~InputMethods(); |
48 | 67 | ||
49 | QRect inputRect() const; | 68 | QRect inputRect() const; |
50 | bool shown() const; | 69 | bool shown() const; |
51 | QString currentShown() const; // name of interface | 70 | QString currentShown() const; // name of interface |
52 | void showInputMethod(const QString& id); | 71 | void showInputMethod(const QString& id); |
53 | void showInputMethod(); | 72 | void showInputMethod(); |
54 | void hideInputMethod(); | 73 | void hideInputMethod(); |
74 | void unloadInputMethods(); | ||
55 | void loadInputMethods(); | 75 | void loadInputMethods(); |
56 | 76 | ||
57 | signals: | 77 | signals: |
58 | void inputToggled( bool on ); | 78 | void inputToggled( bool on ); |
59 | 79 | ||
60 | private slots: | 80 | private slots: |
61 | void chooseKbd(); | 81 | void chooseKbd(); |
82 | void chooseIm(); | ||
62 | void showKbd( bool ); | 83 | void showKbd( bool ); |
63 | void resetStates(); | 84 | void resetStates(); |
64 | void sendKey( ushort unicode, ushort scancode, ushort modifiers, bool, bool ); | 85 | void sendKey( ushort unicode, ushort scancode, ushort modifiers, bool, bool ); |
86 | void qcopReceive( const QCString &msg, const QByteArray &data ); | ||
65 | 87 | ||
66 | private: | 88 | private: |
89 | void setPreferedHandlers(); | ||
90 | /*static */QStringList plugins()const; | ||
91 | /*static */void installTranslator( const QString& ); | ||
92 | void unloadMethod( QValueList<InputMethod>& ); | ||
67 | void chooseMethod(InputMethod* im); | 93 | void chooseMethod(InputMethod* im); |
94 | void chooseKeyboard(InputMethod* im); | ||
95 | void updateKeyboards(InputMethod *im); | ||
96 | |||
97 | private: | ||
68 | QToolButton *kbdButton; | 98 | QToolButton *kbdButton; |
69 | QToolButton *kbdChoice; | 99 | QToolButton *kbdChoice; |
70 | InputMethod *method; | 100 | QWidgetStack *imButton; // later will be widget stack |
101 | QToolButton *imChoice; | ||
102 | InputMethod *mkeyboard; | ||
103 | InputMethod *imethod; | ||
71 | QValueList<InputMethod> inputMethodList; | 104 | QValueList<InputMethod> inputMethodList; |
105 | QValueList<InputMethod> inputModifierList; | ||
72 | }; | 106 | }; |
73 | 107 | ||
74 | 108 | ||
75 | #endif // __INPUT_METHODS_H__ | 109 | #endif // __INPUT_METHODS_H__ |
76 | 110 | ||