• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • libtdegames
 

libtdegames

  • libtdegames
kgamelcd.h
1 /*
2  This file is part of the TDE games library
3  Copyright (C) 2001,2002,2003 Nicolas Hadacek (hadacek@kde.org)
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef __KGAMELCD_H
21 #define __KGAMELCD_H
22 
23 #include <tqlcdnumber.h>
24 #include <tqvaluevector.h>
25 #include <tdemacros.h>
26 
27 class TQLabel;
28 class TQTimer;
29 
30 //-----------------------------------------------------------------------------
42 class TDE_EXPORT KGameLCD : public TQLCDNumber
43 {
44  TQ_OBJECT
45 
46 public:
47  KGameLCD(uint nbDigits, TQWidget *parent = 0, const char *name = 0);
48 
49  ~KGameLCD();
50 
54  void setDefaultBackgroundColor(const TQColor &color);
55 
59  void setDefaultColor(const TQColor &color);
60 
64  void setHighlightColor(const TQColor &color);
65 
70  void setLeadingString(const TQString &s);
71 
76  void setHighlightTime(uint time);
77 
81  void resetColor();
82 
86  void setColor(const TQColor &color);
87 
88 public slots:
93  void highlight();
94 
102  void displayInt(int value);
103 
104 private slots:
105  void timeout() { highlight(false); }
106 
107 private:
108  TQColor _fgColor, _hlColor;
109  TQString _lead;
110  uint _htime;
111  TQTimer *_timer;
112 
113  class KGameLCDPrivate;
114  KGameLCDPrivate *d;
115 
116  void highlight(bool light);
117 
118 };
119 
120 //-----------------------------------------------------------------------------
127 class TDE_EXPORT KGameLCDClock : public KGameLCD
128 {
129  TQ_OBJECT
130 
131 public:
132  KGameLCDClock(TQWidget *parent = 0, const char *name = 0);
133 
134  ~KGameLCDClock();
135 
139  uint seconds() const;
140 
144  TQString pretty() const;
145 
149  void setTime(uint seconds);
150 
154  void setTime(const TQString &s);
155 
156 public slots:
160  virtual void reset();
161 
165  virtual void stop();
166 
170  virtual void start();
171 
172 protected slots:
173  virtual void timeoutClock();
174 
175 private:
176  TQTimer *_timerClock;
177  uint _sec, _min;
178 
179  class KGameLCDClockPrivate;
180  KGameLCDClockPrivate *d;
181 
182  void showTime();
183 };
184 
185 //-----------------------------------------------------------------------------
192 class TDE_EXPORT KGameLCDList : public TQWidget
193 {
194  TQ_OBJECT
195 
196 public:
204  KGameLCDList(const TQString &title,
205  TQWidget *parent = 0, const char *name = 0);
206  KGameLCDList(TQWidget *parent = 0, const char *name = 0);
207 
208  ~KGameLCDList();
209 
214  void append(TQLCDNumber *lcd);
215 
220  void append(const TQString &leading, TQLCDNumber *lcd);
221 
225  void clear();
226 
230  TQLabel *title() const { return _title; }
231 
235  TQLCDNumber *lcd(uint i) const { return _lcds[i]; }
236 
240  uint size() const { return _lcds.size(); }
241 
242 private:
243  TQLabel *_title;
244  TQValueVector<TQLCDNumber *> _lcds;
245 
246  class KGameLCDListPrivate;
247  KGameLCDListPrivate *d;
248 
249  void init(const TQString &title);
250 };
251 
252 #endif
KGameLCDClock
This class is a digital clock widget.
Definition: kgamelcd.h:128
KGameLCDList
This widget holds a list of TQLCDNumber arranged in a vertical layout.
Definition: kgamelcd.h:193
KGameLCDList::lcd
TQLCDNumber * lcd(uint i) const
Definition: kgamelcd.h:235
KGameLCDList::size
uint size() const
Definition: kgamelcd.h:240
KGameLCDList::title
TQLabel * title() const
Definition: kgamelcd.h:230
KGameLCD
This class is a visually enhanced TQLCDNumber:
Definition: kgamelcd.h:43

libtdegames

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

libtdegames

Skip menu "libtdegames"
  • libtdegames
Generated for libtdegames by doxygen 1.9.1
This website is maintained by Timothy Pearson.