kgamelcd.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __KGAMELCD_H
00021 #define __KGAMELCD_H
00022
00023 #include <qlcdnumber.h>
00024 #include <qvaluevector.h>
00025 #include <kdemacros.h>
00026
00027 class QLabel;
00028 class QTimer;
00029
00030
00042 class KDE_EXPORT KGameLCD : public QLCDNumber
00043 {
00044 Q_OBJECT
00045 public:
00046 KGameLCD(uint nbDigits, QWidget *parent = 0, const char *name = 0);
00047
00048 ~KGameLCD();
00049
00053 void setDefaultBackgroundColor(const QColor &color);
00054
00058 void setDefaultColor(const QColor &color);
00059
00063 void setHighlightColor(const QColor &color);
00064
00069 void setLeadingString(const QString &s);
00070
00075 void setHighlightTime(uint time);
00076
00080 void resetColor();
00081
00085 void setColor(const QColor &color);
00086
00087 public slots:
00092 void highlight();
00093
00101 void displayInt(int value);
00102
00103 private slots:
00104 void timeout() { highlight(false); }
00105
00106 private:
00107 QColor _fgColor, _hlColor;
00108 QString _lead;
00109 uint _htime;
00110 QTimer *_timer;
00111
00112 class KGameLCDPrivate;
00113 KGameLCDPrivate *d;
00114
00115 void highlight(bool light);
00116
00117 };
00118
00119
00126 class KDE_EXPORT KGameLCDClock : public KGameLCD
00127 {
00128 Q_OBJECT
00129 public:
00130 KGameLCDClock(QWidget *parent = 0, const char *name = 0);
00131
00132 ~KGameLCDClock();
00133
00137 uint seconds() const;
00138
00142 QString pretty() const;
00143
00147 void setTime(uint seconds);
00148
00152 void setTime(const QString &s);
00153
00154 public slots:
00158 virtual void reset();
00159
00163 virtual void stop();
00164
00168 virtual void start();
00169
00170 protected slots:
00171 virtual void timeoutClock();
00172
00173 private:
00174 QTimer *_timerClock;
00175 uint _sec, _min;
00176
00177 class KGameLCDClockPrivate;
00178 KGameLCDClockPrivate *d;
00179
00180 void showTime();
00181 };
00182
00183
00190 class KDE_EXPORT KGameLCDList : public QWidget
00191 {
00192 Q_OBJECT
00193 public:
00201 KGameLCDList(const QString &title,
00202 QWidget *parent = 0, const char *name = 0);
00203 KGameLCDList(QWidget *parent = 0, const char *name = 0);
00204
00205 ~KGameLCDList();
00206
00211 void append(QLCDNumber *lcd);
00212
00217 void append(const QString &leading, QLCDNumber *lcd);
00218
00222 void clear();
00223
00227 QLabel *title() const { return _title; }
00228
00232 QLCDNumber *lcd(uint i) const { return _lcds[i]; }
00233
00237 uint size() const { return _lcds.size(); }
00238
00239 private:
00240 QLabel *_title;
00241 QValueVector<QLCDNumber *> _lcds;
00242
00243 class KGameLCDListPrivate;
00244 KGameLCDListPrivate *d;
00245
00246 void init(const QString &title);
00247 };
00248
00249 #endif
|