# qwt_compass.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_COMPASS_H
    00011 #define QWT_COMPASS_H 1
    00012
    00013 #include <qstring.h>
    00014 #include <qmap.h>
    00015 #include "qwt_dial.h"
    00016
    00017 #if defined(QWT_TEMPLATEDLL)
    00018
    00019 #if defined(QT_NO_STL) || QT_VERSION < 0x040000 || QT_VERSION > 0x040001
    00020 /*
    00021   Unfortunately Qt 4.0.0/Qt 4.0.1 contains uncompilable
    00022   code in the STL adaptors of qmap.h. The declaration below
    00023   instantiates this code resulting in compiler errors.
    00024   If you really need the map to be exported, remove the condition above
    00025   and fix the qmap.h
    00026 */
    00027 // MOC_SKIP_BEGIN
    00028 template class QWT_EXPORT QMap<double, QString>;
    00029 // MOC_SKIP_END
    00030 #endif
    00031
    00032 #endif
    00033
    00034
    00035 class QwtCompassRose;
    00036
    00048 class QWT_EXPORT QwtCompass: public QwtDial
    00049 {
    00050     Q_OBJECT
    00051
    00052 public:
    00053     explicit QwtCompass( QWidget* parent = NULL);
    00054 #if QT_VERSION < 0x040000
    00055     explicit QwtCompass(QWidget* parent, const char *name);
    00056 #endif
    00057     virtual ~QwtCompass();
    00058
    00059     void setRose(QwtCompassRose *rose);
    00060     const QwtCompassRose *rose() const;
    00061     QwtCompassRose *rose();
    00062
    00063     const QMap<double, QString> &labelMap() const;
    00064     QMap<double, QString> &labelMap();
    00065     void setLabelMap(const QMap<double, QString> &map);
    00066
    00067 protected:
    00068     virtual QwtText scaleLabel(double value) const;
    00069
    00070     virtual void drawRose(QPainter *, const QPoint &center,
    00071         int radius, double north, QPalette::ColorGroup) const;
    00072
    00073     virtual void drawScaleContents(QPainter *,
    00074         const QPoint &center, int radius) const;
    00075
    00076     virtual void keyPressEvent(QKeyEvent *);
    00077
    00078 private:
    00079     void initCompass();
    00080
    00081     class PrivateData;
    00082     PrivateData *d_data;
    00083 };
    00084
    00085 #endif