#include <kled.h>
Inherits TQWidget.
Public Types | |
enum | State { Off , On } |
enum | Shape { Rectangular , Circular } |
enum | Look { Flat , Raised , Sunken } |
Public Slots | |
void | toggle () |
void | on () |
void | off () |
Public Member Functions | |
KLed (TQWidget *parent=0, const char *name=0) | |
KLed (const TQColor &col, TQWidget *parent=0, const char *name=0) | |
KLed (const TQColor &col, KLed::State state, KLed::Look look, KLed::Shape shape, TQWidget *parent=0, const char *name=0) | |
~KLed () | |
State | state () const |
Shape | shape () const |
TQColor | color () const |
TQColor | offColor () const |
Look | look () const |
int | darkFactor () const |
void | setState (State state) |
void | setShape (Shape s) |
void | toggleState () TDE_DEPRECATED |
void | setColor (const TQColor &color) |
void | setOffColor (const TQColor &color) |
void | setDarkFactor (int darkfactor) |
void | setLook (Look look) |
virtual TQSize | sizeHint () const |
virtual TQSize | minimumSizeHint () const |
Protected Member Functions | |
virtual void | paintFlat () |
virtual void | paintRound () |
virtual void | paintSunken () |
virtual void | paintRect () |
virtual void | paintRectFrame (bool raised) |
void | paintEvent (TQPaintEvent *) |
int | ensureRoundLed () |
bool | paintCachedPixmap () |
virtual void | virtual_hook (int id, void *data) |
Detailed Description
An LED widget.
Displays a round or rectangular light emitting diode.
It is configurable to five colors, the two on/off states and three styles (or "looks");
It may display itself in a performant flat view, a round view with light spot or a round view sunken in the screen.
Member Enumeration Documentation
◆ Look
enum KLed::Look |
Displays a flat, round or sunken LED.
Displaying the LED flat is less time and color consuming, but not so nice to see.
The sunken LED itself is (certainly) smaller than the round LED because of the 3 shading circles and is most time consuming. Makes sense for LED > 15x15 pixels.
Timings:
( AMD K5/133, Diamond Stealth 64 PCI Graphics, widgetsize 29x29 )
- flat Approximately 0.7 msec per paint
- round Approximately 2.9 msec per paint
- sunken Approximately 3.3 msec per paint
The widget will be updated on the next repaining event.
LED look.
◆ Shape
enum KLed::Shape |
◆ State
enum KLed::State |
Constructor & Destructor Documentation
◆ KLed() [1/3]
KLed::KLed | ( | TQWidget * | parent = 0 , |
const char * | name = 0 |
||
) |
◆ KLed() [2/3]
KLed::KLed | ( | const TQColor & | col, |
TQWidget * | parent = 0 , |
||
const char * | name = 0 |
||
) |
◆ KLed() [3/3]
KLed::KLed | ( | const TQColor & | col, |
KLed::State | state, | ||
KLed::Look | look, | ||
KLed::Shape | shape, | ||
TQWidget * | parent = 0 , |
||
const char * | name = 0 |
||
) |
Constructor with the ledcolor, ledstate, ledlook, the parent widget, and the name.
Differs from above only in the parameters, which configure all settings.
- Parameters
-
col Initial color of the LED. state Sets the State. look Sets the Look. shape Sets the Shape (rectangular or circular) parent Will be handed over to TQWidget. name Will be handed over to TQWidget.
Constructor
◆ ~KLed()
Member Function Documentation
◆ color()
TQColor KLed::color | ( | ) | const |
◆ darkFactor()
int KLed::darkFactor | ( | ) | const |
◆ ensureRoundLed()
◆ look()
KLed::Look KLed::look | ( | ) | const |
◆ off
|
slot |
Sets the state of the widget to Off.
The widget will be painted immediately.
- See also
- on() toggle() toggleState() setState()
◆ offColor()
TQColor KLed::offColor | ( | ) | const |
◆ on
|
slot |
Sets the state of the widget to On.
The widget will be painted immediately.
- See also
- off() toggle() toggleState() setState()
◆ paintCachedPixmap()
|
protected |
◆ paintFlat()
|
protectedvirtual |
◆ paintRect()
|
protectedvirtual |
◆ paintRectFrame()
|
protectedvirtual |
◆ paintRound()
|
protectedvirtual |
◆ paintSunken()
|
protectedvirtual |
◆ setColor()
void KLed::setColor | ( | const TQColor & | color | ) |
Set the color of the widget.
The Color is shown with the KLed::On state. The KLed::Off state is shown with TQColor.dark() method
The widget calls the update() method, so it will be updated when entering the main event loop.
- See also
- Color
- Parameters
-
color New color of the LED.
Sets the LED color.
◆ setDarkFactor()
void KLed::setDarkFactor | ( | int | darkfactor | ) |
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 in OFF state. Defaults to 300.
- See also
- TQColor
- Parameters
-
darkfactor sets the factor to darken the LED.
sets the factor to darken the LED.
◆ setLook()
void KLed::setLook | ( | Look | look | ) |
Sets the color of the widget.
The Color is shown with the KLed::On state. darkcolor is explicidly used for the off state of the LED. Normally you don't have to use this method, the setColor(const TQColor& color) is sufficient for the task.
The widget calls the update() method, so it will be updated when entering the main event loop.
- See also
- Color setColor()
- Parameters
-
color New color of the LED used for on state. darkcolor Dark color of the LED used for off state.
Sets the light and dark LED color.
void setColor(const TQColor& color, const TQColor& darkcolor); Sets the look of the widget.
The look may be flat, round or sunken. The widget calls the update() method, so it will be updated when entering the main event loop.
- See also
- Look
- Parameters
-
look New look of the LED.
Sets LED look.
◆ setOffColor()
void KLed::setOffColor | ( | 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 also
- Color
- Parameters
-
color New off color of the LED.
Sets the LED off color.
◆ setShape()
void KLed::setShape | ( | KLed::Shape | s | ) |
◆ setState()
void KLed::setState | ( | State | state | ) |
◆ state()
KLed::State KLed::state | ( | ) | const |
◆ toggle
|
slot |
◆ toggleState()
void KLed::toggleState | ( | ) |
Toggle the state of the LED from Off to On and vice versa.
The widget will be repainted when returning to the main event loop.
Toggles LED on->off / off->on.
- Deprecated:
- , use toggle() instead.
The documentation for this class was generated from the following files: