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., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
26 LedLamp::LedLamp(QWidget
*parent
, Type t
) : QFrame(parent
),
27 w( 10 ), h( 7 ), dx( 4 )
29 // Make sure we're in a sane state
32 // Set the frame style
33 // setFrameStyle(Sunken | Box);
34 //setGeometry(0,0,h+1,w+1);
39 LedLamp::drawContents(QPainter
*painter
)
41 //QBrush lightBrush(palette().color(foregroundRole()));
42 //QBrush darkBrush(palette().color(backgroundRole()));
44 //QPen darkPen(palette().color(backgroundRole()), 1);
45 //QPen lightPen(palette().color(foregroundRole()), 1);
47 QBrush
lightBrush(palette().color(backgroundRole()));
48 QBrush
darkBrush(palette().color(foregroundRole()));
50 QPen
darkPen(palette().color(foregroundRole()), 1);
51 QPen
lightPen(palette().color(backgroundRole()), 1);
55 painter
->setBrush(lightBrush
);
58 painter
->drawRect(1,1,w
-3, h
-2);
61 painter
->setBrush(lightBrush
);
62 painter
->setPen(lightPen
);
64 painter
->drawLine(0, 2, 0, h
-2); // |
65 painter
->drawLine(1, 1, w
-4, 1); // ~
66 painter
->drawLine(w
-3, 2, w
-3, h
-2); // |
67 painter
->drawLine(2, h
-2, w
-3, h
-2); //_
68 painter
->drawLine(w
-6,0,w
-6,2); // ---+
69 painter
->drawLine(3,h
-2,3,h
); // +---
74 painter
->setBrush(darkBrush
);
77 painter
->drawRect(1,1,w
-3, h
-2);
80 painter
->setBrush(darkBrush
);
81 painter
->setPen(darkPen
);
83 painter
->fillRect(0,0,w
,h
, darkBrush
);
85 painter->drawLine(0, 2, 0, h-2); // |
86 painter->drawLine(1, 1, w-4, 1); // ~
87 painter->drawLine(w-3, 2, w-3, h-2); // |
88 painter->drawLine(2, h-2, w-3, h-2); //_
89 painter->drawLine(w-6,0,w-6,2); // ---+
90 painter->drawLine(3,h-2,3,h); // +---
96 fprintf(stderr
, "LedLamp: INVALID State (%d)\n", s
);
100 #include "ledlamp.moc"