summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatforminputcontext.cpp
diff options
context:
space:
mode:
authorGirish Ramakrishnan <girish.1.ramakrishnan@nokia.com>2012-06-25 18:27:22 -0700
committerQt by Nokia <qt-info@nokia.com>2012-07-03 08:11:54 +0200
commitf128c1f6d3cbdc1aa13f9ec65fd2354ef91c1c48 (patch)
treebb16289389a6805ea371e162543f96f9e3246104 /src/gui/kernel/qplatforminputcontext.cpp
parent28f30aa5437d8a53bc9124a1459243c475670601 (diff)
Remove _qpa from cpp filenames
36547f4eff44361f7a6acd0cff107c0e47561f93 removed the _qpa from .h files and promised to remove it from .cpp files at a later date. Change-Id: I24a5c3796f6b07dd9a1931b699f3212d315edb12 Reviewed-by: Andrew Stanley-Jones <andrew.stanley-jones@nokia.com>
Diffstat (limited to 'src/gui/kernel/qplatforminputcontext.cpp')
-rw-r--r--src/gui/kernel/qplatforminputcontext.cpp262
1 files changed, 262 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatforminputcontext.cpp b/src/gui/kernel/qplatforminputcontext.cpp
new file mode 100644
index 0000000000..0a8633b61d
--- /dev/null
+++ b/src/gui/kernel/qplatforminputcontext.cpp
@@ -0,0 +1,262 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qplatforminputcontext.h"
+#include <qguiapplication.h>
+#include <QRect>
+#include "private/qkeymapper_p.h"
+#include <qpa/qplatforminputcontext_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QPlatformInputContext
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+ \brief The QPlatformInputContext class abstracts the input method dependent data and composing state.
+
+ An input method is responsible for inputting complex text that cannot
+ be inputted via simple keymap. It converts a sequence of input
+ events (typically key events) into a text string through the input
+ method specific converting process. The class of the processes are
+ widely ranging from simple finite state machine to complex text
+ translator that pools a whole paragraph of a text with text
+ editing capability to perform grammar and semantic analysis.
+
+ To abstract such different input method specific intermediate
+ information, Qt offers the QPlatformInputContext as base class. The
+ concept is well known as 'input context' in the input method
+ domain. An input context is created for a text widget in response
+ to a demand. It is ensured that an input context is prepared for
+ an input method before input to a text widget.
+
+ QPlatformInputContext provides an interface the actual input methods
+ can derive from by reimplementing methods.
+
+ \sa QInputMethod
+*/
+
+/*!
+ \internal
+ */
+QPlatformInputContext::QPlatformInputContext()
+ : QObject(*(new QPlatformInputContextPrivate))
+{
+}
+
+/*!
+ \internal
+ */
+QPlatformInputContext::~QPlatformInputContext()
+{
+}
+
+/*!
+ Returns input context validity. Deriving implementations should return true.
+ */
+bool QPlatformInputContext::isValid() const
+{
+ return false;
+}
+
+/*!
+ Method to be called when input method needs to be reset. Called by QInputMethod::reset().
+ No further QInputMethodEvents should be sent as response.
+ */
+void QPlatformInputContext::reset()
+{
+}
+
+void QPlatformInputContext::commit()
+{
+}
+
+/*!
+ Notification on editor updates. Called by QInputMethod::update().
+ */
+void QPlatformInputContext::update(Qt::InputMethodQueries)
+{
+}
+
+/*!
+ Called when when the word currently being composed in input item is tapped by
+ the user. Input methods often use this information to offer more word
+ suggestions to the user.
+ */
+void QPlatformInputContext::invokeAction(QInputMethod::Action action, int cursorPosition)
+{
+ Q_UNUSED(cursorPosition)
+ // Default behavior for simple ephemeral input contexts. Some
+ // complex input contexts should not be reset here.
+ if (action == QInputMethod::Click)
+ reset();
+}
+
+/*!
+ This function can be reimplemented to filter input events.
+ Return true if the event has been consumed. Otherwise, the unfiltered event will
+ be forwarded to widgets as ordinary way. Although the input events have accept()
+ and ignore() methods, leave it untouched.
+*/
+bool QPlatformInputContext::filterEvent(const QEvent *event)
+{
+ Q_UNUSED(event)
+ return false;
+}
+
+/*!
+ This function can be reimplemented to return virtual keyboard rectangle in currently active
+ window coordinates. Default implementation returns invalid rectangle.
+ */
+QRectF QPlatformInputContext::keyboardRect() const
+{
+ return QRectF();
+}
+
+/*!
+ Active QPlatformInputContext is responsible for providing keyboardRectangle property to QInputMethod.
+ In addition of providing the value in keyboardRect function, it also needs to call this emit
+ function whenever the property changes.
+ */
+void QPlatformInputContext::emitKeyboardRectChanged()
+{
+ emit qApp->inputMethod()->keyboardRectangleChanged();
+}
+
+/*!
+ This function can be reimplemented to return true whenever input method is animating
+ shown or hidden. Default implementation returns false.
+ */
+bool QPlatformInputContext::isAnimating() const
+{
+ return false;
+}
+
+/*!
+ Active QPlatformInputContext is responsible for providing animating property to QInputMethod.
+ In addition of providing the value in isAnimation function, it also needs to call this emit
+ function whenever the property changes.
+ */
+void QPlatformInputContext::emitAnimatingChanged()
+{
+ emit qApp->inputMethod()->animatingChanged();
+}
+
+/*!
+ Request to show input panel.
+ */
+void QPlatformInputContext::showInputPanel()
+{
+}
+
+/*!
+ Request to hide input panel.
+ */
+void QPlatformInputContext::hideInputPanel()
+{
+}
+
+/*!
+ Returns input panel visibility status. Default implementation returns false.
+ */
+bool QPlatformInputContext::isInputPanelVisible() const
+{
+ return false;
+}
+
+/*!
+ Active QPlatformInputContext is responsible for providing visible property to QInputMethod.
+ In addition of providing the value in isInputPanelVisible function, it also needs to call this emit
+ function whenever the property changes.
+ */
+void QPlatformInputContext::emitInputPanelVisibleChanged()
+{
+ emit qApp->inputMethod()->visibleChanged();
+}
+
+QLocale QPlatformInputContext::locale() const
+{
+ return qt_keymapper_private()->keyboardInputLocale;
+}
+
+void QPlatformInputContext::emitLocaleChanged()
+{
+ emit qApp->inputMethod()->localeChanged();
+}
+
+Qt::LayoutDirection QPlatformInputContext::inputDirection() const
+{
+ return qt_keymapper_private()->keyboardInputDirection;
+}
+
+void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDirection)
+{
+ emit qApp->inputMethod()->inputDirectionChanged(newDirection);
+}
+
+/*!
+ This virtual method gets called to notify updated focus to \a object.
+ \warning Input methods must not call this function directly.
+ */
+void QPlatformInputContext::setFocusObject(QObject *object)
+{
+ Q_UNUSED(object)
+}
+
+/*!
+ Returns true if current focus object supports input method events.
+ */
+bool QPlatformInputContext::inputMethodAccepted() const
+{
+ return QPlatformInputContextPrivate::s_inputMethodAccepted;
+}
+
+bool QPlatformInputContextPrivate::s_inputMethodAccepted = false;
+
+void QPlatformInputContextPrivate::setInputMethodAccepted(bool accepted)
+{
+ QPlatformInputContextPrivate::s_inputMethodAccepted = accepted;
+}
+
+
+QT_END_NAMESPACE