Qwt User's Guide svn
qwt_compass_rose.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_ROSE_H
00011 #define QWT_COMPASS_ROSE_H 1
00012 
00013 #include "qwt_global.h"
00014 #include <qpalette.h>
00015 
00016 class QPainter;
00017 
00021 class QWT_EXPORT QwtCompassRose
00022 {
00023 public:
00025     virtual ~QwtCompassRose() {};
00026 
00028     virtual void setPalette( const QPalette &p )
00029     {
00030         d_palette = p;
00031     }
00032 
00034     const QPalette &palette() const
00035     {
00036         return d_palette;
00037     }
00038 
00048     virtual void draw( QPainter *painter, 
00049         const QPointF &center, double radius, double north,
00050         QPalette::ColorGroup colorGroup = QPalette::Active ) const = 0;
00051 
00052 private:
00053     QPalette d_palette;
00054 };
00055 
00059 class QWT_EXPORT QwtSimpleCompassRose: public QwtCompassRose
00060 {
00061 public:
00062     QwtSimpleCompassRose( int numThorns = 8, int numThornLevels = -1 );
00063     virtual ~QwtSimpleCompassRose();
00064 
00065     void setWidth( double w );
00066     double width() const;
00067 
00068     void setNumThorns( int count );
00069     int numThorns() const;
00070 
00071     void setNumThornLevels( int count );
00072     int numThornLevels() const;
00073 
00074     void setShrinkFactor( double factor );
00075     double shrinkFactor() const;
00076 
00077     virtual void draw( QPainter *, const QPointF &center, double radius,
00078         double north, QPalette::ColorGroup = QPalette::Active ) const;
00079 
00080     static void drawRose( QPainter *, const QPalette &,
00081         const QPointF &center, double radius, double origin, double width,
00082         int numThorns, int numThornLevels, double shrinkFactor );
00083 
00084 private:
00085     class PrivateData;
00086     PrivateData *d_data;
00087 };
00088 
00089 #endif 
qmi style