# kdeui Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# 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.22 2002/05/21 15:58:49 porten Exp $
    00021  *************************************************************************/
    00022
    00023 #ifndef _KLED_H_
    00024 #define _KLED_H_
    00025
    00026 #include <qwidget.h>
    00027
    00028 class QColor;
    00041 class KLed : public QWidget
    00042 {
    00043     Q_OBJECT
    00044     Q_ENUMS( State Shape Look )
    00045     Q_PROPERTY( State state READ state WRITE setState )
    00046     Q_PROPERTY( Shape shape READ shape WRITE setShape )
    00047     Q_PROPERTY( Look look READ look WRITE setLook )
    00048     Q_PROPERTY( QColor color READ color WRITE setColor )
    00049     Q_PROPERTY( int darkFactor READ darkFactor WRITE setDarkFactor )
    00050
    00051 public:
    00052
    00057   enum State { Off, On };
    00058
    00063   enum Shape { Rectangular, Circular };
    00064
    00085   enum Look  { Flat, Raised, Sunken };
    00086
    00091   KLed(QWidget *parent=0, const char *name=0);
    00102   KLed(const QColor &col=Qt::green, QWidget *parent=0, const char *name=0);
    00103
    00117   KLed(const QColor& col, KLed::State st, KLed::Look look, KLed::Shape shape,
    00118        QWidget *parent=0, const char *name=0);
    00119
    00120
    00125   ~KLed();
    00126
    00133   State state() const;
    00134
    00135   Shape shape() const;
    00136
    00143   QColor color() const;
    00144
    00151   Look look() const;
    00152
    00159   int darkFactor() const;
    00160
    00170   void setState( State state );
    00171
    00175   void setShape(Shape s);
    00184   void toggleState();
    00185
    00199   void setColor(const QColor& color);
    00200
    00213   void setDarkFactor(int darkfactor);
    00214
    00245   void setLook( Look look );
    00246
    00247   virtual QSize sizeHint() const;
    00248   virtual QSize minimumSizeHint() const;
    00249
    00250 public slots:
    00251
    00257   void toggle();
    00258
    00265   void on();
    00266
    00273   void off();
    00274
    00275 protected:
    00279   virtual void paintFlat();
    00283   virtual void paintRound();
    00287   virtual void paintSunken();
    00291   virtual void paintRect();
    00296   virtual void paintRectFrame(bool raised);
    00300   void paintEvent( QPaintEvent * );
    00301
    00302 private:
    00303   State led_state;
    00304   QColor led_color;
    00305   Look  led_look;
    00306   Shape led_shape;
    00307
    00308 protected:
    00309   virtual void virtual_hook( int id, void* data );
    00310 private:
    00311   class KLedPrivate;
    00312   KLedPrivate *d;
    00313 };
    00314
    00315 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:57:02 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001