• 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
27class TQLabel;
28class TQTimer;
29
30//-----------------------------------------------------------------------------
42class TDE_EXPORT KGameLCD : public TQLCDNumber
43{
44 TQ_OBJECT
45
46public:
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
88public slots:
93 void highlight();
94
102 void displayInt(int value);
103
104private slots:
105 void timeout() { highlight(false); }
106
107private:
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//-----------------------------------------------------------------------------
127class TDE_EXPORT KGameLCDClock : public KGameLCD
128{
129 TQ_OBJECT
130
131public:
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
156public slots:
160 virtual void reset();
161
165 virtual void stop();
166
170 virtual void start();
171
172protected slots:
173 virtual void timeoutClock();
174
175private:
176 TQTimer *_timerClock;
177 uint _sec, _min;
178
179 class KGameLCDClockPrivate;
180 KGameLCDClockPrivate *d;
181
182 void showTime();
183};
184
185//-----------------------------------------------------------------------------
192class TDE_EXPORT KGameLCDList : public TQWidget
193{
194 TQ_OBJECT
195
196public:
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
242private:
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::seconds
uint seconds() const
Definition kgamelcd.cpp:165
KGameLCDClock::setTime
void setTime(uint seconds)
Set the time.
Definition kgamelcd.cpp:170
KGameLCDClock::stop
virtual void stop()
Stop the clock but do not reset it to zero.
Definition kgamelcd.cpp:160
KGameLCDClock::start
virtual void start()
Start the clock from the current time.
Definition kgamelcd.cpp:155
KGameLCDClock::pretty
TQString pretty() const
Definition kgamelcd.cpp:135
KGameLCDClock::reset
virtual void reset()
Stop the clock and reset it to zero.
Definition kgamelcd.cpp:147
KGameLCDList::size
uint size() const
Definition kgamelcd.h:240
KGameLCDList::KGameLCDList
KGameLCDList(const TQString &title, TQWidget *parent=0, const char *name=0)
Constructor.
Definition kgamelcd.cpp:194
KGameLCDList::lcd
TQLCDNumber * lcd(uint i) const
Definition kgamelcd.h:235
KGameLCDList::clear
void clear()
Delete all TQLCDNumber and clear the list.
Definition kgamelcd.cpp:242
KGameLCDList::append
void append(TQLCDNumber *lcd)
Append a TQLCDNumber at the bottom of the list.
Definition kgamelcd.cpp:224
KGameLCDList::title
TQLabel * title() const
Definition kgamelcd.h:230
KGameLCD::setHighlightTime
void setHighlightTime(uint time)
Set the highlight duration in milliseconds.
Definition kgamelcd.cpp:76
KGameLCD::setDefaultBackgroundColor
void setDefaultBackgroundColor(const TQColor &color)
Set the default background color.
Definition kgamelcd.cpp:50
KGameLCD::setColor
void setColor(const TQColor &color)
Set the foreground color.
Definition kgamelcd.cpp:86
KGameLCD::setDefaultColor
void setDefaultColor(const TQColor &color)
Set the default foreground color.
Definition kgamelcd.cpp:57
KGameLCD::setLeadingString
void setLeadingString(const TQString &s)
Set the string that will be displayed before the integer number to be displayed.
Definition kgamelcd.cpp:70
KGameLCD::resetColor
void resetColor()
Reset the foreground color to the default one.
Definition kgamelcd.cpp:81
KGameLCD::highlight
void highlight()
Highlight the LCD with the TQColorGourp::HighlightedText color for a small time (setHighlightTime).
Definition kgamelcd.cpp:100
KGameLCD::displayInt
void displayInt(int value)
Display the given integer with the (optionnal) leading string.
Definition kgamelcd.cpp:94
KGameLCD::setHighlightColor
void setHighlightColor(const TQColor &color)
Set highlight color.
Definition kgamelcd.cpp:65

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.15.0
This website is maintained by Timothy Pearson.