Make the QNX QPA plugin work with non blackberry.
[profile/ivi/qtbase.git] / src / plugins / platforms / qnx / qqnxintegration.h
1 /***************************************************************************
2 **
3 ** Copyright (C) 2011 - 2012 Research In Motion
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the plugins of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
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
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General 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 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef QQNXINTEGRATION_H
43 #define QQNXINTEGRATION_H
44
45 #include <QtGui/qplatformintegration_qpa.h>
46
47 #include <QtCore/qmutex.h>
48
49 #include <screen/screen.h>
50
51 QT_BEGIN_NAMESPACE
52
53 class QQnxEventThread;
54 class QQnxNativeInterface;
55 class QQnxWindow;
56 class QQnxScreen;
57 class QQnxScreenEventHandler;
58
59 #ifdef Q_OS_BLACKBERRY
60 class QQnxInputContext;
61 class QQnxNavigatorEventHandler;
62 class QQnxNavigatorEventNotifier;
63 class QQnxAbstractVirtualKeyboard;
64 class QQnxServices;
65 #endif
66
67 #ifndef QT_NO_CLIPBOARD
68 class QQnxClipboard;
69 #endif
70
71 template<class K, class V> class QHash;
72 typedef QHash<screen_window_t, QWindow *> QQnxWindowMapper;
73
74 class QQnxIntegration : public QPlatformIntegration
75 {
76 public:
77     QQnxIntegration();
78     ~QQnxIntegration();
79
80     bool hasCapability(QPlatformIntegration::Capability cap) const;
81
82     QPlatformWindow *createPlatformWindow(QWindow *window) const;
83     QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
84     QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
85
86 #ifdef Q_OS_BLACKBERRY
87     QPlatformInputContext *inputContext() const;
88 #endif
89
90     void moveToScreen(QWindow *window, int screen);
91
92     QAbstractEventDispatcher *guiThreadEventDispatcher() const;
93
94     QPlatformFontDatabase *fontDatabase() const { return m_fontDatabase; }
95
96     QPlatformNativeInterface *nativeInterface() const;
97
98 #ifndef QT_NO_CLIPBOARD
99     QPlatformClipboard *clipboard() const;
100 #endif
101
102     QVariant styleHint(StyleHint hint) const;
103
104     bool paintUsingOpenGL() const { return m_paintUsingOpenGL; }
105
106 #ifdef Q_OS_BLACKBERRY
107     QPlatformServices *services() const;
108 #endif
109
110     static QWindow *window(screen_window_t qnxWindow);
111
112 private:
113     void createDisplays();
114     void destroyDisplays();
115     QQnxScreen *primaryDisplay() const;
116
117     static void addWindow(screen_window_t qnxWindow, QWindow *window);
118     static void removeWindow(screen_window_t qnxWindow);
119
120     screen_context_t m_screenContext;
121     QQnxEventThread *m_eventThread;
122 #ifdef Q_OS_BLACKBERRY
123     QQnxNavigatorEventHandler *m_navigatorEventHandler;
124     QQnxNavigatorEventNotifier *m_navigatorEventNotifier;
125     QQnxAbstractVirtualKeyboard *m_virtualKeyboard;
126     QQnxInputContext *m_inputContext;
127     QQnxServices *m_services;
128 #endif
129     QPlatformFontDatabase *m_fontDatabase;
130     bool m_paintUsingOpenGL;
131     QAbstractEventDispatcher *m_eventDispatcher;
132     QQnxNativeInterface *m_nativeInterface;
133     QList<QQnxScreen*> m_screens;
134     QQnxScreenEventHandler *m_screenEventHandler;
135 #ifndef QT_NO_CLIPBOARD
136     mutable QQnxClipboard* m_clipboard;
137 #endif
138
139     static QQnxWindowMapper ms_windowMapper;
140     static QMutex ms_windowMapperMutex;
141
142     friend class QQnxWindow;
143 };
144
145 QT_END_NAMESPACE
146
147 #endif // QQNXINTEGRATION_H