Qwt User's Guide
|
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 00043 class QWT_EXPORT QwtAnalogClock: public QwtDial 00044 { 00045 Q_OBJECT 00046 00047 public: 00052 enum Hand 00053 { 00055 SecondHand, 00056 00058 MinuteHand, 00059 00061 HourHand, 00062 00064 NHands 00065 }; 00066 00067 explicit QwtAnalogClock( QWidget* parent = NULL ); 00068 virtual ~QwtAnalogClock(); 00069 00070 void setHand( Hand, QwtDialNeedle * ); 00071 00072 const QwtDialNeedle *hand( Hand ) const; 00073 QwtDialNeedle *hand( Hand ); 00074 00075 public Q_SLOTS: 00076 void setCurrentTime(); 00077 void setTime( const QTime & ); 00078 00079 protected: 00080 virtual void drawNeedle( QPainter *, const QPointF &, 00081 double radius, double direction, QPalette::ColorGroup ) const; 00082 00083 virtual void drawHand( QPainter *, Hand, const QPointF &, 00084 double radius, double direction, QPalette::ColorGroup ) const; 00085 00086 private: 00087 // use setHand instead 00088 void setNeedle( QwtDialNeedle * ); 00089 00090 QwtDialNeedle *d_hand[NHands]; 00091 }; 00092 00093 #endif