kled.h
/* This file is part of the KDE libraries
Copyright (C) 1998 Jörg Habenicht (j.habenicht@europemail.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/*************************************************************************
* $Id: kled.h 465272 2005-09-29 09:47:40Z mueller $
*************************************************************************/
#ifndef _KLED_H_
#define _KLED_H_
#include <qwidget.h>
#include <kdelibs_export.h>
class QColor;
class KDEUI_EXPORT KLed : public QWidget
{
Q_OBJECT
Q_ENUMS( State Shape Look )
Q_PROPERTY( State state READ state WRITE setState )
Q_PROPERTY( Shape shape READ shape WRITE setShape )
Q_PROPERTY( Look look READ look WRITE setLook )
Q_PROPERTY( QColor color READ color WRITE setColor )
Q_PROPERTY( int darkFactor READ darkFactor WRITE setDarkFactor )
public:
enum State { Off, On };
enum Shape { Rectangular, Circular };
enum Look { Flat, Raised, Sunken };
KLed(QWidget *parent=0, const char *name=0);
KLed(const QColor &col, QWidget *parent=0, const char *name=0);
KLed(const QColor& col, KLed::State state, KLed::Look look, KLed::Shape shape,
QWidget *parent=0, const char *name=0);
~KLed();
State state() const;
Shape shape() const;
QColor color() const;
Look look() const;
int darkFactor() const;
void setState( State state );
void setShape(Shape s);
void toggleState() KDE_DEPRECATED;
void setColor(const QColor& color);
void setDarkFactor(int darkfactor);
void setLook( Look look );
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
public slots:
void toggle();
void on();
void off();
protected:
virtual void paintFlat();
virtual void paintRound();
virtual void paintSunken();
virtual void paintRect();
virtual void paintRectFrame(bool raised);
void paintEvent( QPaintEvent * );
int ensureRoundLed();
bool paintCachedPixmap();
private:
State led_state;
QColor led_color;
Look led_look;
Shape led_shape;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KLedPrivate;
KLedPrivate *d;
};
#endif
KLed
An LED widget.
Definition: kled.h:45
KLed::Look
Look
Displays a flat, round or sunken LED.
Definition: kled.h:89
KLed::State
State
Status of the light is on/off.
Definition: kled.h:61
KLed::Shape
Shape
Shades of the lamp.
Definition: kled.h:67

KDE Home | KDE Accessibility Home | Description of Access Keys