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.29 2003/11/05 15:10:13 rdale Exp $ 00021 *************************************************************************/ 00022 00023 #ifndef _KLED_H_ 00024 #define _KLED_H_ 00025 00026 #include <qwidget.h> 00027 #include <kdemacros.h> 00028 00029 class QColor; 00045 class 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 00305 private: 00306 State led_state; 00307 QColor led_color; 00308 Look led_look; 00309 Shape led_shape; 00310 00311 protected: 00312 virtual void virtual_hook( int id, void* data ); 00313 private: 00314 class KLedPrivate; 00315 KLedPrivate *d; 00316 }; 00317 00318 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Aug 30 22:53:57 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003