Qwt User's Guide: qwt_analog_clock.h Source File

- Main Page
- Classes
- Files
- Related Pages

# 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 <qdatetime.h>
    00014 #include "qwt_global.h"
    00015 #include "qwt_dial.h"
    00016 #include "qwt_dial_needle.h"
    00017
    00045 class QWT_EXPORT QwtAnalogClock: public QwtDial
    00046 {
    00047     Q_OBJECT
    00048
    00049 public:
    00055     enum Hand
    00056     {
    00057         SecondHand,
    00058         MinuteHand,
    00059         HourHand,
    00060
    00061         NHands
    00062     };
    00063
    00064     explicit QwtAnalogClock(QWidget* parent = NULL);
    00065 #if QT_VERSION < 0x040000
    00066     explicit QwtAnalogClock(QWidget* parent, const char *name);
    00067 #endif
    00068     virtual ~QwtAnalogClock();
    00069
    00070     virtual void setHand(Hand, QwtDialNeedle *);
    00071     const QwtDialNeedle *hand(Hand) const;
    00072     QwtDialNeedle *hand(Hand);
    00073
    00074 public slots:
    00075     void setCurrentTime();
    00076     void setTime(const QTime & = QTime::currentTime());
    00077
    00078 protected:
    00079     virtual QwtText scaleLabel(double) const;
    00080
    00081     virtual void drawNeedle(QPainter *, const QPoint &,
    00082         int radius, double direction, QPalette::ColorGroup) const;
    00083
    00084     virtual void drawHand(QPainter *, Hand, const QPoint &,
    00085         int radius, double direction, QPalette::ColorGroup) const;
    00086
    00087 private:
    00088     virtual void setNeedle(QwtDialNeedle *);
    00089     void initClock();
    00090
    00091     QwtDialNeedle *d_hand[NHands];
    00092 };
    00093
    00094 #endif