00001 /*-*- c++ -*-****************************************************************** 00002 * Qwt Widget Library 00003 * Copyright (C) 1997 Josef Wilgen 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 *****************************************************************************/ 00019 00020 #ifndef QWT_PAINT_BUFFER_H 00021 #define QWT_PAINT_BUFFER_H 1 00022 00023 #include <qpixmap.h> 00024 //#include "qwt_global.h" 00025 00026 class QPainter; 00027 00028 namespace hippodraw { 00029 00038 class QwtPaintBuffer 00039 { 00040 public: 00041 QwtPaintBuffer(); 00042 QwtPaintBuffer(QPaintDevice *, const QRect &, QPainter *painter = NULL); 00043 00044 virtual ~QwtPaintBuffer(); 00045 00046 void open(QPaintDevice *, const QRect &, QPainter *painter = NULL); 00047 void close(); 00048 00049 QPainter *painter(); 00050 const QPaintDevice *device(); 00051 00052 static void setEnabled(bool enable); 00053 static bool isEnabled(); 00054 00055 protected: 00056 void flush(); 00057 00058 private: 00059 QPixmap d_pixBuffer; 00060 QRect d_rect; 00061 00062 QPaintDevice *d_device; // use QGuardedPtr 00063 QPainter *d_painter; // use QGuardedPtr 00064 QPainter *d_devicePainter; // use QGuardedPtr 00065 00066 static bool d_enabled; 00067 }; 00068 00069 } // namespace hippodraw 00070 00071 #endif