summaryrefslogtreecommitdiff
path: root/core/launcher/inputmethods.h
Unidiff
Diffstat (limited to 'core/launcher/inputmethods.h') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/inputmethods.h50
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,10 +1,10 @@
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**
@@ -18,59 +18,93 @@
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
30class QToolButton; 30class QToolButton;
31class QLibrary; 31class QWidgetStack;
32 32
33struct InputMethod 33struct 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
42class InputMethods : public QWidget 61class InputMethods : public QWidget
43{ 62{
44 Q_OBJECT 63 Q_OBJECT
45public: 64public:
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
57signals: 77signals:
58 void inputToggled( bool on ); 78 void inputToggled( bool on );
59 79
60private slots: 80private 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
66private: 88private:
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
97private:
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