You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
2.9 KiB
116 lines
2.9 KiB
15 years ago
|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
||
|
* Qwt Widget Library
|
||
|
* Copyright (C) 1997 Josef Wilgen
|
||
|
* Copyright (C) 2002 Uwe Rathmann
|
||
14 years ago
|
*
|
||
15 years ago
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the Qwt License, Version 1.0
|
||
|
*****************************************************************************/
|
||
|
|
||
|
// vim: expandtab
|
||
|
|
||
|
#ifndef QWT_PLOT_CANVAS_H
|
||
|
#define QWT_PLOT_CANVAS_H
|
||
|
|
||
|
#include <qframe.h>
|
||
|
#include <qpen.h>
|
||
|
#include "qwt_global.h"
|
||
|
|
||
|
class QwtPlot;
|
||
|
class QPixmap;
|
||
|
|
||
|
/*!
|
||
14 years ago
|
Canvas of a QwtPlot.
|
||
|
\sa QwtPlot
|
||
15 years ago
|
*/
|
||
|
class QWT_EXPORT QwtPlotCanvas : public QFrame
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
|
||
|
/*!
|
||
|
\brief Paint attributes
|
||
14 years ago
|
|
||
15 years ago
|
- PaintCached\n
|
||
14 years ago
|
Paint double buffered and reuse the content of the pixmap buffer
|
||
|
for some spontaneous repaints that happen when a plot gets unhidden,
|
||
15 years ago
|
deiconified or changes the focus.
|
||
|
Disabling the cache will improve the performance for
|
||
14 years ago
|
incremental paints (using QwtPlotCurve::draw).
|
||
15 years ago
|
|
||
|
- PaintPacked\n
|
||
14 years ago
|
Suppress system background repaints and paint it together with
|
||
15 years ago
|
the canvas contents.
|
||
|
Painting packed might avoid flickering for expensive repaints,
|
||
|
when there is a notable gap between painting the background
|
||
|
and the plot contents.
|
||
|
|
||
|
The default setting enables PaintCached and PaintPacked
|
||
|
|
||
|
\sa setPaintAttribute(), testPaintAttribute(), paintCache()
|
||
|
*/
|
||
14 years ago
|
enum PaintAttribute {
|
||
15 years ago
|
PaintCached = 1,
|
||
|
PaintPacked = 2
|
||
|
};
|
||
|
|
||
|
/*!
|
||
|
\brief Focus indicator
|
||
|
|
||
|
- NoFocusIndicator\n
|
||
|
Don't paint a focus indicator
|
||
|
|
||
|
- CanvasFocusIndicator\n
|
||
|
The focus is related to the complete canvas.
|
||
|
Paint the focus indicator using paintFocus()
|
||
|
|
||
|
- ItemFocusIndicator\n
|
||
|
The focus is related to an item (curve, point, ...) on
|
||
|
the canvas. It is up to the application to display a
|
||
|
focus indication using f.e. highlighting.
|
||
|
|
||
|
\sa setFocusIndicator(), focusIndicator(), paintFocus()
|
||
|
*/
|
||
|
|
||
14 years ago
|
enum FocusIndicator {
|
||
15 years ago
|
NoFocusIndicator,
|
||
|
CanvasFocusIndicator,
|
||
|
ItemFocusIndicator
|
||
|
};
|
||
|
|
||
|
explicit QwtPlotCanvas(QwtPlot *);
|
||
|
virtual ~QwtPlotCanvas();
|
||
|
|
||
|
QwtPlot *plot();
|
||
|
const QwtPlot *plot() const;
|
||
|
|
||
|
void setFocusIndicator(FocusIndicator);
|
||
|
FocusIndicator focusIndicator() const;
|
||
|
|
||
|
void setPaintAttribute(PaintAttribute, bool on = true);
|
||
|
bool testPaintAttribute(PaintAttribute) const;
|
||
|
|
||
|
QPixmap *paintCache();
|
||
|
const QPixmap *paintCache() const;
|
||
|
void invalidatePaintCache();
|
||
|
|
||
|
protected:
|
||
|
virtual void hideEvent(QHideEvent *);
|
||
|
|
||
|
virtual void paintEvent(QPaintEvent *);
|
||
|
|
||
|
virtual void drawContents(QPainter *);
|
||
|
virtual void drawFocusIndicator(QPainter *);
|
||
|
|
||
|
void drawCanvas(QPainter *painter = NULL);
|
||
|
|
||
14 years ago
|
private:
|
||
15 years ago
|
void setSystemBackground(bool);
|
||
|
|
||
|
class PrivateData;
|
||
|
PrivateData *d_data;
|
||
|
};
|
||
|
|
||
|
#endif
|