summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qwindowsurface_p.h
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-03-29 09:09:39 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-03-29 09:09:39 (GMT)
commita73af692412630e9a25ae1ddb403413f3d8a1de6 (patch)
tree21ba754816f65e1f6077060483ad6dc60a43154c /src/gui/painting/qwindowsurface_p.h
parent269b61dd08b7e37445f40e3a1d0854bcf85f445b (diff)
downloadQt-a73af692412630e9a25ae1ddb403413f3d8a1de6.zip
Qt-a73af692412630e9a25ae1ddb403413f3d8a1de6.tar.gz
Qt-a73af692412630e9a25ae1ddb403413f3d8a1de6.tar.bz2
Added WindowSurfaceFeature enum to QWindowSurface.
Now that we've added hasPreservedContents() it's cleaner to convert the various features to feature flags, which is also more extensible in case more flags are needed in the future. Reviewed-by: Bjørn Erik Nilsen
Diffstat (limited to 'src/gui/painting/qwindowsurface_p.h')
-rw-r--r--src/gui/painting/qwindowsurface_p.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h
index 95b2ee4..a3fea67 100644
--- a/src/gui/painting/qwindowsurface_p.h
+++ b/src/gui/painting/qwindowsurface_p.h
@@ -68,6 +68,14 @@ class QPlatformWindow;
class Q_GUI_EXPORT QWindowSurface
{
public:
+ enum WindowSurfaceFeature {
+ PartialUpdates = 0x00000001, // Supports doing partial updates.
+ PreservedContents = 0x00000002, // Supports doing flush without first doing a repaint.
+ StaticContents = 0x00000004, // Supports having static content regions when being resized.
+ AllFeatures = 0xffffffff // For convenience
+ };
+ Q_DECLARE_FLAGS(WindowSurfaceFeatures, WindowSurfaceFeature)
+
QWindowSurface(QWidget *window, bool setDefaultSurface = true);
virtual ~QWindowSurface();
@@ -100,9 +108,8 @@ public:
virtual QPoint offset(const QWidget *widget) const;
inline QRect rect(const QWidget *widget) const;
- virtual bool hasStaticContentsSupport() const;
- virtual bool hasPartialUpdateSupport() const;
- virtual bool hasPreservedContents() const;
+ bool hasFeature(WindowSurfaceFeature feature) const;
+ virtual WindowSurfaceFeatures features() const;
void setStaticContents(const QRegion &region);
QRegion staticContents() const;
@@ -114,11 +121,18 @@ private:
QWindowSurfacePrivate *d_ptr;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QWindowSurface::WindowSurfaceFeatures)
+
inline QRect QWindowSurface::rect(const QWidget *widget) const
{
return widget->rect().translated(offset(widget));
}
+inline bool QWindowSurface::hasFeature(WindowSurfaceFeature feature) const
+{
+ return (features() & feature) != 0;
+}
+
QT_END_NAMESPACE
#endif // QWINDOWSURFACE_P_H