• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libkdegames

kgamelcd.h

Go to the documentation of this file.
00001 /*
00002     This file is part of the KDE games library
00003     Copyright (C) 2001,2002,2003 Nicolas Hadacek (hadacek@kde.org)
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License version 2 as published by the Free Software Foundation.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
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

libkdegames

Skip menu "libkdegames"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • kblackbox
  • kgoldrunner
  • kmahjongg
  • ksquares
  • libkdegames
  •   highscore
  •   kgame
  •   kggzgames
  •   kggzmod
  •   kggznet
  • libkmahjongg
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal