summaryrefslogtreecommitdiff
path: root/libopie2/opieui/oledbox.cpp
Unidiff
Diffstat (limited to 'libopie2/opieui/oledbox.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/oledbox.cpp58
1 files changed, 41 insertions, 17 deletions
diff --git a/libopie2/opieui/oledbox.cpp b/libopie2/opieui/oledbox.cpp
index 52826f1..d18d4b6 100644
--- a/libopie2/opieui/oledbox.cpp
+++ b/libopie2/opieui/oledbox.cpp
@@ -1,11 +1,40 @@
1 1/*
2#include <qbitmap.h> 2                 This file is part of the Opie Project
3#include <qpainter.h> 3 =. (C) 2002-2005 the Opie Team <opie-devel@handhelds.org>
4 .=l.
5           .>+-=
6 _;:,     .>    :=|. This program is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This program is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18..}^=.=       =       ; Library General Public License for more
19++=   -.     .`     .: details.
20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA.
27
28*/
4 29
5#include "oledbox.h" 30#include "oledbox.h"
6 31
32/* QT */
33#include <qbitmap.h>
34#include <qpainter.h>
7 35
8#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC 36namespace Opie {
37namespace Ui {
9 38
10/* XPM */ 39/* XPM */
11static const char * ledborder_xpm[] = { 40static const char * ledborder_xpm[] = {
@@ -41,9 +70,6 @@ static const char * ledborder_xpm[] = {
41 70
42QPixmap *OLedBox::s_border_pix = 0; 71QPixmap *OLedBox::s_border_pix = 0;
43 72
44#endif
45
46
47OLedBox::OLedBox ( const QColor &col, QWidget *parent, const char *name ) : QWidget ( parent, name ) 73OLedBox::OLedBox ( const QColor &col, QWidget *parent, const char *name ) : QWidget ( parent, name )
48{ 74{
49 m_color = col; 75 m_color = col;
@@ -54,10 +80,8 @@ OLedBox::OLedBox ( const QColor &col, QWidget *parent, const char *name ) : QWid
54 80
55 setBackgroundMode ( PaletteBackground ); 81 setBackgroundMode ( PaletteBackground );
56 82
57#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC
58 if ( !s_border_pix ) 83 if ( !s_border_pix )
59 s_border_pix = new QPixmap ( ledborder_xpm ); 84 s_border_pix = new QPixmap( ledborder_xpm );
60#endif
61} 85}
62 86
63OLedBox::~OLedBox ( ) 87OLedBox::~OLedBox ( )
@@ -142,9 +166,7 @@ void OLedBox::paintEvent ( QPaintEvent *e )
142 p. drawPixmap ( 0, 0, *m_pix [ ind ] ); 166 p. drawPixmap ( 0, 0, *m_pix [ ind ] );
143} 167}
144 168
145// From KDE libkdeui / led.cpp 169void OLedBox::drawLed ( QPixmap *pix, const QColor &col )
146
147void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNKEN led lamp
148{ 170{
149 QPainter paint; 171 QPainter paint;
150 QColor color; 172 QColor color;
@@ -221,11 +243,11 @@ void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNK
221 // around the LED which resembles a shadow with light coming 243 // around the LED which resembles a shadow with light coming
222 // from the upper left. 244 // from the upper left.
223 245
224#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC 246#ifndef QT_CAN_DRAW_ARCS
225 paint. drawPixmap ( 0, 0, *s_border_pix ); 247 paint.drawPixmap ( 0, 0, *s_border_pix );
226 paint. end ( ); 248 paint.end ( );
227 249
228 pix-> setMask ( pix-> createHeuristicMask ( )); 250 pix->setMask ( pix-> createHeuristicMask ( ));
229 251
230#else 252#else
231 pen.setWidth( 3 ); 253 pen.setWidth( 3 );
@@ -275,3 +297,5 @@ void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNK
275#endif 297#endif
276} 298}
277 299
300};
301};