kdeui Library API Documentation

kled.h

00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1998 Jörg Habenicht (j.habenicht@europemail.com) 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 /************************************************************************* 00020 * $Id: kled.h,v 1.32 2004/09/09 20:07:26 staniek Exp $ 00021 *************************************************************************/ 00022 00023 #ifndef _KLED_H_ 00024 #define _KLED_H_ 00025 00026 #include <qwidget.h> 00027 #include <kdelibs_export.h> 00028 00029 class QColor; 00045 class KDEUI_EXPORT KLed : public QWidget 00046 { 00047 Q_OBJECT 00048 Q_ENUMS( State Shape Look ) 00049 Q_PROPERTY( State state READ state WRITE setState ) 00050 Q_PROPERTY( Shape shape READ shape WRITE setShape ) 00051 Q_PROPERTY( Look look READ look WRITE setLook ) 00052 Q_PROPERTY( QColor color READ color WRITE setColor ) 00053 Q_PROPERTY( int darkFactor READ darkFactor WRITE setDarkFactor ) 00054 00055 public: 00056 00061 enum State { Off, On }; 00062 00067 enum Shape { Rectangular, Circular }; 00068 00089 enum Look { Flat, Raised, Sunken }; 00090 00095 KLed(QWidget *parent=0, const char *name=0); 00106 KLed(const QColor &col, QWidget *parent=0, const char *name=0); 00107 00122 KLed(const QColor& col, KLed::State state, KLed::Look look, KLed::Shape shape, 00123 QWidget *parent=0, const char *name=0); 00124 00125 00130 ~KLed(); 00131 00138 State state() const; 00139 00140 Shape shape() const; 00141 00148 QColor color() const; 00149 00156 Look look() const; 00157 00164 int darkFactor() const; 00165 00175 void setState( State state ); 00176 00180 void setShape(Shape s); 00189 void toggleState() KDE_DEPRECATED; 00190 00204 void setColor(const QColor& color); 00205 00218 void setDarkFactor(int darkfactor); 00219 00250 void setLook( Look look ); 00251 00252 virtual QSize sizeHint() const; 00253 virtual QSize minimumSizeHint() const; 00254 00255 public slots: 00256 00262 void toggle(); 00263 00270 void on(); 00271 00278 void off(); 00279 00280 protected: 00284 virtual void paintFlat(); 00288 virtual void paintRound(); 00292 virtual void paintSunken(); 00296 virtual void paintRect(); 00301 virtual void paintRectFrame(bool raised); 00302 00303 void paintEvent( QPaintEvent * ); 00304 00308 int ensureRoundLed(); 00309 00314 bool paintCachedPixmap(); 00315 00316 private: 00317 State led_state; 00318 QColor led_color; 00319 Look led_look; 00320 Shape led_shape; 00321 00322 protected: 00323 virtual void virtual_hook( int id, void* data ); 00324 private: 00325 class KLedPrivate; 00326 KLedPrivate *d; 00327 }; 00328 00329 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 14 00:10:12 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003