summaryrefslogtreecommitdiffstats
path: root/redhat/kdelibs/kdelibs-3.5.13-add_ability_to_set_kled_off_color.patch
blob: bdaac75ad0fcfa7258fb19bcca4b4bd1e09a2020 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
commit 513ffc6edff67b5f7f121c3064b059ce82cbb842
Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
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;