summaryrefslogtreecommitdiffstats
path: root/src/qlcdstring.cpp
blob: 114c9ddbf9ac8ceaf4dcf93faf6f6626869a6c16 (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
109
110
111
112
113
114
/***************************************************************************
                          qlcdstring.cpp  -  description
                             -------------------
    begin                : Sat Jul 21 2001
    copyright            : (C) 2001 by Michael
    email                : michaell@teleline.es
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 <qpalette.h>


QLCDString::QLCDString( QWidget *parent, const char *name ): QWidget( parent, name )
{
 digitStr= "";
 options= QLcd::alignCenter;

 QColorGroup g= colorGroup();
 forColor= g.foreground();
 shaColor= g.shadow();
}


QLCDString::~QLCDString(){
}

void QLCDString::display( const QString &str )
{
  digitStr= str;
  update();
}


void QLCDString::setAlign(Align newAlign)
{
 if( (options & QLcd::alignMask)!=newAlign ) {
   options= (options & ~QLcd::alignMask ) | newAlign;
   update();
 }
}

const QColor& QLCDString::foreColor()
{
 return forColor;
}

const QColor& QLCDString::shadowColor()
{
 return shaColor;
}


void QLCDString::setForeColor(const QColor &fore)
{
  forColor= fore;
  update();
}

void QLCDString::setShadowColor(const QColor &sha)
{
 shaColor= sha;
 update();
}


void QLCDString::resizeEvent ( QResizeEvent *)
{
 update();
}


void QLCDString::setShadow(bool enable)
{
 if( (bool)(options & QLcd::drawShadow) != enable ) {
   options^= QLcd::drawShadow;
   update();
 }
}


void QLCDString::setNumberDisplay(bool enable)
{
 if( (bool)(options & QLcd::drawNumber) != enable ) {
   options^= QLcd::drawNumber;
   update();
 }
}


void QLCDString::paintEvent( QPaintEvent *e )
{
QPainter p(this);

 QLcd::draw(&p,0,0,width(),height(),digitStr.latin1(),options,&forColor,&shaColor);
}