# qwt_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_SCALE_DRAW_H
    00011 #define QWT_SCALE_DRAW_H
    00012
    00013 #include <qpoint.h>
    00014 #include "qwt_global.h"
    00015 #include "qwt_abstract_scale_draw.h"
    00016
    00030 class QWT_EXPORT QwtScaleDraw: public QwtAbstractScaleDraw
    00031 {
    00032 public:
    00037     enum Alignment { BottomScale, TopScale, LeftScale, RightScale };
    00038
    00039     QwtScaleDraw();
    00040     QwtScaleDraw(const QwtScaleDraw &);
    00041
    00042     virtual ~QwtScaleDraw();
    00043
    00044     QwtScaleDraw &operator=(const QwtScaleDraw &other);
    00045
    00046     void getBorderDistHint(const QFont &, int &start, int &end) const;
    00047     int minLabelDist(const QFont &) const;
    00048
    00049     int minLength(const QPen &, const QFont &) const;
    00050     virtual int extent(const QPen &, const QFont &) const;
    00051
    00052     void move(int x, int y);
    00053     void move(const QPoint &);
    00054     void setLength(int length);
    00055
    00056     Alignment alignment() const;
    00057     void setAlignment(Alignment);
    00058
    00059     Qt::Orientation orientation() const;
    00060
    00061     QPoint pos() const;
    00062     int length() const;
    00063
    00064 #if QT_VERSION < 0x040000
    00065     void setLabelAlignment(int);
    00066     int labelAlignment() const;
    00067 #else
    00068     void setLabelAlignment(Qt::Alignment);
    00069     Qt::Alignment labelAlignment() const;
    00070 #endif
    00071
    00072     void setLabelRotation(double rotation);
    00073     double labelRotation() const;
    00074
    00075     int maxLabelHeight(const QFont &) const;
    00076     int maxLabelWidth(const QFont &) const;
    00077
    00078     QPoint labelPosition(double val) const;
    00079
    00080     QRect labelRect(const QFont &, double val) const;
    00081     QSize labelSize(const QFont &, double val) const;
    00082
    00083     QRect boundingLabelRect(const QFont &, double val) const;
    00084
    00085 protected:
    00086
    00087 #if QT_VERSION < 0x040000
    00088     QWMatrix labelMatrix(const QPoint &, const QSize &) const;
    00089 #else
    00090     QMatrix labelMatrix(const QPoint &, const QSize &) const;
    00091 #endif
    00092
    00093     virtual void drawTick(QPainter *p, double val, int len) const;
    00094     virtual void drawBackbone(QPainter *p) const;
    00095     virtual void drawLabel(QPainter *p, double val) const;
    00096
    00097 private:
    00098     void updateMap();
    00099
    00100     class PrivateData;
    00101     PrivateData *d_data;
    00102 };
    00103
    00104 inline void QwtScaleDraw::move(int x, int y)
    00105 {
    00106     move(QPoint(x, y));
    00107 }
    00108
    00109 #endif