00001 
00002 
00003 
00004 
00005 
00006 
00007 
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; 
00057     QPainter *d_painter; 
00058     QPainter *d_devicePainter; 
00059 
00060     static bool d_enabled;
00061 };
00062 
00063 #endif // QT_VERSION < 0x040000
00064 
00065 #endif