1 /****************************************************************************
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** information use the contact form at http://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 or version 3 as published by the Free
20 ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
21 ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
22 ** following information to ensure the GNU Lesser General Public License
23 ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
24 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 **
26 ** As a special exception, The Qt Company gives you certain additional
27 ** rights. These rights are described in The Qt Company LGPL Exception
28 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 **
30 ** GNU General Public License Usage
31 ** Alternatively, this file may be used under the terms of the GNU
32 ** General Public License version 3.0 as published by the Free Software
33 ** Foundation and appearing in the file LICENSE.GPL included in the
34 ** packaging of this file. Please review the following information to
35 ** ensure the GNU General Public License version 3.0 requirements will be
36 ** met: http://www.gnu.org/copyleft/gpl.html.
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"
65 #include "qelapsedtimer.h"
66 #include "QtCore/qthreadstorage.h"
67 #include "qwidget_p.h"
68 #include <w32std.h>
69 #include <coecntrl.h>
70 #include <eikenv.h>
71 #include <eikappui.h>
72
73 #ifdef Q_WS_S60
74 #include <AknUtils.h> // AknLayoutUtils
75 #include <avkon.hrh> // EEikStatusPaneUidTitle
76 #include <akntitle.h> // CAknTitlePane
77 #include <akncontext.h> // CAknContextPane
78 #include <eikspane.h> // CEikStatusPane
79 #include <AknPopupFader.h> // MAknFadedComponent and TAknPopupFader
80 #include <bitstd.h> // EGraphicsOrientation constants
81 #ifdef QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H
82 #include <gfxtranseffect/gfxtranseffect.h> // BeginFullScreen
83 #include <akntranseffect.h> // BeginFullScreen
84 #endif
85 #endif
86
87 QT_BEGIN_NAMESPACE
88
89 // Application internal HandleResourceChangeL events,
90 // system events seems to start with 0x10
91 const TInt KInternalStatusPaneChange = 0x50000000;
92
93 // For BeginFullScreen().
94 const TUint KQtAppExitFlag = 0x400;
95
96 static const int qt_symbian_max_screens = 4;
97
98 //this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2
99 #define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13)
100
101 class QSymbianTypeFaceExtras;
102 typedef QHash<QString, const QSymbianTypeFaceExtras *> QSymbianTypeFaceExtrasHash;
103 typedef void (*QThreadLocalReleaseFunc)();
104
105 #ifdef COE_GROUPED_POINTER_EVENT_VERSION
106 class CCoeEventData;
107 #endif
108
109 class Q_AUTOTEST_EXPORT QS60ThreadLocalData
110 {
111 public:
112 QS60ThreadLocalData();
113 ~QS60ThreadLocalData();
114 bool usingCONEinstances;
115 RWsSession wsSession;
116 CWsScreenDevice *screenDevice;
117 QSymbianTypeFaceExtrasHash fontData;
118 QVector<QThreadLocalReleaseFunc> releaseFuncs;
119 };
120
121 class QS60Data
122 {
123 public:
124 QS60Data();
125 QThreadStorage<QS60ThreadLocalData *> tls;
126 TUid uid;
127 int screenDepth;
128 QPoint lastCursorPos;
129 QPoint lastPointerEventPos;
130 QPointer<QWidget> lastPointerEventTarget;
131 QPointer<QWidget> mousePressTarget;
132 int screenWidthInPixels;
133 int screenHeightInPixels;
134 int screenWidthInTwips;
135 int screenHeightInTwips;
136 int defaultDpiX;
137 int defaultDpiY;
138 WId curWin;
139 enum PressedKeys {
140 Select = 0x1,
141 Right = 0x2,
142 Down = 0x4,
143 Left = 0x8,
144 Up = 0x10,
145 LeftUp = 0x20,
146 RightUp = 0x40,
147 RightDown = 0x80,
148 LeftDown = 0x100
149 };
150 int virtualMousePressedKeys; // of the above type, but avoids casting problems
151 int virtualMouseAccelDX;
152 int virtualMouseAccelDY;
153 QElapsedTimer virtualMouseAccelTimeout;
154 int virtualMouseMaxAccel;
155 #ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
156 int brokenPointerCursors : 1;
157 #endif
158 int hasTouchscreen : 1;
159 int mouseInteractionEnabled : 1;
160 int virtualMouseRequired : 1;
161 int qtOwnsS60Environment : 1;
162 int supportsPremultipliedAlpha : 1;
163 int avkonComponentsSupportTransparency : 1;
164 int menuBeingConstructed : 1;
165 int orientationSet : 1;
166 int partial_keyboard : 1;
167 int partial_keyboardAutoTranslation : 1;
168 int partialKeyboardOpen : 1;
169 int handleStatusPaneResizeNotifications : 1;
170 int screenFurnitureFullyCreated : 1;
171 int beginFullScreenCalled : 1;
172 int endFullScreenCalled : 1;
173 int eglSurfaceCreationError : 1;
174 QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type
175 QPointer<QWidget> splitViewLastWidget;
176
177 static CEikButtonGroupContainer *cba;
178
179 enum ScanCodeState {
180 Unpressed,
181 KeyDown,
182 KeyDownAndKey
183 };
184 QHash<TInt, ScanCodeState> scanCodeStates;
185
186 static inline void updateScreenSize();
187 inline RWsSession& wsSession();
188 static inline int screenCount();
189 static inline RWindowGroup& windowGroup();
190 static inline RWindowGroup& windowGroup(const QWidget *widget);
191 static inline RWindowGroup& windowGroup(int screenNumber);
192 inline CWsScreenDevice* screenDevice();
193 inline CWsScreenDevice* screenDevice(const QWidget *widget);
194 inline CWsScreenDevice* screenDevice(int screenNumber);
195 static inline int screenNumberForWidget(const QWidget *widget);
196 inline QSymbianTypeFaceExtrasHash& fontData();
197 inline void addThreadLocalReleaseFunc(QThreadLocalReleaseFunc func);
198 static inline CCoeAppUi* appUi();
199 static inline CEikMenuBar* menuBar();
200 #ifdef Q_WS_S60
201 static inline CEikStatusPane* statusPane();
202 static inline CCoeControl* statusPaneSubPane(TInt aPaneId);
203 static inline CAknTitlePane* titlePane();
204 static inline CAknContextPane* contextPane();
205 static inline CEikButtonGroupContainer* buttonGroupContainer();
206 static inline void setButtonGroupContainer(CEikButtonGroupContainer* newCba);
207 static void setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, bool buttonGroupVisible);
208 static bool setRecursiveDecorationsVisibility(QWidget *window, Qt::WindowStates newState);
209 static void createStatusPaneAndCBA();
210 #endif
211 static void controlVisibilityChanged(CCoeControl *control, bool visible);
212 static TRect clientRect();
213
214 TTrapHandler *s60InstalledTrapHandler;
215
216 int screenWidthInPixelsForScreen[qt_symbian_max_screens];
217 int screenHeightInPixelsForScreen[qt_symbian_max_screens];
218 int screenWidthInTwipsForScreen[qt_symbian_max_screens];
219 int screenHeightInTwipsForScreen[qt_symbian_max_screens];
220
221 int nativeScreenWidthInPixels;
222 int nativeScreenHeightInPixels;
223
224 enum ScreenRotation {
225 ScreenRotation0, // portrait (or the native orientation)
226 ScreenRotation90, // typically DisplayLeftUp landscape
227 ScreenRotation180, // not used
228 ScreenRotation270 // DisplayRightUp landscape when 3-way orientation is supported
229 };
230 ScreenRotation screenRotation;
231
232 int editorFlags;
233 };
234
235 Q_AUTOTEST_EXPORT QS60Data* qGlobalS60Data();
236 #define S60 qGlobalS60Data()
237
238 class QAbstractLongTapObserver
239 {
240 public:
241 virtual void HandleLongTapEventL( const TPoint& aPenEventLocation,
242 const TPoint& aPenEventScreenLocation ) = 0;
243 };
244 class QLongTapTimer;
245
246
247 class QSymbianControl : public CCoeControl, public QAbstractLongTapObserver
248 #ifdef Q_WS_S60
249 , public MAknFadedComponent, public MEikStatusPaneObserver
250 #endif
251 {
252 public:
253 DECLARE_TYPE_ID(0x51740000) // Fun fact: the two first values are "Qt" in ASCII.
254
255 public:
256 QSymbianControl(QWidget *w);
257 void ConstructL(bool isWindowOwning = false, bool desktop = false);
258 ~QSymbianControl();
259 void HandleResourceChange(int resourceType);
260 void HandlePointerEventL(const TPointerEvent& aPointerEvent);
261 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
262 #if !defined(QT_NO_IM) && defined(Q_WS_S60)
263 TCoeInputCapabilities InputCapabilities() const;
264 #endif
265 TTypeUid::Ptr MopSupplyObject(TTypeUid id);
266
widget()267 inline QWidget* widget() const { return qwidget; }
268 void setWidget(QWidget *w);
269 void sendInputEvent(QWidget *widget, QInputEvent *inputEvent);
setIgnoreFocusChanged(bool enabled)270 void setIgnoreFocusChanged(bool enabled) { m_ignoreFocusChanged = enabled; }
271 void CancelLongTapTimer();
272
273 void setFocusSafely(bool focus);
274
275 bool isControlActive();
276
277 void ensureFixNativeOrientation();
278 enum TTranslationType { ETranslatePixelCenter, ETranslatePixelEdge };
279 QPoint translatePointForFixedNativeOrientation(const TPoint &pointerEventPos, TTranslationType translationType) const;
280 TRect translateRectForFixedNativeOrientation(const TRect &controlRect) const;
281
282 #ifdef Q_WS_S60
FadeBehindPopup(bool fade)283 void FadeBehindPopup(bool fade){ popupFader.FadeBehindPopup( this, this, fade); }
284 void HandleStatusPaneSizeChange();
285
286 protected: // from MAknFadedComponent
CountFadedComponents()287 TInt CountFadedComponents() {return 1;}
FadedComponent(TInt)288 CCoeControl* FadedComponent(TInt /*aIndex*/) {return this;}
289 #else
290 // #warning No fallback implementation for QSymbianControl::FadeBehindPopup
FadeBehindPopup(bool)291 void FadeBehindPopup(bool /*fade*/){ }
292 #endif
293
294 protected:
295 void Draw(const TRect& aRect) const;
296 void SizeChanged();
297 void PositionChanged();
298 void FocusChanged(TDrawNow aDrawNow);
299
300 protected:
301 void qwidgetResize_helper(const QSize &newSize);
302
303 private:
304 void HandlePointerEvent(const TPointerEvent& aPointerEvent);
305 TKeyResponse OfferKeyEvent(const TKeyEvent& aKeyEvent,TEventCode aType);
306 TKeyResponse sendSymbianKeyEvent(const TKeyEvent &keyEvent, QEvent::Type type);
307 TKeyResponse sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent);
308 TKeyResponse handleVirtualMouse(const TKeyEvent& keyEvent,TEventCode type);
309 bool sendMouseEvent(QWidget *widget, QMouseEvent *mEvent);
310 void sendMouseEvent(
311 QWidget *receiver,
312 QEvent::Type type,
313 const QPoint &globalPos,
314 Qt::MouseButton button,
315 Qt::KeyboardModifiers modifiers);
316 struct TouchEventParams
317 {
318 TouchEventParams();
319 TouchEventParams(int pointerNumber, TPointerEvent::TType type, QPointF screenPos, qreal pressure);
320 int pointerNumber;
321 TPointerEvent::TType type;
322 QPointF screenPos;
323 qreal pressure;
324 };
325 void processTouchEvents(const QVector<TouchEventParams> &touches);
326 void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation );
327 #ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
328 #ifdef COE_GROUPED_POINTER_EVENT_VERSION
329 void translateMultiEventPointerEvent(const CCoeEventData &eventData );
330 #endif
331 void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event);
332 TouchEventParams TouchEventFromAdvancedPointerEvent(const TAdvancedPointerEvent *event);
333 #endif
334 bool isSplitViewWidget(QWidget *widget);
335 bool hasFocusedAndVisibleChild(QWidget *parentWidget);
336 void doDraw(const TRect& aRect) const;
337
338 public:
339 void handleClientAreaChange();
340
341 private:
342 static QSymbianControl *lastFocusedControl;
343
344 private:
345 QWidget *qwidget;
346 QLongTapTimer* m_longTapDetector;
347 QElapsedTimer m_doubleClickTimer;
348 bool m_ignoreFocusChanged : 1;
349 bool m_symbianPopupIsOpen : 1;
350
351 #ifdef Q_WS_S60
352 // Fader object used to fade everything except this menu and the CBA.
353 TAknPopupFader popupFader;
354 #endif
355
356 bool m_inExternalScreenOverride : 1;
357 bool m_lastStatusPaneVisibility : 1;
358 };
359
QS60Data()360 inline QS60Data::QS60Data()
361 : uid(TUid::Null()),
362 screenDepth(0),
363 screenWidthInPixels(0),
364 screenHeightInPixels(0),
365 screenWidthInTwips(0),
366 screenHeightInTwips(0),
367 defaultDpiX(0),
368 defaultDpiY(0),
369 curWin(0),
370 virtualMousePressedKeys(0),
371 virtualMouseAccelDX(0),
372 virtualMouseAccelDY(0),
373 virtualMouseMaxAccel(0),
374 #ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
375 brokenPointerCursors(0),
376 #endif
377 hasTouchscreen(0),
378 mouseInteractionEnabled(0),
379 virtualMouseRequired(0),
380 qtOwnsS60Environment(0),
381 supportsPremultipliedAlpha(0),
382 avkonComponentsSupportTransparency(0),
383 menuBeingConstructed(0),
384 orientationSet(0),
385 partial_keyboard(0),
386 partial_keyboardAutoTranslation(1),
387 partialKeyboardOpen(0),
388 handleStatusPaneResizeNotifications(1),
389 screenFurnitureFullyCreated(0),
390 beginFullScreenCalled(0),
391 endFullScreenCalled(0),
392 eglSurfaceCreationError(0),
393 s60ApplicationFactory(0),
394 s60InstalledTrapHandler(0),
395 editorFlags(0)
396 {
397 }
398
updateScreenSize()399 inline void QS60Data::updateScreenSize()
400 {
401 CWsScreenDevice *dev = S60->screenDevice();
402 int screenModeCount = dev->NumScreenModes();
403 int mode = dev->CurrentScreenMode();
404 TPixelsTwipsAndRotation params;
405 dev->GetScreenModeSizeAndRotation(mode, params);
406 S60->screenWidthInPixels = params.iPixelSize.iWidth;
407 S60->screenHeightInPixels = params.iPixelSize.iHeight;
408 S60->screenWidthInTwips = params.iTwipsSize.iWidth;
409 S60->screenHeightInTwips = params.iTwipsSize.iHeight;
410
411 S60->virtualMouseMaxAccel = qMax(S60->screenHeightInPixels, S60->screenWidthInPixels) / 10;
412
413 TReal inches = S60->screenHeightInTwips / (TReal)KTwipsPerInch;
414 S60->defaultDpiY = S60->screenHeightInPixels / inches;
415 inches = S60->screenWidthInTwips / (TReal)KTwipsPerInch;
416 S60->defaultDpiX = S60->screenWidthInPixels / inches;
417
418 switch (params.iRotation) {
419 case CFbsBitGc::EGraphicsOrientationNormal:
420 S60->screenRotation = ScreenRotation0;
421 break;
422 case CFbsBitGc::EGraphicsOrientationRotated90:
423 S60->screenRotation = ScreenRotation90;
424 break;
425 case CFbsBitGc::EGraphicsOrientationRotated180:
426 S60->screenRotation = ScreenRotation180;
427 break;
428 case CFbsBitGc::EGraphicsOrientationRotated270:
429 S60->screenRotation = ScreenRotation270;
430 break;
431 default:
432 S60->screenRotation = ScreenRotation0;
433 break;
434 }
435
436 int screens = S60->screenCount();
437 for (int i = 0; i < screens; ++i) {
438 CWsScreenDevice *dev = S60->screenDevice(i);
439 mode = dev->CurrentScreenMode();
440 dev->GetScreenModeSizeAndRotation(mode, params);
441 S60->screenWidthInPixelsForScreen[i] = params.iPixelSize.iWidth;
442 S60->screenHeightInPixelsForScreen[i] = params.iPixelSize.iHeight;
443 S60->screenWidthInTwipsForScreen[i] = params.iTwipsSize.iWidth;
444 S60->screenHeightInTwipsForScreen[i] = params.iTwipsSize.iHeight;
445 }
446
447 // Look for a screen mode with rotation 0
448 // in order to decide what the native orientation is.
449 for (mode = 0; mode < screenModeCount; ++mode) {
450 TPixelsAndRotation sizeAndRotation;
451 dev->GetScreenModeSizeAndRotation(mode, sizeAndRotation);
452 if (sizeAndRotation.iRotation == CFbsBitGc::EGraphicsOrientationNormal) {
453 S60->nativeScreenWidthInPixels = sizeAndRotation.iPixelSize.iWidth;
454 S60->nativeScreenHeightInPixels = sizeAndRotation.iPixelSize.iHeight;
455 break;
456 }
457 }
458 }
459
wsSession()460 inline RWsSession& QS60Data::wsSession()
461 {
462 if(!tls.hasLocalData()) {
463 tls.setLocalData(new QS60ThreadLocalData);
464 }
465 return tls.localData()->wsSession;
466 }
467
screenCount()468 inline int QS60Data::screenCount()
469 {
470 #if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS)
471 CCoeEnv *env = CCoeEnv::Static();
472 if (env) {
473 return qMin(env->WsSession().NumberOfScreens(), qt_symbian_max_screens);
474 }
475 #endif
476 return 1;
477 }
478
windowGroup()479 inline RWindowGroup& QS60Data::windowGroup()
480 {
481 return CCoeEnv::Static()->RootWin();
482 }
483
windowGroup(const QWidget * widget)484 inline RWindowGroup& QS60Data::windowGroup(const QWidget *widget)
485 {
486 return windowGroup(screenNumberForWidget(widget));
487 }
488
windowGroup(int screenNumber)489 inline RWindowGroup& QS60Data::windowGroup(int screenNumber)
490 {
491 #if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS)
492 RWindowGroup *wg = CCoeEnv::Static()->RootWin(screenNumber);
493 return wg ? *wg : windowGroup();
494 #else
495 Q_UNUSED(screenNumber);
496 return windowGroup();
497 #endif
498 }
499
screenDevice()500 inline CWsScreenDevice* QS60Data::screenDevice()
501 {
502 if(!tls.hasLocalData()) {
503 tls.setLocalData(new QS60ThreadLocalData);
504 }
505 return tls.localData()->screenDevice;
506 }
507
screenDevice(const QWidget * widget)508 inline CWsScreenDevice* QS60Data::screenDevice(const QWidget *widget)
509 {
510 return screenDevice(screenNumberForWidget(widget));
511 }
512
screenDevice(int screenNumber)513 inline CWsScreenDevice* QS60Data::screenDevice(int screenNumber)
514 {
515 #if defined(Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS)
516 CCoeEnv *env = CCoeEnv::Static();
517 if (env) {
518 CWsScreenDevice *dev = env->ScreenDevice(screenNumber);
519 return dev ? dev : screenDevice();
520 } else {
521 return screenDevice();
522 }
523 #else
524 return screenDevice();
525 #endif
526 }
527
screenNumberForWidget(const QWidget * widget)528 inline int QS60Data::screenNumberForWidget(const QWidget *widget)
529 {
530 if (!widget)
531 return 0;
532 const QWidget *w = widget;
533 while (w->parentWidget())
534 w = w->parentWidget();
535 return qt_widget_private(const_cast<QWidget *>(w))->symbianScreenNumber;
536 }
537
fontData()538 inline QSymbianTypeFaceExtrasHash& QS60Data::fontData()
539 {
540 if (!tls.hasLocalData()) {
541 tls.setLocalData(new QS60ThreadLocalData);
542 }
543 return tls.localData()->fontData;
544 }
545
addThreadLocalReleaseFunc(QThreadLocalReleaseFunc func)546 inline void QS60Data::addThreadLocalReleaseFunc(QThreadLocalReleaseFunc func)
547 {
548 if (!tls.hasLocalData()) {
549 tls.setLocalData(new QS60ThreadLocalData);
550 }
551 QS60ThreadLocalData *data = tls.localData();
552 if (!data->releaseFuncs.contains(func))
553 data->releaseFuncs.append(func);
554 }
555
appUi()556 inline CCoeAppUi* QS60Data::appUi()
557 {
558 return CCoeEnv::Static()-> AppUi();
559 }
560
menuBar()561 inline CEikMenuBar* QS60Data::menuBar()
562 {
563 return CEikonEnv::Static()->AppUiFactory()->MenuBar();
564 }
565
566 #ifdef Q_WS_S60
statusPane()567 inline CEikStatusPane* QS60Data::statusPane()
568 {
569 return CEikonEnv::Static()->AppUiFactory()->StatusPane();
570 }
571
572 // Returns the application's status pane control, if not present returns NULL.
statusPaneSubPane(TInt aPaneId)573 inline CCoeControl* QS60Data::statusPaneSubPane( TInt aPaneId )
574 {
575 const TUid paneUid = { aPaneId };
576 CEikStatusPane* statusPane = S60->statusPane();
577 if (statusPane && statusPane->PaneCapabilities(paneUid).IsPresent()) {
578 CCoeControl* control = NULL;
579 // ControlL shouldn't leave because the pane is present
580 TRAPD(err, control = statusPane->ControlL(paneUid));
581 return err != KErrNone ? NULL : control;
582 }
583 return NULL;
584 }
585
586 // Returns the application's title pane, if not present returns NULL.
titlePane()587 inline CAknTitlePane* QS60Data::titlePane()
588 {
589 return static_cast<CAknTitlePane*>(S60->statusPaneSubPane(EEikStatusPaneUidTitle));
590 }
591
592 // Returns the application's title pane, if not present returns NULL.
contextPane()593 inline CAknContextPane* QS60Data::contextPane()
594 {
595 return static_cast<CAknContextPane*>(S60->statusPaneSubPane(EEikStatusPaneUidContext));
596 }
597
buttonGroupContainer()598 inline CEikButtonGroupContainer* QS60Data::buttonGroupContainer()
599 {
600 return QS60Data::cba;
601 }
602
setButtonGroupContainer(CEikButtonGroupContainer * newCba)603 inline void QS60Data::setButtonGroupContainer(CEikButtonGroupContainer *newCba)
604 {
605 QS60Data::cba = newCba;
606 }
607 #endif // Q_WS_S60
608
qt_TFontSpec2QFontL(const TFontSpec & fontSpec)609 static inline QFont qt_TFontSpec2QFontL(const TFontSpec &fontSpec)
610 {
611 return QFont(
612 qt_TDesC2QString(fontSpec.iTypeface.iName),
613 fontSpec.iHeight / KTwipsPerPoint,
614 fontSpec.iFontStyle.StrokeWeight() == EStrokeWeightNormal ? QFont::Normal : QFont::Bold,
615 fontSpec.iFontStyle.Posture() == EPostureItalic
616 );
617 }
618
qt_TDisplayMode2Format(TDisplayMode mode)619 static inline QImage::Format qt_TDisplayMode2Format(TDisplayMode mode)
620 {
621 QImage::Format format;
622 switch(mode) {
623 case EGray2:
624 format = QImage::Format_MonoLSB;
625 break;
626 case EColor256:
627 case EGray256:
628 format = QImage::Format_Indexed8;
629 break;
630 case EColor4K:
631 format = QImage::Format_RGB444;
632 break;
633 case EColor64K:
634 format = QImage::Format_RGB16;
635 break;
636 case EColor16M:
637 format = QImage::Format_RGB888;
638 break;
639 case EColor16MU:
640 format = QImage::Format_RGB32;
641 break;
642 case EColor16MA:
643 format = QImage::Format_ARGB32;
644 break;
645 case Q_SYMBIAN_ECOLOR16MAP:
646 format = QImage::Format_ARGB32_Premultiplied;
647 break;
648 default:
649 format = QImage::Format_Invalid;
650 break;
651 }
652 return format;
653 }
654
655 #ifndef QT_NO_CURSOR
656 void qt_symbian_setWindowCursor(const QCursor &cursor, const CCoeControl* wid);
657 void qt_symbian_setWindowGroupCursor(const QCursor &cursor, RWindowTreeNode &node);
658 void qt_symbian_setGlobalCursor(const QCursor &cursor);
659 void qt_symbian_set_cursor_visible(bool visible);
660 bool qt_symbian_is_cursor_visible();
661 #endif
662
qt_beginFullScreenEffect()663 static inline bool qt_beginFullScreenEffect()
664 {
665 #if defined(Q_WS_S60) && defined(QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H)
666 // Only for post-S^3. On earlier versions the system transition effects
667 // may not be able to capture the non-Avkon content, leading to confusing
668 // looking effects, so just skip the whole thing.
669 if (S60->beginFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2)
670 return false;
671 S60->beginFullScreenCalled = true;
672 // For Avkon apps the app-exit effect is triggered from CAknAppUi::PrepareToExit().
673 // That is good for Avkon apps, but in case of Qt the RWindows are destroyed earlier.
674 // Therefore we call BeginFullScreen() ourselves.
675 GfxTransEffect::BeginFullScreen(AknTransEffect::EApplicationExit,
676 TRect(0, 0, 0, 0),
677 AknTransEffect::EParameterType,
678 AknTransEffect::GfxTransParam(S60->uid,
679 AknTransEffect::TParameter::EAvkonCheck | KQtAppExitFlag));
680 return true;
681 #else
682 return false;
683 #endif
684 }
685
qt_abortFullScreenEffect()686 static inline void qt_abortFullScreenEffect()
687 {
688 #if defined(Q_WS_S60) && defined(QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H)
689 if (!S60->beginFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2)
690 return;
691 GfxTransEffect::AbortFullScreen();
692 S60->beginFullScreenCalled = S60->endFullScreenCalled = false;
693 #endif
694 }
695
qt_endFullScreenEffect()696 static inline void qt_endFullScreenEffect()
697 {
698 #if defined(Q_WS_S60) && defined(QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H)
699 if (S60->endFullScreenCalled || QSysInfo::s60Version() <= QSysInfo::SV_S60_5_2)
700 return;
701 S60->endFullScreenCalled = true;
702 GfxTransEffect::EndFullScreen();
703 #endif
704 }
705
706 QT_END_NAMESPACE
707
708 #endif // QT_S60_P_H
709