author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 01:19:32 +0300 | |
changeset 37 | 758a864f9613 |
parent 33 | 3e2da88830cd |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
0 | 8 |
** |
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QT_S60_P_H |
|
43 |
#define QT_S60_P_H |
|
44 |
||
45 |
// |
|
46 |
// W A R N I N G |
|
47 |
// ------------- |
|
48 |
// |
|
49 |
// This file is not part of the Qt API. It exists purely as an |
|
50 |
// implementation detail. This header file may change from version to |
|
51 |
// version without notice, or even be removed. |
|
52 |
// |
|
53 |
// We mean it. |
|
54 |
// |
|
55 |
||
56 |
#include "QtGui/qwindowdefs.h" |
|
57 |
#include "private/qcore_symbian_p.h" |
|
58 |
#include "qhash.h" |
|
59 |
#include "qpoint.h" |
|
60 |
#include "QtGui/qfont.h" |
|
61 |
#include "QtGui/qimage.h" |
|
62 |
#include "QtGui/qevent.h" |
|
63 |
#include "qpointer.h" |
|
64 |
#include "qapplication.h" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
65 |
#include "qelapsedtimer.h" |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
66 |
#include "QtCore/qthreadstorage.h" |
0 | 67 |
#include <w32std.h> |
68 |
#include <coecntrl.h> |
|
69 |
#include <eikenv.h> |
|
70 |
#include <eikappui.h> |
|
71 |
||
72 |
#ifdef Q_WS_S60 |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
73 |
#include <AknUtils.h> // AknLayoutUtils |
0 | 74 |
#include <avkon.hrh> // EEikStatusPaneUidTitle |
75 |
#include <akntitle.h> // CAknTitlePane |
|
76 |
#include <akncontext.h> // CAknContextPane |
|
77 |
#include <eikspane.h> // CEikStatusPane |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
78 |
#include <AknPopupFader.h> // MAknFadedComponent and TAknPopupFader |
0 | 79 |
#endif |
80 |
||
81 |
QT_BEGIN_NAMESPACE |
|
82 |
||
83 |
// Application internal HandleResourceChangeL events, |
|
84 |
// system events seems to start with 0x10 |
|
85 |
const TInt KInternalStatusPaneChange = 0x50000000; |
|
86 |
||
87 |
//this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2 |
|
88 |
#define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13) |
|
89 |
||
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
90 |
class Q_AUTOTEST_EXPORT QS60ThreadLocalData |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
91 |
{ |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
92 |
public: |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
93 |
QS60ThreadLocalData(); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
94 |
~QS60ThreadLocalData(); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
95 |
bool usingCONEinstances; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
96 |
RWsSession wsSession; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
97 |
CWsScreenDevice *screenDevice; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
98 |
}; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
99 |
|
0 | 100 |
class QS60Data |
101 |
{ |
|
102 |
public: |
|
103 |
QS60Data(); |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
104 |
QThreadStorage<QS60ThreadLocalData *> tls; |
0 | 105 |
TUid uid; |
106 |
int screenDepth; |
|
107 |
QPoint lastCursorPos; |
|
108 |
QPoint lastPointerEventPos; |
|
109 |
QPointer<QWidget> lastPointerEventTarget; |
|
110 |
QPointer<QWidget> mousePressTarget; |
|
111 |
int screenWidthInPixels; |
|
112 |
int screenHeightInPixels; |
|
113 |
int screenWidthInTwips; |
|
114 |
int screenHeightInTwips; |
|
115 |
int defaultDpiX; |
|
116 |
int defaultDpiY; |
|
117 |
WId curWin; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
118 |
enum PressedKeys { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
119 |
Select = 0x1, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
120 |
Right = 0x2, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
121 |
Down = 0x4, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
122 |
Left = 0x8, |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
123 |
Up = 0x10, |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
124 |
LeftUp = 0x20, |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
125 |
RightUp = 0x40, |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
126 |
RightDown = 0x80, |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
127 |
LeftDown = 0x100 |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
128 |
}; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
129 |
int virtualMousePressedKeys; // of the above type, but avoids casting problems |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
130 |
int virtualMouseAccelDX; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
131 |
int virtualMouseAccelDY; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
132 |
QElapsedTimer virtualMouseAccelTimeout; |
0 | 133 |
int virtualMouseMaxAccel; |
134 |
#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS |
|
135 |
int brokenPointerCursors : 1; |
|
136 |
#endif |
|
137 |
int hasTouchscreen : 1; |
|
138 |
int mouseInteractionEnabled : 1; |
|
139 |
int virtualMouseRequired : 1; |
|
140 |
int qtOwnsS60Environment : 1; |
|
141 |
int supportsPremultipliedAlpha : 1; |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
142 |
int avkonComponentsSupportTransparency : 1; |
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
143 |
int menuBeingConstructed : 1; |
0 | 144 |
QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type |
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
145 |
|
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
146 |
enum ScanCodeState { |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
147 |
Unpressed, |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
148 |
KeyDown, |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
149 |
KeyDownAndKey |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
150 |
}; |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
151 |
QHash<TInt, ScanCodeState> scanCodeStates; |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
152 |
|
0 | 153 |
static inline void updateScreenSize(); |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
154 |
inline RWsSession& wsSession(); |
0 | 155 |
static inline RWindowGroup& windowGroup(); |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
156 |
inline CWsScreenDevice* screenDevice(); |
0 | 157 |
static inline CCoeAppUi* appUi(); |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
158 |
static inline CEikMenuBar* menuBar(); |
0 | 159 |
#ifdef Q_WS_S60 |
160 |
static inline CEikStatusPane* statusPane(); |
|
161 |
static inline CCoeControl* statusPaneSubPane(TInt aPaneId); |
|
162 |
static inline CAknTitlePane* titlePane(); |
|
163 |
static inline CAknContextPane* contextPane(); |
|
164 |
static inline CEikButtonGroupContainer* buttonGroupContainer(); |
|
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
165 |
static void setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, bool buttonGroupVisible); |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
166 |
#endif |
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
167 |
static void controlVisibilityChanged(CCoeControl *control, bool visible); |
0 | 168 |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
169 |
#ifdef Q_OS_SYMBIAN |
0 | 170 |
TTrapHandler *s60InstalledTrapHandler; |
171 |
#endif |
|
172 |
}; |
|
173 |
||
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
174 |
Q_AUTOTEST_EXPORT QS60Data* qGlobalS60Data(); |
0 | 175 |
#define S60 qGlobalS60Data() |
176 |
||
177 |
class QAbstractLongTapObserver |
|
178 |
{ |
|
179 |
public: |
|
180 |
virtual void HandleLongTapEventL( const TPoint& aPenEventLocation, |
|
181 |
const TPoint& aPenEventScreenLocation ) = 0; |
|
182 |
}; |
|
183 |
class QLongTapTimer; |
|
184 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
185 |
|
0 | 186 |
class QSymbianControl : public CCoeControl, public QAbstractLongTapObserver |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
187 |
#ifdef Q_WS_S60 |
23
89e065397ea6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
188 |
, public MAknFadedComponent, public MEikStatusPaneObserver |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
189 |
#endif |
0 | 190 |
{ |
191 |
public: |
|
192 |
DECLARE_TYPE_ID(0x51740000) // Fun fact: the two first values are "Qt" in ASCII. |
|
193 |
||
194 |
public: |
|
195 |
QSymbianControl(QWidget *w); |
|
196 |
void ConstructL(bool isWindowOwning = false, bool desktop = false); |
|
197 |
~QSymbianControl(); |
|
198 |
void HandleResourceChange(int resourceType); |
|
199 |
void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
200 |
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
201 |
#if !defined(QT_NO_IM) && defined(Q_WS_S60) |
|
202 |
TCoeInputCapabilities InputCapabilities() const; |
|
203 |
#endif |
|
204 |
TTypeUid::Ptr MopSupplyObject(TTypeUid id); |
|
205 |
||
206 |
inline QWidget* widget() const { return qwidget; } |
|
207 |
void setWidget(QWidget *w); |
|
208 |
void sendInputEvent(QWidget *widget, QInputEvent *inputEvent); |
|
209 |
void setIgnoreFocusChanged(bool enabled) { m_ignoreFocusChanged = enabled; } |
|
210 |
void CancelLongTapTimer(); |
|
211 |
||
212 |
void setFocusSafely(bool focus); |
|
213 |
||
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
214 |
bool isControlActive(); |
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
215 |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
216 |
#ifdef Q_WS_S60 |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
217 |
void FadeBehindPopup(bool fade){ popupFader.FadeBehindPopup( this, this, fade); } |
23
89e065397ea6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
218 |
void HandleStatusPaneSizeChange(); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
219 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
220 |
protected: // from MAknFadedComponent |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
221 |
TInt CountFadedComponents() {return 1;} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
222 |
CCoeControl* FadedComponent(TInt /*aIndex*/) {return this;} |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
223 |
#else |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
224 |
// #warning No fallback implementation for QSymbianControl::FadeBehindPopup |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
225 |
void FadeBehindPopup(bool /*fade*/){ } |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
226 |
#endif |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
227 |
|
0 | 228 |
protected: |
229 |
void Draw(const TRect& aRect) const; |
|
230 |
void SizeChanged(); |
|
231 |
void PositionChanged(); |
|
232 |
void FocusChanged(TDrawNow aDrawNow); |
|
233 |
||
234 |
private: |
|
235 |
void HandlePointerEvent(const TPointerEvent& aPointerEvent); |
|
236 |
TKeyResponse OfferKeyEvent(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
237 |
TKeyResponse sendSymbianKeyEvent(const TKeyEvent &keyEvent, QEvent::Type type); |
0 | 238 |
TKeyResponse sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent); |
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
239 |
TKeyResponse handleVirtualMouse(const TKeyEvent& keyEvent,TEventCode type); |
0 | 240 |
bool sendMouseEvent(QWidget *widget, QMouseEvent *mEvent); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
241 |
void sendMouseEvent( |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
242 |
QWidget *receiver, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
243 |
QEvent::Type type, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
244 |
const QPoint &globalPos, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
245 |
Qt::MouseButton button, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
246 |
Qt::KeyboardModifiers modifiers); |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
247 |
void processTouchEvent(int pointerNumber, TPointerEvent::TType type, QPointF screenPos, qreal pressure); |
0 | 248 |
void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation ); |
249 |
#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER |
|
250 |
void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event); |
|
251 |
#endif |
|
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
252 |
|
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
253 |
public: |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
254 |
void handleClientAreaChange(); |
0 | 255 |
|
256 |
private: |
|
257 |
static QSymbianControl *lastFocusedControl; |
|
258 |
||
259 |
private: |
|
260 |
QWidget *qwidget; |
|
261 |
QLongTapTimer* m_longTapDetector; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
262 |
QElapsedTimer m_doubleClickTimer; |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
263 |
bool m_ignoreFocusChanged : 1; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
264 |
bool m_symbianPopupIsOpen : 1; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
265 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
266 |
#ifdef Q_WS_S60 |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
267 |
// Fader object used to fade everything except this menu and the CBA. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
268 |
TAknPopupFader popupFader; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
269 |
#endif |
0 | 270 |
}; |
271 |
||
272 |
inline QS60Data::QS60Data() |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
273 |
: uid(TUid::Null()), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
274 |
screenDepth(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
275 |
screenWidthInPixels(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
276 |
screenHeightInPixels(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
277 |
screenWidthInTwips(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
278 |
screenHeightInTwips(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
279 |
defaultDpiX(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
280 |
defaultDpiY(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
281 |
curWin(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
282 |
virtualMousePressedKeys(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
283 |
virtualMouseAccelDX(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
284 |
virtualMouseAccelDY(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
285 |
virtualMouseMaxAccel(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
286 |
#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
287 |
brokenPointerCursors(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
288 |
#endif |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
289 |
hasTouchscreen(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
290 |
mouseInteractionEnabled(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
291 |
virtualMouseRequired(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
292 |
qtOwnsS60Environment(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
293 |
supportsPremultipliedAlpha(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
294 |
avkonComponentsSupportTransparency(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
295 |
menuBeingConstructed(0), |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
296 |
s60ApplicationFactory(0) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
297 |
#ifdef Q_OS_SYMBIAN |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
298 |
,s60InstalledTrapHandler(0) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
299 |
#endif |
0 | 300 |
{ |
301 |
} |
|
302 |
||
303 |
inline void QS60Data::updateScreenSize() |
|
304 |
{ |
|
305 |
TPixelsTwipsAndRotation params; |
|
306 |
int mode = S60->screenDevice()->CurrentScreenMode(); |
|
307 |
S60->screenDevice()->GetScreenModeSizeAndRotation(mode, params); |
|
308 |
S60->screenWidthInPixels = params.iPixelSize.iWidth; |
|
309 |
S60->screenHeightInPixels = params.iPixelSize.iHeight; |
|
310 |
S60->screenWidthInTwips = params.iTwipsSize.iWidth; |
|
311 |
S60->screenHeightInTwips = params.iTwipsSize.iHeight; |
|
312 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
313 |
S60->virtualMouseMaxAccel = qMax(S60->screenHeightInPixels, S60->screenWidthInPixels) / 10; |
0 | 314 |
|
315 |
TReal inches = S60->screenHeightInTwips / (TReal)KTwipsPerInch; |
|
316 |
S60->defaultDpiY = S60->screenHeightInPixels / inches; |
|
317 |
inches = S60->screenWidthInTwips / (TReal)KTwipsPerInch; |
|
318 |
S60->defaultDpiX = S60->screenWidthInPixels / inches; |
|
319 |
} |
|
320 |
||
321 |
inline RWsSession& QS60Data::wsSession() |
|
322 |
{ |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
323 |
if(!tls.hasLocalData()) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
324 |
tls.setLocalData(new QS60ThreadLocalData); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
325 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
326 |
return tls.localData()->wsSession; |
0 | 327 |
} |
328 |
||
329 |
inline RWindowGroup& QS60Data::windowGroup() |
|
330 |
{ |
|
331 |
return CCoeEnv::Static()->RootWin(); |
|
332 |
} |
|
333 |
||
334 |
inline CWsScreenDevice* QS60Data::screenDevice() |
|
335 |
{ |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
336 |
if(!tls.hasLocalData()) { |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
337 |
tls.setLocalData(new QS60ThreadLocalData); |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
338 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
339 |
return tls.localData()->screenDevice; |
0 | 340 |
} |
341 |
||
342 |
inline CCoeAppUi* QS60Data::appUi() |
|
343 |
{ |
|
344 |
return CCoeEnv::Static()-> AppUi(); |
|
345 |
} |
|
346 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
347 |
inline CEikMenuBar* QS60Data::menuBar() |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
348 |
{ |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
349 |
return CEikonEnv::Static()->AppUiFactory()->MenuBar(); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
350 |
} |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
351 |
|
0 | 352 |
#ifdef Q_WS_S60 |
353 |
inline CEikStatusPane* QS60Data::statusPane() |
|
354 |
{ |
|
355 |
return CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
356 |
} |
|
357 |
||
358 |
// Returns the application's status pane control, if not present returns NULL. |
|
359 |
inline CCoeControl* QS60Data::statusPaneSubPane( TInt aPaneId ) |
|
360 |
{ |
|
361 |
const TUid paneUid = { aPaneId }; |
|
362 |
CEikStatusPane* statusPane = S60->statusPane(); |
|
363 |
if (statusPane && statusPane->PaneCapabilities(paneUid).IsPresent()) { |
|
364 |
CCoeControl* control = NULL; |
|
365 |
// ControlL shouldn't leave because the pane is present |
|
366 |
TRAPD(err, control = statusPane->ControlL(paneUid)); |
|
367 |
return err != KErrNone ? NULL : control; |
|
368 |
} |
|
369 |
return NULL; |
|
370 |
} |
|
371 |
||
372 |
// Returns the application's title pane, if not present returns NULL. |
|
373 |
inline CAknTitlePane* QS60Data::titlePane() |
|
374 |
{ |
|
375 |
return static_cast<CAknTitlePane*>(S60->statusPaneSubPane(EEikStatusPaneUidTitle)); |
|
376 |
} |
|
377 |
||
378 |
// Returns the application's title pane, if not present returns NULL. |
|
379 |
inline CAknContextPane* QS60Data::contextPane() |
|
380 |
{ |
|
381 |
return static_cast<CAknContextPane*>(S60->statusPaneSubPane(EEikStatusPaneUidContext)); |
|
382 |
} |
|
383 |
||
384 |
inline CEikButtonGroupContainer* QS60Data::buttonGroupContainer() |
|
385 |
{ |
|
386 |
return CEikonEnv::Static()->AppUiFactory()->Cba(); |
|
387 |
} |
|
388 |
#endif // Q_WS_S60 |
|
389 |
||
390 |
static inline QFont qt_TFontSpec2QFontL(const TFontSpec &fontSpec) |
|
391 |
{ |
|
392 |
return QFont( |
|
393 |
qt_TDesC2QString(fontSpec.iTypeface.iName), |
|
394 |
fontSpec.iHeight / KTwipsPerPoint, |
|
395 |
fontSpec.iFontStyle.StrokeWeight() == EStrokeWeightNormal ? QFont::Normal : QFont::Bold, |
|
396 |
fontSpec.iFontStyle.Posture() == EPostureItalic |
|
397 |
); |
|
398 |
} |
|
399 |
||
400 |
static inline QImage::Format qt_TDisplayMode2Format(TDisplayMode mode) |
|
401 |
{ |
|
402 |
QImage::Format format; |
|
403 |
switch(mode) { |
|
404 |
case EGray2: |
|
405 |
format = QImage::Format_MonoLSB; |
|
406 |
break; |
|
407 |
case EColor256: |
|
408 |
case EGray256: |
|
409 |
format = QImage::Format_Indexed8; |
|
410 |
break; |
|
411 |
case EColor4K: |
|
412 |
format = QImage::Format_RGB444; |
|
413 |
break; |
|
414 |
case EColor64K: |
|
415 |
format = QImage::Format_RGB16; |
|
416 |
break; |
|
417 |
case EColor16M: |
|
418 |
format = QImage::Format_RGB888; |
|
419 |
break; |
|
420 |
case EColor16MU: |
|
421 |
format = QImage::Format_RGB32; |
|
422 |
break; |
|
423 |
case EColor16MA: |
|
424 |
format = QImage::Format_ARGB32; |
|
425 |
break; |
|
426 |
case Q_SYMBIAN_ECOLOR16MAP: |
|
427 |
format = QImage::Format_ARGB32_Premultiplied; |
|
428 |
break; |
|
429 |
default: |
|
430 |
format = QImage::Format_Invalid; |
|
431 |
break; |
|
432 |
} |
|
433 |
return format; |
|
434 |
} |
|
435 |
||
436 |
#ifndef QT_NO_CURSOR |
|
437 |
void qt_symbian_setWindowCursor(const QCursor &cursor, const CCoeControl* wid); |
|
438 |
void qt_symbian_setWindowGroupCursor(const QCursor &cursor, RWindowTreeNode &node); |
|
439 |
void qt_symbian_setGlobalCursor(const QCursor &cursor); |
|
440 |
void qt_symbian_set_cursor_visible(bool visible); |
|
441 |
bool qt_symbian_is_cursor_visible(); |
|
442 |
#endif |
|
443 |
||
444 |
QT_END_NAMESPACE |
|
445 |
||
446 |
#endif // QT_S60_P_H |