Implement QWidgetPrivate::setWindowIcon_sys()
[profile/ivi/qtbase.git] / src / widgets / kernel / qwidget_p.h
index f3838ee..7884496 100644 (file)
@@ -1,8 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** 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.
 **
@@ -35,6 +34,7 @@
 **
 **
 **
+**
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -59,6 +59,7 @@
 #include "QtCore/qlocale.h"
 #include "QtCore/qset.h"
 #include "QtGui/qregion.h"
+#include "QtGui/qinputmethod.h"
 #include "QtWidgets/qsizepolicy.h"
 #include "QtWidgets/qstyle.h"
 #include "QtWidgets/qapplication.h"
 #include "QtWidgets/qgraphicsview.h"
 #include <private/qgesture_p.h>
 
-#ifdef Q_WS_WIN
-#include "QtCore/qt_windows.h"
-#include <private/qdnd_p.h>
-#endif // Q_WS_WIN
-
-#ifdef Q_WS_X11
-#include "QtGui/qx11info_x11.h"
-#endif
-
-#ifdef Q_WS_MAC
-#include <private/qt_mac_p.h>
-#endif
-
-#if defined(Q_WS_QWS)
-#include "QtWidgets/qinputcontext.h"
-#include "QtGui/qscreen_qws.h"
-#endif
-
-#if defined(Q_OS_SYMBIAN)
-class RDrawableWindow;
-class CCoeControl;
-#endif
-
 QT_BEGIN_NAMESPACE
 
 // Extra QWidget data
 //  - to minimize memory usage for members that are seldom used.
 //  - top-level widgets have extra extra data to reduce cost further
-#if defined(Q_WS_QWS)
-class QWSManager;
-#endif
-#if defined(Q_WS_MAC)
-class QCoreGraphicsPaintEnginePrivate;
-#endif
-#if defined(Q_WS_QPA)
 class QWidgetWindow;
-#endif
 class QPaintEngine;
 class QPixmap;
 class QWidgetBackingStore;
@@ -115,6 +85,29 @@ class QStyle;
 
 class QUnifiedToolbarSurface;
 
