blob: f37dbc0bb62bfccb3e3dc89b10dd82e055dc2781 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
/***************************************************************************
qlcdstring.cpp - description
-------------------
begin : Sat Jul 21 2001
copyright : (C) 2001 by Michael
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qlcdstring.h"
#include <ntqpalette.h>
TQLCDString::TQLCDString( TQWidget *parent, const char *name ): TQWidget( parent, name )
{
digitStr= "";
options= TQLcd::alignCenter;
TQColorGroup g= colorGroup();
forColor= g.foreground();
shaColor= g.shadow();
}
TQLCDString::~TQLCDString(){
}
void TQLCDString::display( const TQString &str )
{
digitStr= str;
update();
}
void TQLCDString::setAlign(Align newAlign)
{
if( (options & TQLcd::alignMask)!=newAlign ) {
options= (options & ~TQLcd::alignMask ) | newAlign;
update();
}
}
const TQColor& TQLCDString::foreColor()
{
return forColor;
}
const TQColor& TQLCDString::shadowColor()
{
return shaColor;
}
void TQLCDString::setForeColor(const TQColor &fore)
{
forColor= fore;
update();
}
void TQLCDString::setShadowColor(const TQColor &sha)
{
shaColor= sha;
update();
}
void TQLCDString::resizeEvent ( TQResizeEvent *)
{
update();
}
void TQLCDString::setShadow(bool enable)
{
if( (bool)(options & TQLcd::drawShadow) != enable ) {
options^= TQLcd::drawShadow;
update();
}
}
void TQLCDString::setNumberDisplay(bool enable)
{
if( (bool)(options & TQLcd::drawNumber) != enable ) {
options^= TQLcd::drawNumber;
update();
}
}
void TQLCDString::paintEvent( TQPaintEvent *e )
{
TQPainter p(this);
TQLcd::draw(&p,0,0,width(),height(),digitStr.latin1(),options,&forColor,&shaColor);
}
#include "qlcdstring.moc"
|