src/gui/kernel/qwidget_p.h
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
child 18 2f34d5167611
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   228     CGImageRef imageMask;
   228     CGImageRef imageMask;
   229 #endif
   229 #endif
   230 #elif defined(Q_OS_SYMBIAN) // <----------------------------------------------------- Symbian
   230 #elif defined(Q_OS_SYMBIAN) // <----------------------------------------------------- Symbian
   231     uint activated : 1; // RWindowBase::Activated has been called
   231     uint activated : 1; // RWindowBase::Activated has been called
   232 
   232 
   233     // If set, QSymbianControl::Draw does not blit this widget
   233     /**
   234     // This is to allow, for use cases such as video, widgets which, from the Qt point
   234      * Defines the behaviour of QSymbianControl::Draw.
   235     // of view, are just placeholders in the scene.  For these widgets, any necessary
   235      */
   236     // drawing to the UI framebuffer is done by the relevant Symbian subsystem.  For
   236     enum NativePaintMode {
   237     // video rendering, this would be an MMF controller, or MDF post-processor.
   237         /**
   238     uint disableBlit : 1;
   238          * Normal drawing mode: blits the required region of the backing store
       
   239          * via WSERV.
       
   240          */
       
   241         Blit,
       
   242 
       
   243         /**
       
   244          * Disable drawing for this widget.
       
   245          */
       
   246         Disable,
       
   247 
       
   248         /**
       
   249          * Paint zeros into the WSERV framebuffer, using BitGDI APIs.  For windows
       
   250          * with an EColor16MU display mode, zero is written only into the R, G and B
       
   251          * channels of the pixel.
       
   252          */
       
   253         ZeroFill,
       
   254 
       
   255         Default = Blit
       
   256     };
       
   257 
       
   258     NativePaintMode nativePaintMode : 2;
       
   259 
       
   260     /**
       
   261      * If this bit is set, each native widget receives the signals from the
       
   262      * Symbian control immediately before and immediately after draw ops are
       
   263      * sent to the window server for this control:
       
   264      *      void beginNativePaintEvent(const QRect &paintRect);
       
   265      *      void endNativePaintEvent(const QRect &paintRect);
       
   266      */
       
   267     uint receiveNativePaintEvents : 1;
       
   268 
   239 #endif
   269 #endif
   240 };
   270 };
   241 
   271 
   242 /*!
   272 /*!
   243     \internal
   273     \internal
   382     void clipToEffectiveMask(QRegion &region) const;
   412     void clipToEffectiveMask(QRegion &region) const;
   383     void updateIsOpaque();
   413     void updateIsOpaque();
   384     void setOpaque(bool opaque);
   414     void setOpaque(bool opaque);
   385     void updateIsTranslucent();
   415     void updateIsTranslucent();
   386     bool paintOnScreen() const;
   416     bool paintOnScreen() const;
       
   417 #ifndef QT_NO_GRAPHICSEFFECT
   387     void invalidateGraphicsEffectsRecursively();
   418     void invalidateGraphicsEffectsRecursively();
   388 
   419 #endif //QT_NO_GRAPHICSEFFECT
   389     QRegion getOpaqueRegion() const;
   420 
   390     const QRegion &getOpaqueChildren() const;
   421     const QRegion &getOpaqueChildren() const;
   391     void setDirtyOpaqueRegion();
   422     void setDirtyOpaqueRegion();
   392 
   423 
   393     bool close_helper(CloseMode mode);
   424     bool close_helper(CloseMode mode);
   394 
   425 
   462     void getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const;
   493     void getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const;
   463     void setLayoutItemMargins(int left, int top, int right, int bottom);
   494     void setLayoutItemMargins(int left, int top, int right, int bottom);
   464     void setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt = 0);
   495     void setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt = 0);
   465 
   496 
   466     QInputContext *inputContext() const;
   497     QInputContext *inputContext() const;
       
   498     inline QWidget *effectiveFocusWidget() {
       
   499         QWidget *w = q_func();
       
   500         while (w->focusProxy())
       
   501             w = w->focusProxy();
       
   502         return w;
       
   503     }
   467 
   504 
   468     void setModal_sys();
   505     void setModal_sys();
   469 
   506 
   470     // This is an helper function that return the available geometry for
   507     // This is an helper function that return the available geometry for
   471     // a widget and takes care is this one is in QGraphicsView.
   508     // a widget and takes care is this one is in QGraphicsView.
   476         QRect screen;
   513         QRect screen;
   477 #ifndef QT_NO_GRAPHICSVIEW
   514 #ifndef QT_NO_GRAPHICSVIEW
   478         QGraphicsProxyWidget *ancestorProxy = widget->d_func()->nearestGraphicsProxyWidget(widget);
   515         QGraphicsProxyWidget *ancestorProxy = widget->d_func()->nearestGraphicsProxyWidget(widget);
   479         //It's embedded if it has an ancestor
   516         //It's embedded if it has an ancestor
   480         if (ancestorProxy) {
   517         if (ancestorProxy) {
   481             if (!bypassGraphicsProxyWidget(widget)) {
   518             if (!bypassGraphicsProxyWidget(widget) && ancestorProxy->scene() != 0) {
   482                 // One view, let be smart and return the viewport rect then the popup is aligned
   519                 // One view, let be smart and return the viewport rect then the popup is aligned
   483                 if (ancestorProxy->scene()->views().size() == 1) {
   520                 if (ancestorProxy->scene()->views().size() == 1) {
   484                     QGraphicsView *view = ancestorProxy->scene()->views().at(0);
   521                     QGraphicsView *view = ancestorProxy->scene()->views().at(0);
   485                     screen = view->mapToScene(view->viewport()->rect()).boundingRect().toRect();
   522                     screen = view->mapToScene(view->viewport()->rect()).boundingRect().toRect();
   486                 } else {
   523                 } else {
   529         return extra ? extra->nativeChildrenForced : false;
   566         return extra ? extra->nativeChildrenForced : false;
   530     }
   567     }
   531 
   568 
   532     inline QRect effectiveRectFor(const QRect &rect) const
   569     inline QRect effectiveRectFor(const QRect &rect) const
   533     {
   570     {
       
   571 #ifndef QT_NO_GRAPHICSEFFECT
   534         if (graphicsEffect && graphicsEffect->isEnabled())
   572         if (graphicsEffect && graphicsEffect->isEnabled())
   535             return graphicsEffect->boundingRectFor(rect).toAlignedRect();
   573             return graphicsEffect->boundingRectFor(rect).toAlignedRect();
       
   574 #endif //QT_NO_GRAPHICSEFFECT
   536         return rect;
   575         return rect;
   537     }
   576     }
   538 
   577 
   539     QSize adjustedSize() const;
   578     QSize adjustedSize() const;
   540 
   579 
   629     QLocale locale;
   668     QLocale locale;
   630     QPoint redirectOffset;
   669     QPoint redirectOffset;
   631 #ifndef QT_NO_ACTION
   670 #ifndef QT_NO_ACTION
   632     QList<QAction*> actions;
   671     QList<QAction*> actions;
   633 #endif
   672 #endif
   634     QMap<Qt::GestureType, Qt::GestureContext> gestureContext;
   673     QMap<Qt::GestureType, Qt::GestureFlags> gestureContext;
   635 
   674 
   636     // Bit fields.
   675     // Bit fields.
   637     uint high_attributes[3]; // the low ones are in QWidget::widget_attributes
   676     uint high_attributes[3]; // the low ones are in QWidget::widget_attributes
   638     QPalette::ColorRole fg_role : 8;
   677     QPalette::ColorRole fg_role : 8;
   639     QPalette::ColorRole bg_role : 8;
   678     QPalette::ColorRole bg_role : 8;
   773     QPainter *sharedPainter;
   812     QPainter *sharedPainter;
   774     QWidgetBackingStore *backingStore;
   813     QWidgetBackingStore *backingStore;
   775     QPainter *painter;
   814     QPainter *painter;
   776 };
   815 };
   777 
   816 
       
   817 #ifndef QT_NO_GRAPHICSEFFECT
   778 class QWidgetEffectSourcePrivate : public QGraphicsEffectSourcePrivate
   818 class QWidgetEffectSourcePrivate : public QGraphicsEffectSourcePrivate
   779 {
   819 {
   780 public:
   820 public:
   781     QWidgetEffectSourcePrivate(QWidget *widget)
   821     QWidgetEffectSourcePrivate(QWidget *widget)
   782         : QGraphicsEffectSourcePrivate(), m_widget(widget), context(0), updateDueToGraphicsEffect(false)
   822         : QGraphicsEffectSourcePrivate(), m_widget(widget), context(0), updateDueToGraphicsEffect(false)
   783     {}
   823     {}
   784 
   824 
   785     inline void detach()
   825     inline void detach()
   786     { m_widget->setGraphicsEffect(0); }
   826     { m_widget->d_func()->graphicsEffect = 0; }
   787 
   827 
   788     inline const QGraphicsItem *graphicsItem() const
   828     inline const QGraphicsItem *graphicsItem() const
   789     { return 0; }
   829     { return 0; }
   790 
   830 
   791     inline const QWidget *widget() const
   831     inline const QWidget *widget() const
   817     inline QRect deviceRect() const
   857     inline QRect deviceRect() const
   818     { return m_widget->window()->rect(); }
   858     { return m_widget->window()->rect(); }
   819 
   859 
   820     QRectF boundingRect(Qt::CoordinateSystem system) const;
   860     QRectF boundingRect(Qt::CoordinateSystem system) const;
   821     void draw(QPainter *p);
   861     void draw(QPainter *p);
   822     QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset) const;
   862     QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset,
       
   863                    QGraphicsEffect::PixmapPadMode mode) const;
   823 
   864 
   824     QWidget *m_widget;
   865     QWidget *m_widget;
   825     QWidgetPaintContext *context;
   866     QWidgetPaintContext *context;
   826     QTransform lastEffectTransform;
   867     QTransform lastEffectTransform;
   827     bool updateDueToGraphicsEffect;
   868     bool updateDueToGraphicsEffect;
   828 };
   869 };
       
   870 #endif //QT_NO_GRAPHICSEFFECT
   829 
   871 
   830 inline QWExtra *QWidgetPrivate::extraData() const
   872 inline QWExtra *QWidgetPrivate::extraData() const
   831 {
   873 {
   832     return extra;
   874     return extra;
   833 }
   875 }