|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (developer.feedback@nokia.com) |
|
6 ** |
|
7 ** This file is part of the HbCore module of the UI Extensions for Mobile. |
|
8 ** |
|
9 ** GNU Lesser General Public License Usage |
|
10 ** This file may be used under the terms of the GNU Lesser General Public |
|
11 ** License version 2.1 as published by the Free Software Foundation and |
|
12 ** appearing in the file LICENSE.LGPL included in the packaging of this file. |
|
13 ** Please review the following information to ensure the GNU Lesser General |
|
14 ** Public License version 2.1 requirements will be met: |
|
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
16 ** |
|
17 ** In addition, as a special exception, Nokia gives you certain additional |
|
18 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
20 ** |
|
21 ** If you have questions regarding the use of this file, please contact |
|
22 ** Nokia at developer.feedback@nokia.com. |
|
23 ** |
|
24 ****************************************************************************/ |
|
25 #ifndef HB_INPUT_METHOD_H |
|
26 #define HB_INPUT_METHOD_H |
|
27 |
|
28 #include <QString> |
|
29 #include <QInputContext> |
|
30 #include <QApplication> |
|
31 |
|
32 #include <hbinputmodeproperties.h> |
|
33 #include <hbinputmethoddescriptor.h> |
|
34 #include <hbinputstate.h> |
|
35 #include <hbinputfocusobject.h> |
|
36 #include <hbinputlanguage.h> |
|
37 |
|
38 class QAction; |
|
39 class HbInputMethodPrivate; |
|
40 class HbInputStateMachine; |
|
41 |
|
42 class HB_CORE_EXPORT HbInputMethod : public QInputContext |
|
43 { |
|
44 Q_OBJECT |
|
45 |
|
46 public: |
|
47 HbInputMethod(); |
|
48 virtual ~HbInputMethod(); |
|
49 |
|
50 static bool initializeFramework(QApplication& app); |
|
51 static void forceUnfocus(); |
|
52 static HbInputMethod* activeInputMethod(); |
|
53 static QList<HbInputMethodDescriptor> listCustomInputMethods(); |
|
54 |
|
55 virtual void focusReceived(); |
|
56 virtual void focusLost(bool focusSwitch = true); |
|
57 |
|
58 bool isActiveMethod() const; |
|
59 |
|
60 HbInputFocusObject* focusObject() const; |
|
61 void setFocusObject(HbInputFocusObject* focusObject); |
|
62 |
|
63 void lockFocus(); |
|
64 void unlockFocus(); |
|
65 |
|
66 // From QInputContext (do not override). |
|
67 void widgetDestroyed(QWidget* widget); |
|
68 void setFocusWidget(QWidget* widget); |
|
69 |
|
70 void focusObjectDestroyed(const HbInputFocusObject* focusObject); |
|
71 HbInputState inputState() const; |
|
72 |
|
73 bool activateState(const HbInputState& state); |
|
74 void updateState(); |
|
75 void editorRootState(HbInputState &result) const; |
|
76 bool automaticTextCaseNeeded() const; |
|
77 bool activateInputMethod(const HbInputMethodDescriptor &inputMethod); |
|
78 |
|
79 protected: |
|
80 virtual void inputStateActivated(const HbInputState& newState); |
|
81 virtual void inputLanguageChanged(const HbInputLanguage &newLanguage); |
|
82 virtual void secondaryInputLanguageChanged(const HbInputLanguage &aNewLanguage); |
|
83 virtual void predictiveInputStatusChanged(int newStatus); |
|
84 bool stateChangeInProgress() const; |
|
85 bool orientationContextSwitchInProgress(); |
|
86 |
|
87 void releaseFocus(); |
|
88 HbInputLanguage activeLanguage() const; |
|
89 |
|
90 bool modeAllowedInEditor(HbInputModeType mode) const; |
|
91 void inputStateToEditor(const HbInputState& source); |
|
92 |
|
93 void constructLatinState(HbInputState &result) const; |
|
94 |
|
95 public slots: |
|
96 void globalInputLanguageChanged(const HbInputLanguage &aNewLanguage); |
|
97 void globalSecondaryInputLanguageChanged(const HbInputLanguage &aNewLanguage); |
|
98 void activeHwKeyboardChanged(HbKeyboardType newKeyboard); |
|
99 void activeTouchKeyboardChanged(HbKeyboardType newKeyboard); |
|
100 void activeKeyboardChanged(HbKeyboardType newKeyboard); |
|
101 void predictiveInputStateChanged(int newState); |
|
102 void receiveText(const QString& string); |
|
103 virtual void candidatePopupClosed(int closingKey = 0); |
|
104 void orientationChanged(Qt::Orientation orientation); |
|
105 virtual void orientationAboutToChange(); |
|
106 void editorDeleted(QObject *obj); |
|
107 |
|
108 protected: |
|
109 HbInputMethodPrivate *const d_ptr; |
|
110 |
|
111 private: |
|
112 Q_DECLARE_PRIVATE_D(d_ptr, HbInputMethod) |
|
113 Q_DISABLE_COPY(HbInputMethod) |
|
114 |
|
115 friend class HbInputModeCachePrivate; |
|
116 }; |
|
117 |
|
118 #endif // HB_INPUT_METHOD_H |
|
119 |
|
120 // End of file |