commit 513ffc6edff67b5f7f121c3064b059ce82cbb842 Author: Timothy Pearson Date: 1341187933 -0500 Add ability to set KLed off color diff --git a/kdeui/kled.cpp b/kdeui/kled.cpp index 3a3aa2a..dc245cd 100644 --- a/kdeui/kled.cpp +++ b/kdeui/kled.cpp @@ -536,6 +536,12 @@ KLed::color() const return led_color; } +TQColor +KLed::offColor() const +{ + return led_off_color; +} + KLed::Look KLed::look() const { @@ -581,6 +587,17 @@ KLed::setColor(const TQColor& col) } void +KLed::setOffColor(const TQColor& col) +{ + if(led_off_color!=col) { + if(d->on_map) { delete d->on_map; d->on_map = 0; } + if(d->off_map) { delete d->off_map; d->off_map = 0; } + d->offcolor = col; + update(); + } +} + +void KLed::setDarkFactor(int darkfactor) { if (d->dark_factor != darkfactor) { diff --git a/kdeui/kled.h b/kdeui/kled.h index 7b9f327..b4f828e 100644 --- a/kdeui/kled.h +++ b/kdeui/kled.h @@ -50,6 +50,7 @@ class TDEUI_EXPORT KLed : public TQWidget Q_PROPERTY( Shape tqshape READ tqshape WRITE setShape ) Q_PROPERTY( Look look READ look WRITE setLook ) Q_PROPERTY( TQColor color READ color WRITE setColor ) + Q_PROPERTY( TQColor offColor READ color WRITE setOffColor ) Q_PROPERTY( int darkFactor READ darkFactor WRITE setDarkFactor ) public: @@ -148,6 +149,14 @@ public: TQColor color() const; /** + * Returns the off color of the widget + * + * @see OffColor + * @short Returns LED off color. + */ + TQColor offColor() const; + + /** * Returns the look of the widget. * * @see Look @@ -204,6 +213,23 @@ public: void setColor(const TQColor& color); /** + * Set the off color of the widget. + * The Color is shown with the KLed::On state. + * The KLed::Off state is shown with this color if set + * + * The widget calls the update() method, so it will + * be updated when entering the main event loop. + * + * Note that calling setColor will override this value + * + * @see Color + * + * @param color New off color of the LED. + * @short Sets the LED off color. + */ + void setOffColor(const TQColor& color); + + /** * Sets the factor to darken the LED in OFF state. * Same as TQColor::dark(). * "darkfactor should be greater than 100, else the LED gets lighter @@ -316,6 +342,7 @@ protected: private: State led_state; TQColor led_color; + TQColor led_off_color; Look led_look; Shape led_tqshape;