~michael-sheldon/ubuntu/utopic/maliit-framework/fix-orientation-updates

« back to all changes in this revision

Viewing changes to maliit/inputmethod.h

  • Committer: Package Import Robot
  • Author(s): Ricardo Salveti de Araujo, Sergio Schvezov, Ricardo Salveti de Araujo
  • Date: 2013-07-23 19:47:04 UTC
  • mfrom: (1.1.2) (1.2.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130723194704-1lsy1kmlda069cea
Tags: 0.99.0+git20130615+97e8335-0ubuntu1
[ Sergio Schvezov ]
* New build from HEAD 97e8335.
* Packaging import from lp:phablet-extras/maliit-framework.

[ Ricardo Salveti de Araujo ]
* debian/control: adding vcs and fixing dependencies
* General package cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* * This file is part of Maliit framework *
2
 
 *
3
 
 * Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies).
4
 
 * All rights reserved.
5
 
 *
6
 
 * Contact: maliit-discuss@lists.maliit.org
7
 
 *
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
12
 
 * of this file.
13
 
 */
14
 
 
15
 
// Based on minputmethodstate.h from libmeegotouch
16
 
 
17
 
#ifndef MALIIT_INPUTMETHOD_H
18
 
#define MALIIT_INPUTMETHOD_H
19
 
 
20
 
#include <QObject>
21
 
#include <QRect>
22
 
#include <QScopedPointer>
23
 
#include <maliit/namespace.h>
24
 
 
25
 
class QKeyEvent;
26
 
 
27
 
namespace Maliit {
28
 
 
29
 
class InputMethodPrivate;
30
 
 
31
 
/*! \ingroup libmaliit
32
 
 * \brief Listen to device orientation, language and raw key events.
33
 
 */
34
 
class InputMethod : public QObject
35
 
{
36
 
    Q_OBJECT
37
 
 
38
 
public:
39
 
    //! \brief Get singleton instance
40
 
    //!
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();
45
 
 
46
 
    //! \brief Get the input method widget
47
 
    //!
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.
55
 
    //!
56
 
    //! If the input-context plugin in use is not "MaliitDirect", this method will return 0
57
 
    QWidget *widget() const;
58
 
 
59
 
    //! \brief Get current input method area
60
 
    //! \return current input method area
61
 
    QRect area() const;
62
 
 
63
 
    //! \brief Get the orientation of application's active window
64
 
    //! \return orientation of application's active window
65
 
    Maliit::OrientationAngle orientationAngle() const;
66
 
 
67
 
    //! \internal
68
 
    void emitKeyPress(const QKeyEvent &event);
69
 
    void emitKeyRelease(const QKeyEvent &event);
70
 
    void setLanguage(const QString &language);
71
 
    void setWidget(QWidget *widget);
72
 
    //! \internal_end
73
 
 
74
 
    //! \brief Current language of active input method
75
 
    const QString &language() const;
76
 
 
77
 
public Q_SLOTS:
78
 
    /*!
79
 
     * \brief Application's active window start to rotate to \a newOrientationAngle.
80
 
     *
81
 
     * \note This method should be called when active window start rotation animation.
82
 
     */
83
 
    void startOrientationAngleChange(Maliit::OrientationAngle newOrientationAngle);
84
 
 
85
 
    /*!
86
 
     * \brief Set the orientation angle of application's active window to \a newOrientationAngle
87
 
     *
88
 
     * \note This method should be called when active window already finished the rotation animation.
89
 
     */
90
 
    void setOrientationAngle(Maliit::OrientationAngle newOrientationAngle);
91
 
 
92
 
    //! \brief Set input method area to \a newRegion
93
 
    void setArea(const QRect &newRegion);
94
 
 
95
 
Q_SIGNALS:
96
 
    /*!
97
 
     * \brief Emitted when input method area is changed
98
 
     *
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).
103
 
     *
104
 
     * \param region new input method area
105
 
     */
106
 
    void areaChanged(const QRect &region);
107
 
 
108
 
    /*!
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.
111
 
     *
112
 
     * \note It is emitted at the start of the rotation animation.
113
 
     */
114
 
    void orientationAngleAboutToChange(Maliit::OrientationAngle orientationAngle);
115
 
 
116
 
    /*!
117
 
     * \brief This signal is emitted when the orientation angle of application's active window is changed
118
 
     * \param orientationAngle new orientation angle
119
 
     *
120
 
     * \note It's emitted with every orientation angle change finished.
121
 
     */
122
 
    void orientationAngleChanged(Maliit::OrientationAngle orientationAngle);
123
 
 
124
 
    //! Can be emitted by input method to notify about raw key press event it receives.
125
 
    void keyPress(const QKeyEvent &);
126
 
 
127
 
    //! Can be emitted by input method to notify about raw key release event it receives.
128
 
    void keyRelease(const QKeyEvent &);
129
 
 
130
 
    /*!
131
 
     * \brief Emitted on input method language change.
132
 
     * \sa language()
133
 
     */
134
 
    void languageChanged(const QString &language);
135
 
 
136
 
private:
137
 
    InputMethod();
138
 
    ~InputMethod();
139
 
    Q_DISABLE_COPY(InputMethod)
140
 
 
141
 
    const QScopedPointer<InputMethodPrivate> d_ptr;
142
 
 
143
 
    Q_DECLARE_PRIVATE(InputMethod)
144
 
};
145
 
 
146
 
/*!
147
 
 * \brief Sends a request to the application's input context to open a software
148
 
 * input panel (e.g. the virtual keyboard).
149
 
 *
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
153
 
 */
154
 
void requestInputMethodPanel();
155
 
 
156
 
/*!
157
 
 * \brief Sends a request to the application's input context to close a software
158
 
 * input panel.
159
 
 * \sa requestInputMethodPanel
160
 
 */
161
 
void closeInputMethodPanel();
162
 
 
163
 
} // namespace Maliit
164
 
 
165
 
#endif // MALIIT_INPUTMETHOD_H