108 class QGraphicsProxyWidget; |
108 class QGraphicsProxyWidget; |
109 class QWidgetItemV2; |
109 class QWidgetItemV2; |
110 |
110 |
111 class QStyle; |
111 class QStyle; |
112 |
112 |
|
113 class Q_AUTOTEST_EXPORT QRefCountedWidgetBackingStore |
|
114 { |
|
115 |
|
116 public: |
|
117 QRefCountedWidgetBackingStore(); |
|
118 ~QRefCountedWidgetBackingStore(); |
|
119 |
|
120 void create(QWidget *tlw); |
|
121 void destroy(); |
|
122 |
|
123 void widgetShown(QWidget *w); |
|
124 void widgetHidden(QWidget *w); |
|
125 |
|
126 inline QWidgetBackingStore* data() |
|
127 { |
|
128 return m_ptr; |
|
129 } |
|
130 |
|
131 inline QWidgetBackingStore* operator->() |
|
132 { |
|
133 return m_ptr; |
|
134 } |
|
135 |
|
136 inline QWidgetBackingStore& operator*() |
|
137 { |
|
138 return *m_ptr; |
|
139 } |
|
140 |
|
141 inline operator bool() const |
|
142 { |
|
143 return (0 != m_ptr); |
|
144 } |
|
145 |
|
146 private: |
|
147 Q_DISABLE_COPY(QRefCountedWidgetBackingStore) |
|
148 |
|
149 private: |
|
150 QWidgetBackingStore* m_ptr; |
|
151 QSet<QWidget *> m_visibleWidgets; |
|
152 }; |
|
153 |
113 struct QTLWExtra { |
154 struct QTLWExtra { |
114 // *************************** Cross-platform variables ***************************** |
155 // *************************** Cross-platform variables ***************************** |
115 |
156 |
116 // Regular pointers (keep them together to avoid gaps on 64 bits architectures). |
157 // Regular pointers (keep them together to avoid gaps on 64 bits architectures). |
117 QIcon *icon; // widget icon |
158 QIcon *icon; // widget icon |
118 QPixmap *iconPixmap; |
159 QPixmap *iconPixmap; |
119 QWidgetBackingStore *backingStore; |
160 QRefCountedWidgetBackingStore backingStore; |
120 QWindowSurface *windowSurface; |
161 QWindowSurface *windowSurface; |
121 QPainter *sharedPainter; |
162 QPainter *sharedPainter; |
122 |
163 |
123 // Implicit pointers (shared_null). |
164 // Implicit pointers (shared_null). |
124 QString caption; // widget caption |
165 QString caption; // widget caption |
500 void setWindowFilePath_helper(const QString &filePath); |
541 void setWindowFilePath_helper(const QString &filePath); |
501 |
542 |
502 bool setMinimumSize_helper(int &minw, int &minh); |
543 bool setMinimumSize_helper(int &minw, int &minh); |
503 bool setMaximumSize_helper(int &maxw, int &maxh); |
544 bool setMaximumSize_helper(int &maxw, int &maxh); |
504 void setConstraints_sys(); |
545 void setConstraints_sys(); |
|
546 bool pointInsideRectAndMask(const QPoint &) const; |
505 QWidget *childAt_helper(const QPoint &, bool) const; |
547 QWidget *childAt_helper(const QPoint &, bool) const; |
|
548 QWidget *childAtRecursiveHelper(const QPoint &p, bool, bool includeFrame = false) const; |
506 void updateGeometry_helper(bool forceUpdate); |
549 void updateGeometry_helper(bool forceUpdate); |
507 |
550 |
508 void getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const; |
551 void getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const; |
509 void setLayoutItemMargins(int left, int top, int right, int bottom); |
552 void setLayoutItemMargins(int left, int top, int right, int bottom); |
510 void setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt = 0); |
553 void setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt = 0); |
|
554 |
|
555 // aboutToDestroy() is called just before the contents of |
|
556 // QWidget::destroy() is executed. It's used to signal QWidget |
|
557 // sub-classes that their internals are about to be released. |
|
558 virtual void aboutToDestroy() {} |
511 |
559 |
512 QInputContext *inputContext() const; |
560 QInputContext *inputContext() const; |
513 inline QWidget *effectiveFocusWidget() { |
561 inline QWidget *effectiveFocusWidget() { |
514 QWidget *w = q_func(); |
562 QWidget *w = q_func(); |
515 while (w->focusProxy()) |
563 while (w->focusProxy()) |
683 QLocale locale; |
731 QLocale locale; |
684 QPoint redirectOffset; |
732 QPoint redirectOffset; |
685 #ifndef QT_NO_ACTION |
733 #ifndef QT_NO_ACTION |
686 QList<QAction*> actions; |
734 QList<QAction*> actions; |
687 #endif |
735 #endif |
|
736 #ifndef QT_NO_GESTURES |
688 QMap<Qt::GestureType, Qt::GestureFlags> gestureContext; |
737 QMap<Qt::GestureType, Qt::GestureFlags> gestureContext; |
|
738 #endif |
689 |
739 |
690 // Bit fields. |
740 // Bit fields. |
691 uint high_attributes[4]; // the low ones are in QWidget::widget_attributes |
741 uint high_attributes[4]; // the low ones are in QWidget::widget_attributes |
692 QPalette::ColorRole fg_role : 8; |
742 QPalette::ColorRole fg_role : 8; |
693 QPalette::ColorRole bg_role : 8; |
743 QPalette::ColorRole bg_role : 8; |
712 void x11UpdateIsOpaque(); |
762 void x11UpdateIsOpaque(); |
713 bool isBackgroundInherited() const; |
763 bool isBackgroundInherited() const; |
714 void updateX11AcceptFocus(); |
764 void updateX11AcceptFocus(); |
715 #elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN |
765 #elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN |
716 uint noPaintOnScreen : 1; // see qwidget_win.cpp ::paintEngine() |
766 uint noPaintOnScreen : 1; // see qwidget_win.cpp ::paintEngine() |
|
767 #ifndef QT_NO_GESTURES |
717 uint nativeGesturePanEnabled : 1; |
768 uint nativeGesturePanEnabled : 1; |
718 |
769 #endif |
719 bool shouldShowMaximizeButton(); |
770 bool shouldShowMaximizeButton(); |
720 void winUpdateIsOpaque(); |
771 void winUpdateIsOpaque(); |
721 void reparentChildren(); |
772 void reparentChildren(); |
722 #ifndef QT_NO_DRAGANDDROP |
773 #ifndef QT_NO_DRAGANDDROP |
723 QOleDropTarget *registerOleDnd(QWidget *widget); |
774 QOleDropTarget *registerOleDnd(QWidget *widget); |
923 Q_Q(QWidget); |
974 Q_Q(QWidget); |
924 QTLWExtra *x = q->window()->d_func()->topData(); |
975 QTLWExtra *x = q->window()->d_func()->topData(); |
925 x->sharedPainter = painter; |
976 x->sharedPainter = painter; |
926 } |
977 } |
927 |
978 |
|
979 inline bool QWidgetPrivate::pointInsideRectAndMask(const QPoint &p) const |
|
980 { |
|
981 Q_Q(const QWidget); |
|
982 return q->rect().contains(p) && (!extra || !extra->hasMask || q->testAttribute(Qt::WA_MouseNoMask) |
|
983 || extra->mask.contains(p)); |
|
984 } |
|
985 |
928 inline QWidgetBackingStore *QWidgetPrivate::maybeBackingStore() const |
986 inline QWidgetBackingStore *QWidgetPrivate::maybeBackingStore() const |
929 { |
987 { |
930 Q_Q(const QWidget); |
988 Q_Q(const QWidget); |
931 QTLWExtra *x = q->window()->d_func()->maybeTopData(); |
989 QTLWExtra *x = q->window()->d_func()->maybeTopData(); |
932 return x ? x->backingStore : 0; |
990 return x ? x->backingStore.data() : 0; |
933 } |
991 } |
934 |
992 |
935 QT_END_NAMESPACE |
993 QT_END_NAMESPACE |
936 |
994 |
937 #endif // QWIDGET_P_H |
995 #endif // QWIDGET_P_H |