1
/* This file is part of the KDE libraries
2
Copyright (C) 1997 Richard Moore (moorer@cs.man.ac.uk)
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
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.
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., 59 Temple Place - Suite 330,
17
Boston, MA 02111-1307, USA.
27
#include "ledlamp.moc"
29
LedLamp::LedLamp(QWidget *parent, Type t) : QFrame(parent),
30
w( 10 ), h( 7 ), dx( 4 )
32
// Make sure we're in a sane state
35
// Set the frame style
36
// setFrameStyle(Sunken | Box);
37
setGeometry(0,0,h+1,w+1);
42
LedLamp::drawContents(QPainter *painter)
46
QBrush lightBrush(this->foregroundColor());
47
QBrush darkBrush(this->backgroundColor());
49
QPen darkPen(this->backgroundColor(),1);
50
QPen lightPen(this->foregroundColor(), 1);
55
painter->setBrush(lightBrush);
59
painter->drawRect(1,1,w-3, h-2);
62
painter->setBrush(lightBrush);
63
painter->setPen(lightPen);
65
painter->drawLine(0, 2, 0, h-2); // |
66
painter->drawLine(1, 1, w-4, 1); // ~
67
painter->drawLine(w-3, 2, w-3, h-2); // |
68
painter->drawLine(2, h-2, w-3, h-2); //_
69
painter->drawLine(w-6,0,w-6,2); // ---+
70
painter->drawLine(3,h-2,3,h); // +---
76
painter->setBrush(darkBrush);
80
painter->drawRect(1,1,w-3, h-2);
83
painter->setBrush(darkBrush);
84
painter->setPen(darkPen);
86
painter->fillRect(0,0,w,h, darkBrush);
88
painter->drawLine(0, 2, 0, h-2); // |
89
painter->drawLine(1, 1, w-4, 1); // ~
90
painter->drawLine(w-3, 2, w-3, h-2); // |
91
painter->drawLine(2, h-2, w-3, h-2); //_
92
painter->drawLine(w-6,0,w-6,2); // ---+
93
painter->drawLine(3,h-2,3,h); // +---
100
fprintf(stderr, "LedLamp: INVALID State (%d)\n", s);