00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
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
#include "qwt.h"
00019
00020
class QwtPlot;
00021
class QPixmap;
00022
00029 class QWT_EXPORT QwtPlotCanvas :
public QFrame
00030 {
00031 Q_OBJECT
00032
friend class QwtPlot;
00033
00034
public:
00051 enum FocusIndicator
00052 {
00053 NoFocusIndicator,
00054 CanvasFocusIndicator,
00055 ItemFocusIndicator
00056 };
00057
00058
void setFocusIndicator(FocusIndicator);
00059 FocusIndicator focusIndicator() const;
00060
00061
void setCacheMode(
bool on);
00062
bool cacheMode() const;
00063 const QPixmap *cache() const;
00064
void invalidateCache();
00065
00066 protected:
00067 QwtPlotCanvas(
QwtPlot *);
00068 virtual ~QwtPlotCanvas();
00069
00070 QPixmap *cache();
00071
00072 virtual
void frameChanged();
00073 virtual
void drawContents(QPainter *);
00074 virtual
void drawFocusIndicator(QPainter *, const QRect &);
00075
00076
void drawCanvas(QPainter *painter = NULL);
00077
00078 private:
00079 FocusIndicator d_focusIndicator;
00080
bool d_cacheMode;
00081 QPixmap *d_cache;
00082
00083 #ifndef QWT_NO_COMPAT
00084 public:
00085
void enableOutline(
bool tf);
00086
bool outlineEnabled() const;
00087
00088
void setOutlinePen(const QPen &p);
00089 const QPen& outlinePen() const;
00090
00091
void setOutlineStyle(Qwt::Shape os);
00092 Qwt::Shape outlineStyle() const;
00093
00094 signals:
00103
void mousePressed(const QMouseEvent &e);
00113
void mouseReleased(const QMouseEvent &e);
00122
void mouseMoved(const QMouseEvent &e);
00123
00124 protected:
00125 virtual
void mousePressEvent(QMouseEvent *);
00126 virtual
void mouseReleaseEvent(QMouseEvent *);
00127 virtual
void mouseMoveEvent(QMouseEvent *);
00128
00129 private:
00130
bool d_outlineEnabled;
00131
bool d_outlineActive;
00132
bool d_mousePressed;
00133
00134
void drawOutline(QPainter &p);
00135
00136 Qwt::Shape d_outline;
00137 QPen d_pen;
00138 QPoint d_entryPoint;
00139 QPoint d_lastPoint;
00140 #else
00141 private:
00142
00143
void mousePressed(const QMouseEvent &);
00144
void mouseReleased(const QMouseEvent &);
00145
void mouseMoved(const QMouseEvent &);
00146 #endif
00147
00148 };
00149
00150 #endif
00151
00152
00153
00154
00155
00156