libkdegames
kgamelcd.h
Go to the documentation of this file.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 <QtCore/QVector>
00024 #include <QtGui/QLCDNumber>
00025 #include <libkdegames_export.h>
00026
00027 class QLabel;
00028 class QTimer;
00029
00030
00040 class KDEGAMES_EXPORT KGameLCD : public QLCDNumber
00041 {
00042 Q_OBJECT
00043 public:
00044 explicit KGameLCD(uint nbDigits, QWidget *parent = 0);
00045
00046 ~KGameLCD();
00047
00051 void setDefaultBackgroundColor(const QColor &color);
00052
00056 void setDefaultColor(const QColor &color);
00057
00061 void setHighlightColor(const QColor &color);
00062
00067 void setLeadingString(const QString &s);
00068
00073 void setHighlightTime(uint time);
00074
00078 void resetColor();
00079
00083 void setColor(const QColor &color);
00084
00085 public Q_SLOTS:
00090 void highlight();
00091
00099 void displayInt(int value);
00100
00101 private Q_SLOTS:
00102 void timeout() { highlight(false); }
00103
00104 private:
00105 QColor _fgColor, _hlColor;
00106 QString _lead;
00107 uint _htime;
00108 QTimer *_timer;
00109
00110 class KGameLCDPrivate;
00111 KGameLCDPrivate *d;
00112
00113 void highlight(bool light);
00114
00115 };
00116
00117
00122 class KDEGAMES_EXPORT KGameLCDClock : public KGameLCD
00123 {
00124 Q_OBJECT
00125 public:
00126 KGameLCDClock(QWidget *parent = 0);
00127
00128 ~KGameLCDClock();
00129
00133 uint seconds() const;
00134
00138 QString pretty() const;
00139
00143 void setTime(uint seconds);
00144
00148 void setTime(const QString &s);
00149
00150 public Q_SLOTS:
00154 virtual void reset();
00155
00159 virtual void stop();
00160
00164 virtual void start();
00165
00166 protected Q_SLOTS:
00167 virtual void timeoutClock();
00168
00169 private:
00170 QTimer *_timerClock;
00171 uint _sec, _min;
00172
00173 class KGameLCDClockPrivate;
00174 KGameLCDClockPrivate *d;
00175
00176 void showTime();
00177 };
00178
00179
00184 class KDEGAMES_EXPORT KGameLCDList : public QWidget
00185 {
00186 Q_OBJECT
00187 public:
00194 explicit KGameLCDList(const QString &title,
00195 QWidget *parent = 0);
00201 KGameLCDList(QWidget *parent = 0);
00202
00203 ~KGameLCDList();
00204
00209 void append(QLCDNumber *lcd);
00210
00215 void append(const QString &leading, QLCDNumber *lcd);
00216
00220 void clear();
00221
00225 QLabel *title() const { return _title; }
00226
00230 QLCDNumber *lcd(uint i) const { return _lcds[i]; }
00231
00235 uint size() const { return _lcds.size(); }
00236
00237 private:
00238 QLabel *_title;
00239 QVector<QLCDNumber *> _lcds;
00240
00241 class KGameLCDListPrivate;
00242 KGameLCDListPrivate *d;
00243
00244 void init(const QString &title);
00245 };
00246
00247 #endif