Qwt User's Guide svn
qwt_analog_clock.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_ANALOG_CLOCK_H
00011 #define QWT_ANALOG_CLOCK_H
00012 
00013 #include "qwt_global.h"
00014 #include "qwt_dial.h"
00015 #include "qwt_dial_needle.h"
00016 #include <qdatetime.h>
00017 
00045 class QWT_EXPORT QwtAnalogClock: public QwtDial
00046 {
00047     Q_OBJECT
00048 
00049 public:
00054     enum Hand
00055     {
00057         SecondHand,
00058 
00060         MinuteHand,
00061 
00063         HourHand,
00064 
00066         NHands
00067     };
00068 
00069     explicit QwtAnalogClock( QWidget* parent = NULL );
00070     virtual ~QwtAnalogClock();
00071 
00072     virtual void setHand( Hand, QwtDialNeedle * );
00073     const QwtDialNeedle *hand( Hand ) const;
00074     QwtDialNeedle *hand( Hand );
00075 
00076 public Q_SLOTS:
00077     void setCurrentTime();
00078     void setTime( const QTime & = QTime::currentTime() );
00079 
00080 protected:
00081     virtual QwtText scaleLabel( double ) const;
00082 
00083     virtual void drawNeedle( QPainter *, const QPointF &,
00084         double radius, double direction, QPalette::ColorGroup ) const;
00085 
00086     virtual void drawHand( QPainter *, Hand, const QPointF &,
00087         double radius, double direction, QPalette::ColorGroup ) const;
00088 
00089 private:
00090     virtual void setNeedle( QwtDialNeedle * );
00091     void initClock();
00092 
00093     QwtDialNeedle *d_hand[NHands];
00094 };
00095 
00096 #endif
qmi style