libkdegames
kgamelcd.h
00001
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 <tqlcdnumber.h>
00024 #include <tqvaluevector.h>
00025 #include <kdemacros.h>
00026
00027 class TQLabel;
00028 class TQTimer;
00029
00030
00042 class KDE_EXPORT KGameLCD : public QLCDNumber
00043 {
00044 Q_OBJECT
00045 public:
00046 KGameLCD(uint nbDigits, TQWidget *parent = 0, const char *name = 0);
00047
00048 ~KGameLCD();
00049
00053 void setDefaultBackgroundColor(const TQColor &color);
00054
00058 void setDefaultColor(const TQColor &color);
00059
00063 void setHighlightColor(const TQColor &color);
00064
00069 void setLeadingString(const TQString &s);
00070
00075 void setHighlightTime(uint time);
00076
00080 void resetColor();
00081
00085 void setColor(const TQColor &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 TQColor _fgColor, _hlColor;
00108 TQString _lead;
00109 uint _htime;
00110 TQTimer *_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(TQWidget *parent = 0, const char *name = 0);
00131
00132 ~KGameLCDClock();
00133
00137 uint seconds() const;
00138
00142 TQString pretty() const;
00143
00147 void setTime(uint seconds);
00148
00152 void setTime(const TQString &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 TQTimer *_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 TQString &title,
00202 TQWidget *parent = 0, const char *name = 0);
00203 KGameLCDList(TQWidget *parent = 0, const char *name = 0);
00204
00205 ~KGameLCDList();
00206
00211 void append(TQLCDNumber *lcd);
00212
00217 void append(const TQString &leading, TQLCDNumber *lcd);
00218
00222 void clear();
00223
00227 TQLabel *title() const { return _title; }
00228
00232 TQLCDNumber *lcd(uint i) const { return _lcds[i]; }
00233
00237 uint size() const { return _lcds.size(); }
00238
00239 private:
00240 TQLabel *_title;
00241 TQValueVector<TQLCDNumber *> _lcds;
00242
00243 class KGameLCDListPrivate;
00244 KGameLCDListPrivate *d;
00245
00246 void init(const TQString &title);
00247 };
00248
00249 #endif