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 <qpalette.h>
00014 #include "qwt_global.h"
00015 
00016 class QPainter;
00017 
00021 class QWT_EXPORT QwtCompassRose
00022 {
00023 public:
00024     virtual ~QwtCompassRose() {};
00025 
00026     virtual void setPalette(const QPalette &p) { d_palette = p; }
00027     const QPalette &palette() const { return d_palette; }
00028 
00038     virtual void draw(QPainter *painter, const QPoint &center, 
00039         int radius, double north, 
00040         QPalette::ColorGroup colorGroup = QPalette::Active) const = 0;
00041 
00042 private:
00043     QPalette d_palette;
00044 };
00045 
00049 class QWT_EXPORT QwtSimpleCompassRose: public QwtCompassRose
00050 {
00051 public:
00052     QwtSimpleCompassRose(int numThorns = 8, int numThornLevels = -1);
00053 
00054     void setWidth(double w);
00055     double width() const { return d_width; }
00056 
00057     void setNumThorns(int count);
00058     int numThorns() const;
00059 
00060     void setNumThornLevels(int count);
00061     int numThornLevels() const;
00062 
00063     void setShrinkFactor(double factor) { d_shrinkFactor = factor; }
00064     double shrinkFactor() const { return d_shrinkFactor; }
00065 
00066     virtual void draw(QPainter *, const QPoint &center, int radius, 
00067         double north, QPalette::ColorGroup = QPalette::Active) const;
00068 
00069     static void drawRose(QPainter *, 
00070 #if QT_VERSION < 0x040000
00071         const QColorGroup &,
00072 #else
00073         const QPalette &,
00074 #endif
00075         const QPoint &center, int radius, double origin, double width, 
00076         int numThorns, int numThornLevels, double shrinkFactor);
00077 
00078 private:
00079     double d_width;     
00080     int d_numThorns;        
00081     int d_numThornLevels; 
00082     double d_shrinkFactor;
00083 };
00084 
00085 #endif // QWT_COMPASS_ROSE_H

Generated on Mon Feb 26 21:22:36 2007 for Qwt User's Guide by  doxygen 1.4.6