+// implemented in qshortcut.cpp
+bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context);
+
+class QUpdateLaterEvent : public QEvent
+{
+public:
+    explicit QUpdateLaterEvent(const QRegion& paintRegion)
+        : QEvent(UpdateLater), m_region(paintRegion)
+    {
+    }
+
+    ~QUpdateLaterEvent()
+    {
+    }
+
+    inline const QRegion &region() const { return m_region; }
+
+protected:
+    QRegion m_region;
+};
+
+
+
 class Q_AUTOTEST_EXPORT QWidgetBackingStoreTracker
 {
 
@@ -162,7 +155,6 @@ struct QTLWExtra {
 
     // Regular pointers (keep them together to avoid gaps on 64 bits architectures).
     QIcon *icon; // widget icon
-    QPixmap *iconPixmap;
     QWidgetBackingStoreTracker backingStoreTracker;
     QBackingStore *backingStore;
     QPainter *sharedPainter;
@@ -183,7 +175,7 @@ struct QTLWExtra {
 
     // *************************** Cross-platform bit fields ****************************
     uint opacity : 8;
-    uint posFromMove : 1;
+    uint posIncludesFrame : 1;
     uint sizeAdjusted : 1;
     uint inTopLevelResize : 1;
     uint inRepaint : 1;
@@ -217,25 +209,14 @@ struct QTLWExtra {
     WindowGroupRef group;
     IconRef windowIcon; // the current window icon, if set with setWindowIcon_sys.
     quint32 savedWindowAttributesFromMaximized; // Saved attributes from when the calling updateMaximizeButton_sys()
-#ifdef QT_MAC_USE_COCOA
     // This value is just to make sure we maximize and restore to the right location, yet we allow apps to be maximized and
     // manually resized.
     // The name is misleading, since this is set when maximizing the window. It is a hint to saveGeometry(..) to record the
     // starting position as 0,0 instead of the normal starting position.
     bool wasMaximized;
-#endif // QT_MAC_USE_COCOA
-
-#elif defined(Q_WS_QWS) // <--------------------------------------------------------- QWS
-#ifndef QT_NO_QWS_MANAGER
-    QWSManager *qwsManager;
 #endif
-#elif defined(Q_OS_SYMBIAN)
-    uint inExpose : 1; // Prevents drawing recursion
-    uint nativeWindowTransparencyEnabled : 1; // Tracks native window transparency
-#elif defined(Q_WS_QPA)
     QWidgetWindow *window;
     quint32 screenIndex; // index in qplatformscreenlist
-#endif
 };
 
 struct QWExtra {
@@ -284,56 +265,10 @@ struct QWExtra {
     uint compress_events : 1;
     WId xDndProxy; // XDND forwarding to embedded windows
 #elif defined(Q_WS_MAC) // <------------------------------------------------------ MAC
-#ifdef QT_MAC_USE_COCOA
     // Cocoa Mask stuff
     QImage maskBits;
     CGImageRef imageMask;
 #endif
-#elif defined(Q_OS_SYMBIAN) // <----------------------------------------------------- Symbian
-    uint activated : 1; // RWindowBase::Activated has been called
-
-    /**
-     * If this bit is set, each native widget receives the signals from the
-     * Symbian control immediately before and immediately after draw ops are
-     * sent to the window server for this control:
-     *      void beginNativePaintEvent(const QRect &paintRect);
-     *      void endNativePaintEvent(const QRect &paintRect);
-     */
-    uint receiveNativePaintEvents : 1;
-
-    /**
-     * Defines the behaviour of QSymbianControl::Draw.
-     */
-    enum NativePaintMode {
-        /**
-         * Normal drawing mode: blits the required region of the backing store
-         * via WSERV.
-         */
-        Blit,
-
-        /**
-         * Disable drawing for this widget.
-         */
-        Disable,
-
-        /**
-         * Paint zeros into the WSERV framebuffer, using BitGDI APIs.  For windows
-         * with an EColor16MU display mode, zero is written only into the R, G and B
-         * channels of the pixel.
-         */
-        ZeroFill,
-
-        /**
-         * Blit backing store, propagating alpha channel into the framebuffer.
-         */
-        BlitWriteAlpha,
-
-        Default = Blit
-    };
-
-    NativePaintMode nativePaintMode;
-
-#endif
 };
 
 /*!
@@ -366,9 +301,9 @@ public:
         DrawRecursive = 0x04,
         DrawInvisible = 0x08,
         DontSubtractOpaqueChildren = 0x10,
-        DontSetCompositionMode = 0x20,
-        DontDrawOpaqueChildren = 0x40,
-        DontDrawNativeChildren = 0x80
+        DontDrawOpaqueChildren = 0x20,
+        DontDrawNativeChildren = 0x40,
+        DontSetCompositionMode = 0x80
     };
 
     enum CloseMode {
@@ -414,17 +349,13 @@ public:
     QPalette naturalWidgetPalette(uint inheritedMask) const;
 
     void setMask_sys(const QRegion &);
-#ifdef Q_OS_SYMBIAN
-    void setSoftKeys_sys(const QList<QAction*> &softkeys);
-    void activateSymbianWindow(WId wid = 0);
-    void _q_delayedDestroy(WId winId);
-#endif
 
     void raise_sys();
     void lower_sys();
     void stackUnder_sys(QWidget *);
 
     void setFocus_sys();
+    void updateFocusChild();
 
     void updateFont(const QFont &);
     inline void setFont_helper(const QFont &font) {
@@ -489,7 +420,7 @@ public:
     bool close_helper(CloseMode mode);
 
     void setWindowIcon_helper();
-    void setWindowIcon_sys(bool forceReset = false);
+    void setWindowIcon_sys();
     void setWindowOpacity_sys(qreal opacity);
     void adjustQuitOnCloseAttribute();
 
@@ -504,6 +435,9 @@ public:
     void syncBackingStore();
     void syncBackingStore(const QRegion &region);
 
+    // tells the input method about the widgets transform
+    void updateWidgetTransform();
+
     void reparentFocusWidgets(QWidget *oldtlw);
 
     static int pointToRect(const QPoint &p, const QRect &r);
@@ -516,6 +450,7 @@ public:
     void scroll_sys(int dx, int dy, const QRect &r);
     void deactivateWidgetCleanup();
     void setGeometry_sys(int, int, int, int, bool);
+    void fixPosIncludesFrame();
     void sendPendingMoveAndResizeEvents(bool recursive = false, bool disableUpdates = false);
     void activateChildLayoutsRecursively();
     void show_recursive();
@@ -550,10 +485,10 @@ public:
 
     void setWindowTitle_helper(const QString &cap);
     void setWindowFilePath_helper(const QString &filePath);
+    void setWindowModified_helper();
 
     bool setMinimumSize_helper(int &minw, int &minh);
     bool setMaximumSize_helper(int &maxw, int &maxh);
-    virtual bool hasHeightForWidth() const;
     void setConstraints_sys();
     bool pointInsideRectAndMask(const QPoint &) const;
     QWidget *childAt_helper(const QPoint &, bool) const;
@@ -569,8 +504,6 @@ public:
     // sub-classes that their internals are about to be released.
     virtual void aboutToDestroy() {}
 
-    QInputContext *assignedInputContext() const;
-    QInputContext *inputContext() const;
     inline QWidget *effectiveFocusWidget() {
         QWidget *w = q_func();
         while (w->focusProxy())
@@ -660,13 +593,11 @@ public:
             QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
                     q->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
             if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
-                QEvent event(QEvent::RequestSoftwareInputPanel);
-                QApplication::sendEvent(q, &event);
+                qApp->inputMethod()->show();
             }
         }
     }
 
-#ifndef Q_WS_QWS // Almost cross-platform :-)
     void setWSGeometry(bool dontShow=false, const QRect &oldRect = QRect());
 
     inline QPoint mapToWS(const QPoint &p) const
@@ -680,7 +611,6 @@ public:
 
     inline QRect mapFromWS(const QRect &r) const
     { QRect rr(r); rr.translate(data.wrect.topLeft()); return rr; }
-#endif
 
     // Variables.
     // Regular pointers (keep them together to avoid gaps on 64 bit architectures).
@@ -701,7 +631,6 @@ public:
     static QWidgetMapper *mapper;
     static QWidgetSet *allWidgets;
 #if !defined(QT_NO_IM)
-    QPointer<QInputContext> ic;
     Qt::InputMethodHints imHints;
 #endif
 #ifdef QT_KEYPAD_NAVIGATION
@@ -759,7 +688,6 @@ public:
     uint inDirtyList : 1;
     uint isScrolled : 1;
     uint isMoved : 1;
-    uint isGLWidget : 1;
     uint usesDoubleBufferedGLContext : 1;
 #ifndef QT_NO_IM
     uint inheritsInputMethodHints : 1;
@@ -768,7 +696,6 @@ public:
 
     // *************************** Platform specific ************************************
 #if defined(Q_WS_X11) // <----------------------------------------------------------- X11
-    QX11Info xinfo;
     Qt::HANDLE picture;
     static QWidget *mouseGrabber;
     static QWidget *keyboardGrabber;
@@ -837,15 +764,10 @@ public:
     void update_sys(const QRect &rect);
     void update_sys(const QRegion &rgn);
     void setGeometry_sys_helper(int, int, int, int, bool);
-    void setWindowModified_sys(bool b);
     void updateMaximizeButton_sys();
     void setWindowFilePath_sys(const QString &filePath);
     void createWindow_sys();
     void recreateMacWindow();
-#ifndef QT_MAC_USE_COCOA
-    void initWindowPtr();
-    void finishCreateWindow_sys_Carbon(OSWindowRef windowRef);
-#else
     void setSubWindowStacking(bool set);
     void setWindowLevel();
     void finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ windowRef);
@@ -866,7 +788,6 @@ public:
     QWidget *toolbar_ancestor;
     bool flushRequested;
     bool touchEventsEnabled;
-#endif // QT_MAC_USE_COCOA
     void determineWindowClass();
     void transferChildren();
     bool qt_mac_dnd_event(uint, DragRef);
@@ -879,21 +800,11 @@ public:
     static OSStatus qt_widget_event(EventHandlerCallRef er, EventRef event, void *);
     static bool qt_widget_rgn(QWidget *, short, RgnHandle, bool);
     void registerTouchWindow(bool enable = true);
-#elif defined(Q_WS_QPA) // <--------------------------------------------------------- QPA
+#endif
     void setMaxWindowState_helper();
     void setFullScreenSize_helper();
     bool stealKeyboardGrab(bool grab);
     bool stealMouseGrab(bool grab);
-#elif defined(Q_OS_SYMBIAN) // <--------------------------------------------------------- SYMBIAN
-    static QWidget *mouseGrabber;
-    static QWidget *keyboardGrabber;
-    int symbianScreenNumber; // only valid for desktop widget and top-levels
-    bool fixNativeOrientationCalled;
-    void s60UpdateIsOpaque();
-    void reparentChildren();
-    void registerTouchWindow();
-#endif
-
 };
 
 struct QWidgetPaintContext