~timo-jyrinki/ubuntu/trusty/maliit-framework/fix_qt52

« back to all changes in this revision

Viewing changes to maliit-plugins-quick/input-method/minputmethodquick.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) 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
 
#ifndef MEEGO_KEYBOARD_QUICK_H
16
 
#define MEEGO_KEYBOARD_QUICK_H
17
 
 
18
 
#include <maliit/plugins/abstractinputmethod.h>
19
 
#include <maliit/plugins/keyoverride.h>
20
 
 
21
 
#include <QRect>
22
 
#include <QPointer>
23
 
#include <QString>
24
 
#include <QEvent>
25
 
#include <QGraphicsView>
26
 
#include <QGraphicsScene>
27
 
 
28
 
class MInputMethodQuickPrivate;
29
 
class MInputMethodQuickLoader;
30
 
class MKeyOverrideQuick;
31
 
 
32
 
//! \brief MInputMethodQuick is used for QML-based input method plugins.
33
 
//!
34
 
//! It defines the interface between framework, applications and QML-based
35
 
//! input methods. Instead of allowing QML-based input methods to use the
36
 
//! MAbstractInputMethodHost interface directly, this class will forward the
37
 
//! necessary requests.
38
 
//! QML-based input methods on the other hand can use the properties of this
39
 
//! class to respond to requests from the framework.
40
 
class MInputMethodQuick
41
 
    : public MAbstractInputMethod
42
 
{
43
 
    Q_OBJECT
44
 
    Q_ENUMS(KeyEvent)
45
 
 
46
 
    //! Propagates screen width to QML components.
47
 
    Q_PROPERTY(int screenWidth READ screenWidth
48
 
                               NOTIFY screenWidthChanged)
49
 
 
50
 
    //! Propagates screen height to QML components.
51
 
    Q_PROPERTY(int screenHeight READ screenHeight
52
 
                                NOTIFY screenHeightChanged)
53
 
 
54
 
    //! Propagates application orientation to QML components.
55
 
    Q_PROPERTY(int appOrientation READ appOrientation
56
 
                                  NOTIFY appOrientationChanged)
57
 
 
58
 
    //! Propagates action key override to QML components.
59
 
    Q_PROPERTY(MKeyOverrideQuick *actionKeyOverride READ actionKeyOverride
60
 
                                                    NOTIFY actionKeyOverrideChanged)
61
 
 
62
 
    //! Property for whether input method is active
63
 
    Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
64
 
 
65
 
public:
66
 
    enum KeyEvent { KeyPress = QEvent::KeyPress,
67
 
                    KeyRelease = QEvent::KeyRelease };
68
 
 
69
 
    //! Constructor
70
 
    //! \param host serves as communication link to framework and application. Managed by framework.
71
 
    //! \param mainWindow should be used to install plugin's UI into it. Managed by framework.
72
 
    //! \param qmlFileName the QML file that will be loaded.
73
 
    explicit MInputMethodQuick(MAbstractInputMethodHost *host,
74
 
                               const QString &qmlFileName);
75
 
    virtual ~MInputMethodQuick();
76
 
 
77
 
    //! \reimp
78
 
    virtual void show();
79
 
    virtual void hide();
80
 
    virtual void handleVisualizationPriorityChange(bool priority);
81
 
    virtual void handleClientChange();
82
 
    virtual void handleAppOrientationChanged(int angle);
83
 
    virtual void setState(const QSet<Maliit::HandlerState> &state);
84
 
 
85
 
    virtual void setKeyOverrides(const QMap<QString, QSharedPointer<MKeyOverride> > &overrides);
86
 
    virtual void handleFocusChange(bool focusIn);
87
 
    QList<MAbstractInputMethod::MInputMethodSubView> subViews(Maliit::HandlerState state) const;
88
 
    //! \reimp_end
89
 
 
90
 
    //! Propagates screen size to QML components.
91
 
    void propagateScreenSize();
92
 
 
93
 
    //! Returns screen height.
94
 
    int screenHeight() const;
95
 
 
96
 
    //! Returns screen width.
97
 
    int screenWidth() const;
98
 
 
99
 
    //! Returns application orientation.
100
 
    int appOrientation() const;
101
 
 
102
 
    //! Returns input method area.
103
 
    QRectF inputMethodArea() const;
104
 
 
105
 
    //! Sets input method area. Called by QML components.
106
 
    //! area the area consumed by the QML input method. On transitions can reserve target area at start.
107
 
    Q_INVOKABLE void setInputMethodArea(const QRectF &area);
108
 
 
109
 
    //! Sets area input method is actually using from the screen.
110
 
    Q_INVOKABLE void setScreenRegion(const QRect &region);
111
 
 
112
 
    //! Returns action key override.
113
 
    MKeyOverrideQuick *actionKeyOverride() const;
114
 
 
115
 
    //! Activates action key, that is - sends enter keypress.
116
 
    Q_INVOKABLE void activateActionKey();
117
 
 
118
 
    //! Return true on input method expected to be shown
119
 
    bool isActive() const;
120
 
    //! Sets input method expected to be shown/hidden
121
 
    void setActive(bool enable);
122
 
 
123
 
Q_SIGNALS:
124
 
    //! Emitted when screen height changes.
125
 
    void screenHeightChanged(int height);
126
 
 
127
 
    //! Emitted when screen width changes.
128
 
    void screenWidthChanged(int width);
129
 
 
130
 
    //! Emitted when application orientation changes.
131
 
    void appOrientationChanged(int angle);
132
 
 
133
 
    //! Emitted when input method area changes.
134
 
    void inputMethodAreaChanged(const QRect &area);
135
 
 
136
 
    //! Emitted when key action override changes.
137
 
    void actionKeyOverrideChanged(MKeyOverride *override);
138
 
 
139
 
    void activeChanged();
140
 
 
141
 
public Q_SLOTS:
142
 
    //! Sends preedit string. Called by QML components.
143
 
    //! \param text the preedit string.
144
 
    void sendPreedit(const QString &text);
145
 
 
146
 
    //! Sends an arbitrary key, optionally with modifiers.
147
 
    //! \param key the Qt keycode to be sent, e.g., Qt.Key_Up.
148
 
    //! \param modifiers optional modifiers to send along, like Qt.ControlModifier.
149
 
    //! \param text an optional text to send along with the QKeyEvent.
150
 
    void sendKey(int key, int modifiers = 0, const QString &text = QString());
151
 
 
152
 
    //! Sends commit string. Called by QML components.
153
 
    //! \param text the commit string.
154
 
    void sendCommit(const QString &text);
155
 
 
156
 
    //! Tells the framework to switch plugins. Called by QML components.
157
 
    void pluginSwitchRequired(int switchDirection);
158
 
 
159
 
    //! Tells the framework to close keyboard. Called by QML components.
160
 
    void userHide();
161
 
 
162
 
private:
163
 
    Q_DISABLE_COPY(MInputMethodQuick)
164
 
    Q_DECLARE_PRIVATE(MInputMethodQuick)
165
 
 
166
 
    MInputMethodQuickPrivate *const d_ptr;
167
 
 
168
 
private Q_SLOTS:
169
 
    //! Propagates change to QML.
170
 
    void onSentActionKeyAttributesChanged(const QString &keyId, const MKeyOverride::KeyOverrideAttributes changedAttributes);
171
 
};
172
 
 
173
 
#endif // MEEGO_KEYBOARD_QUICK_H