1
/* * This file is part of Maliit framework *
3
* Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies).
6
* Contact: maliit-discuss@lists.maliit.org
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License version 2.1 as published by the Free Software Foundation
11
* and appearing in the file LICENSE.LGPL included in the packaging
15
// Based on minputmethodstate.h from libmeegotouch
17
#ifndef MALIIT_INPUTMETHOD_H
18
#define MALIIT_INPUTMETHOD_H
22
#include <QScopedPointer>
23
#include <maliit/namespace.h>
29
class InputMethodPrivate;
31
/*! \ingroup libmaliit
32
* \brief Listen to device orientation, language and raw key events.
34
class InputMethod : public QObject
39
//! \brief Get singleton instance
41
//! Example of using the singleton InputMethod instance:
42
//! \snippet plainqt/mainwindow.cpp Get singleton InputMethod instance
43
//! \return singleton instance
44
static InputMethod *instance();
46
//! \brief Get the input method widget
48
//! If the "MaliitDirect" input-context plugin is in use, the Maliit Server
49
//! will be hosted inside the application process, and the input method widget
50
//! be available here.
51
//! The application may then reparent the widget into its widget hierarchy to
52
//! make use of the input method. Handling of show and hide is still done by
53
//! Maliit, and the application should follow the areaChanged() signal to track
54
//! the size of the IM, just as in the server-hosted case.
56
//! If the input-context plugin in use is not "MaliitDirect", this method will return 0
57
QWidget *widget() const;
59
//! \brief Get current input method area
60
//! \return current input method area
63
//! \brief Get the orientation of application's active window
64
//! \return orientation of application's active window
65
Maliit::OrientationAngle orientationAngle() const;
68
void emitKeyPress(const QKeyEvent &event);
69
void emitKeyRelease(const QKeyEvent &event);
70
void setLanguage(const QString &language);
71
void setWidget(QWidget *widget);
74
//! \brief Current language of active input method
75
const QString &language() const;
79
* \brief Application's active window start to rotate to \a newOrientationAngle.
81
* \note This method should be called when active window start rotation animation.
83
void startOrientationAngleChange(Maliit::OrientationAngle newOrientationAngle);
86
* \brief Set the orientation angle of application's active window to \a newOrientationAngle
88
* \note This method should be called when active window already finished the rotation animation.
90
void setOrientationAngle(Maliit::OrientationAngle newOrientationAngle);
92
//! \brief Set input method area to \a newRegion
93
void setArea(const QRect &newRegion);
97
* \brief Emitted when input method area is changed
99
* \warning This signal is consumed by the input widget relocator inside
100
* libmeegotouch, and can be emitted at any time, so in order to avoid
101
* conflicts, an application that does any custom relayout must not use a
102
* queued connection (like Qt::QueuedConnection).
104
* \param region new input method area
106
void areaChanged(const QRect ®ion);
109
* \brief This signal is emitted before the orientation angle of the application's active window is changed.
110
* \param orientationAngle New orientation angle which is about to change.
112
* \note It is emitted at the start of the rotation animation.
114
void orientationAngleAboutToChange(Maliit::OrientationAngle orientationAngle);
117
* \brief This signal is emitted when the orientation angle of application's active window is changed
118
* \param orientationAngle new orientation angle
120
* \note It's emitted with every orientation angle change finished.
122
void orientationAngleChanged(Maliit::OrientationAngle orientationAngle);
124
//! Can be emitted by input method to notify about raw key press event it receives.
125
void keyPress(const QKeyEvent &);
127
//! Can be emitted by input method to notify about raw key release event it receives.
128
void keyRelease(const QKeyEvent &);
131
* \brief Emitted on input method language change.
134
void languageChanged(const QString &language);
139
Q_DISABLE_COPY(InputMethod)
141
const QScopedPointer<InputMethodPrivate> d_ptr;
143
Q_DECLARE_PRIVATE(InputMethod)
147
* \brief Sends a request to the application's input context to open a software
148
* input panel (e.g. the virtual keyboard).
150
* \warning In order to gain more screen space, window decorations may be
151
* temporarily hidden while the input panel is up.
152
* \sa closeInputMethodPanel
154
void requestInputMethodPanel();
157
* \brief Sends a request to the application's input context to close a software
159
* \sa requestInputMethodPanel
161
void closeInputMethodPanel();
163
} // namespace Maliit
165
#endif // MALIIT_INPUTMETHOD_H