# qwt_plot_canvas.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 // vim: expandtab
    00011
    00012 #ifndef QWT_PLOT_CANVAS_H
    00013 #define QWT_PLOT_CANVAS_H
    00014
    00015 #include <qframe.h>
    00016 #include <qpen.h>
    00017 #include "qwt_global.h"
    00018
    00019 class QwtPlot;
    00020 class QPixmap;
    00021
    00026 class QWT_EXPORT QwtPlotCanvas : public QFrame
    00027 {
    00028     Q_OBJECT
    00029
    00030 public:
    00031
    00053     enum PaintAttribute
    00054     {
    00055         PaintCached = 1,
    00056         PaintPacked = 2
    00057     };
    00058
    00077     enum FocusIndicator
    00078     {
    00079         NoFocusIndicator,
    00080         CanvasFocusIndicator,
    00081         ItemFocusIndicator
    00082     };
    00083
    00084     explicit QwtPlotCanvas(QwtPlot *);
    00085     virtual ~QwtPlotCanvas();
    00086
    00087     QwtPlot *plot();
    00088     const QwtPlot *plot() const;
    00089
    00090     void setFocusIndicator(FocusIndicator);
    00091     FocusIndicator focusIndicator() const;
    00092
    00093     void setPaintAttribute(PaintAttribute, bool on = true);
    00094     bool testPaintAttribute(PaintAttribute) const;
    00095
    00096     QPixmap *paintCache();
    00097     const QPixmap *paintCache() const;
    00098     void invalidatePaintCache();
    00099
    00100 protected:
    00101     virtual void hideEvent(QHideEvent *);
    00102
    00103     virtual void paintEvent(QPaintEvent *);
    00104
    00105     virtual void drawContents(QPainter *);
    00106     virtual void drawFocusIndicator(QPainter *);
    00107
    00108     void drawCanvas(QPainter *painter = NULL);
    00109
    00110 private:
    00111     void setSystemBackground(bool);
    00112
    00113     class PrivateData;
    00114     PrivateData *d_data;
    00115 };
    00116
    00117 #endif