# qwt_paint_buffer.h

    00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
    00002  * Qwt Widget Library
    00003  * Copyright (C) 1997   Josef Wilgen
    00004  * Copyright (C) 2002   Uwe Rathmann
    00005  *
    00006  * This library is free software; you can redistribute it and/or
    00007  * modify it under the terms of the Qwt License, Version 1.0
    00008  *****************************************************************************/
    00009
    00010 #ifndef QWT_PAINT_BUFFER_H
    00011 #define QWT_PAINT_BUFFER_H 1
    00012
    00013 #include <qglobal.h>
    00014 #if QT_VERSION < 0x040000
    00015
    00016 #include <qpixmap.h>
    00017 #include "qwt_global.h"
    00018
    00019 class QPainter;
    00020
    00029 class QWT_EXPORT QwtPaintBuffer
    00030 {
    00031 public:
    00032     explicit QwtPaintBuffer();
    00033     explicit QwtPaintBuffer(QPaintDevice *, const QRect &, QPainter *p = NULL);
    00034
    00035     virtual ~QwtPaintBuffer();
    00036
    00037     void open(QPaintDevice *, const QRect &, QPainter *p = NULL);
    00038     void close();
    00039
    00040     QPainter *painter();
    00041     const QPaintDevice *device();
    00042
    00043     static void setEnabled(bool enable);
    00044     static bool isEnabled();
    00045
    00047     const QPixmap &buffer() const { return d_pixBuffer; }
    00048
    00049 protected:
    00050     void flush();
    00051
    00052 private:
    00053     QPixmap d_pixBuffer;
    00054     QRect d_rect;
    00055
    00056     QPaintDevice *d_device; // use QGuardedPtr
    00057     QPainter *d_painter; // use QGuardedPtr
    00058     QPainter *d_devicePainter; // use QGuardedPtr
    00059
    00060     static bool d_enabled;
    00061 };
    00062
    00063 #endif // QT_VERSION < 0x040000
    00064
    00065 #endif