qwt_abstract_scale_draw.h
/******************************************************************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_ABSTRACT_SCALE_DRAW_H
#define QWT_ABSTRACT_SCALE_DRAW_H
#include "qwt_global.h"
#include "qwt_scale_div.h"
class QwtText;
class QPalette;
class QPainter;
class QFont;
class QwtTransform;
class QwtScaleMap;
class QWT_EXPORT QwtAbstractScaleDraw
{
public:
enum ScaleComponent
{
Backbone = 0x01,
Ticks = 0x02,
Labels = 0x04
};
Q_DECLARE_FLAGS( ScaleComponents, ScaleComponent )
QwtAbstractScaleDraw();
virtual ~QwtAbstractScaleDraw();
void setScaleDiv( const QwtScaleDiv& );
const QwtScaleDiv& scaleDiv() const;
void setTransformation( QwtTransform* );
const QwtScaleMap& scaleMap() const;
QwtScaleMap& scaleMap();
void enableComponent( ScaleComponent, bool enable = true );
bool hasComponent( ScaleComponent ) const;
void setTickLength( QwtScaleDiv::TickType, double length );
double tickLength( QwtScaleDiv::TickType ) const;
double maxTickLength() const;
void setSpacing( double );
double spacing() const;
void setPenWidthF( qreal width );
qreal penWidthF() const;
virtual void draw( QPainter*, const QPalette& ) const;
virtual QwtText label( double ) const;
virtual double extent( const QFont& font ) const = 0;
void setMinimumExtent( double );
double minimumExtent() const;
void invalidateCache();
protected:
virtual void drawTick( QPainter* painter, double value, double len ) const = 0;
virtual void drawBackbone( QPainter* painter ) const = 0;
virtual void drawLabel( QPainter* painter, double value ) const = 0;
const QwtText& tickLabel( const QFont&, double value ) const;
private:
Q_DISABLE_COPY(QwtAbstractScaleDraw)
class PrivateData;
PrivateData* m_data;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtAbstractScaleDraw::ScaleComponents )
#endif
QwtAbstractScaleDraw
A abstract base class for drawing scales.
Definition: qwt_abstract_scale_draw.h:32
QwtAbstractScaleDraw::drawBackbone
virtual void drawBackbone(QPainter *painter) const =0
QwtAbstractScaleDraw::ScaleComponent
ScaleComponent
Definition: qwt_abstract_scale_draw.h:40
QwtAbstractScaleDraw::drawTick
virtual void drawTick(QPainter *painter, double value, double len) const =0
QwtAbstractScaleDraw::extent
virtual double extent(const QFont &font) const =0
QwtAbstractScaleDraw::drawLabel
virtual void drawLabel(QPainter *painter, double value) const =0
QwtAbstractScaleDraw::ScaleComponents
QFlags< ScaleComponent > ScaleComponents
Definition: qwt_abstract_scale_draw.h:51
QwtScaleDiv
A class representing a scale division.
Definition: qwt_scale_div.h:34
QwtScaleDiv::TickType
TickType
Scale tick types.
Definition: qwt_scale_div.h:38
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:27
QwtText
A class representing a text.
Definition: qwt_text.h:52
QwtTransform
A transformation between coordinate systems.
Definition: qwt_transform.h:36