-rw-r--r-- | libopie2/opieui/oledbox.cpp | 58 | ||||
-rw-r--r-- | libopie2/opieui/oledbox.h | 95 | ||||
-rw-r--r-- | libopie2/opieui/opieui.pro | 6 |
3 files changed, 106 insertions, 53 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,10 +1,39 @@ - -#include <qbitmap.h> -#include <qpainter.h> +/* + This file is part of the Opie Project + =. (C) 2002-2005 the Opie Team <opie-devel@handhelds.org> + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ #include "oledbox.h" +/* QT */ +#include <qbitmap.h> +#include <qpainter.h> -#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC +namespace Opie { +namespace Ui { /* XPM */ @@ -42,7 +71,4 @@ static const char * ledborder_xpm[] = { QPixmap *OLedBox::s_border_pix = 0; -#endif - - OLedBox::OLedBox ( const QColor &col, QWidget *parent, const char *name ) : QWidget ( parent, name ) { @@ -55,8 +81,6 @@ OLedBox::OLedBox ( const QColor &col, QWidget *parent, const char *name ) : QWid setBackgroundMode ( PaletteBackground ); -#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC if ( !s_border_pix ) - s_border_pix = new QPixmap ( ledborder_xpm ); -#endif + s_border_pix = new QPixmap( ledborder_xpm ); } @@ -143,7 +167,5 @@ void OLedBox::paintEvent ( QPaintEvent *e ) } -// From KDE libkdeui / led.cpp - -void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNKEN led lamp +void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) { QPainter paint; @@ -222,9 +244,9 @@ void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNK // from the upper left. -#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC - paint. drawPixmap ( 0, 0, *s_border_pix ); - paint. end ( ); +#ifndef QT_CAN_DRAW_ARCS + paint.drawPixmap ( 0, 0, *s_border_pix ); + paint.end ( ); - pix-> setMask ( pix-> createHeuristicMask ( )); + pix->setMask ( pix-> createHeuristicMask ( )); #else @@ -276,2 +298,4 @@ void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNK } +}; +}; diff --git a/libopie2/opieui/oledbox.h b/libopie2/opieui/oledbox.h index dd930bd..c02cc77 100644 --- a/libopie2/opieui/oledbox.h +++ b/libopie2/opieui/oledbox.h @@ -1,5 +1,35 @@ -#ifndef __OPIE_OLED_H__ -#define __OPIE_OLED_H__ +/* + This file is part of the Opie Project + =. (C) 2002-2005 the Opie Team <opie-devel@handhelds.org> + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef OLEDBOX_H +#define OLEDBOX_H + +/* QT */ #include <qwidget.h> #include <qcolor.h> @@ -7,40 +37,40 @@ class QPixmap; -#define _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC +namespace Opie { +namespace Ui { -class OLedBox : public QWidget { - Q_OBJECT - -public: - OLedBox ( const QColor &col = red, QWidget *parent = 0, const char *name = 0 ); - virtual ~OLedBox ( ); +class OLedBox : public QWidget +{ + Q_OBJECT - QColor color ( ) const; - bool isOn ( ) const; - void setReadOnly( bool R ) - { m_readonly = R; } - inline bool readOnly( void ) const - { return m_readonly; } - - virtual QSize sizeHint ( ) const; + public: + OLedBox( const QColor& col = red, QWidget* parent = 0, const char* name = 0 ); + virtual ~OLedBox(); -public slots: - void toggle ( ); - void setOn ( bool on ); - void setColor ( const QColor &col ); + QColor color() const; + bool isOn() const; + void setReadOnly( bool R ) { m_readonly = R; } + bool readOnly( void ) const { return m_readonly; } + + virtual QSize sizeHint() const; + + public slots: + void toggle(); + void setOn( bool on ); + void setColor( const QColor& col ); -signals: - void toggled ( bool ); + signals: + void toggled( bool ); -protected: - virtual void paintEvent ( QPaintEvent *e ); - virtual void resizeEvent ( QResizeEvent *e ); + protected: + virtual void paintEvent( QPaintEvent* e ); + virtual void resizeEvent( QResizeEvent* e ); - virtual void mousePressEvent ( QMouseEvent *e ); + virtual void mousePressEvent( QMouseEvent* e ); -private: - void drawLed ( QPixmap *, const QColor &col ); + private: + void drawLed( QPixmap *, const QColor& col ); -private: + private: QPixmap *m_pix [2]; @@ -49,8 +79,7 @@ private: bool m_readonly; -#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC static QPixmap *s_border_pix; -#endif }; - +}; +}; #endif diff --git a/libopie2/opieui/opieui.pro b/libopie2/opieui/opieui.pro index 24157a1..ffa8b83 100644 --- a/libopie2/opieui/opieui.pro +++ b/libopie2/opieui/opieui.pro @@ -7,4 +7,5 @@ HEADERS = oclickablelabel.h \ oimageeffect.h \ okeyconfigwidget.h \ + oledbox.h \ olistview.h \ opixmapeffect.h \ @@ -16,5 +17,4 @@ HEADERS = oclickablelabel.h \ otabbar.h \ otabwidget.h \ - oledbox.h \ otaskbarapplet.h \ otimepicker.h \ @@ -28,4 +28,5 @@ SOURCES = oclickablelabel.cpp \ oimageeffect.cpp \ okeyconfigwidget.cpp \ + oledbox.cpp \ olistview.cpp \ opixmapeffect.cpp \ @@ -36,5 +37,4 @@ SOURCES = oclickablelabel.cpp \ otabbar.cpp \ otabwidget.cpp \ - oledbox.cpp \ otaskbarapplet.cpp \ otimepicker.cpp \ @@ -49,5 +49,5 @@ INTERFACES = otimepickerbase.ui TARGET = opieui2 -VERSION = 1.8.5 +VERSION = 1.9.0 INCLUDEPATH += $(OPIEDIR)/include |