Qwt User's Guide: qwt_abstract_scale_draw.h Source File

Qwt User's Guide 6.0.1

- Main Page
- Related Pages
- Classes
- Files

- File List

# qwt_abstract_scale_draw.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 #ifndef QWT_ABSTRACT_SCALE_DRAW_H
    00011 #define QWT_ABSTRACT_SCALE_DRAW_H
    00012
    00013 #include "qwt_global.h"
    00014 #include "qwt_scale_div.h"
    00015 #include "qwt_text.h"
    00016
    00017 class QPalette;
    00018 class QPainter;
    00019 class QFont;
    00020 class QwtScaleTransformation;
    00021 class QwtScaleMap;
    00022
    00032 class QWT_EXPORT QwtAbstractScaleDraw
    00033 {
    00034 public:
    00035
    00040     enum ScaleComponent
    00041     {
    00043         Backbone = 0x01,
    00044
    00046         Ticks = 0x02,
    00047
    00049         Labels = 0x04
    00050     };
    00051
    00053     typedef QFlags<ScaleComponent> ScaleComponents;
    00054
    00055     QwtAbstractScaleDraw();
    00056     virtual ~QwtAbstractScaleDraw();
    00057
    00058     void setScaleDiv( const QwtScaleDiv &s );
    00059     const QwtScaleDiv& scaleDiv() const;
    00060
    00061     void setTransformation( QwtScaleTransformation * );
    00062     const QwtScaleMap &scaleMap() const;
    00063     QwtScaleMap &scaleMap();
    00064
    00065     void enableComponent( ScaleComponent, bool enable = true );
    00066     bool hasComponent( ScaleComponent ) const;
    00067
    00068     void setTickLength( QwtScaleDiv::TickType, double length );
    00069     double tickLength( QwtScaleDiv::TickType ) const;
    00070     double maxTickLength() const;
    00071
    00072     void setSpacing( double margin );
    00073     double spacing() const;
    00074
    00075     void setPenWidth( int width );
    00076     int penWidth() const;
    00077
    00078     virtual void draw( QPainter *, const QPalette & ) const;
    00079
    00080     virtual QwtText label( double ) const;
    00081
    00091     virtual double extent( const QFont & ) const = 0;
    00092
    00093     void setMinimumExtent( double );
    00094     double minimumExtent() const;
    00095
    00096 protected:
    00106     virtual void drawTick( QPainter *painter, double value, double len ) const = 0;
    00107
    00114     virtual void drawBackbone( QPainter *painter ) const = 0;
    00115
    00124     virtual void drawLabel( QPainter *painter, double value ) const = 0;
    00125
    00126     void invalidateCache();
    00127     const QwtText &tickLabel( const QFont &, double value ) const;
    00128
    00129 private:
    00130     QwtAbstractScaleDraw( const QwtAbstractScaleDraw & );
    00131     QwtAbstractScaleDraw &operator=( const QwtAbstractScaleDraw & );
    00132
    00133     class PrivateData;
    00134     PrivateData *d_data;
    00135 };
    00136
    00137 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtAbstractScaleDraw::ScaleComponents )
    00138
    00139 #endif