• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

Public Types | Public Slots | Public Member Functions | Protected Member Functions | List of all members
KLed Class Reference

#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.

KDE LED Widget
Author
Joerg Habenicht, Richard J. Moore (rich@.nosp@m.kde..nosp@m.org) 1998, 1999

Definition at line 45 of file kled.h.

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.

Definition at line 90 of file kled.h.

◆ Shape

enum KLed::Shape

Shades of the lamp.

LED shape

Definition at line 68 of file kled.h.

◆ State

enum KLed::State

Status of the light is on/off.

LED on/off.

Definition at line 62 of file kled.h.

Constructor & Destructor Documentation

◆ KLed() [1/3]

KLed::KLed ( TQWidget *  parent = 0,
const char *  name = 0 
)

Constructs a green, round LED widget which will initially be turned on.

Definition at line 50 of file kled.cpp.

◆ KLed() [2/3]

KLed::KLed ( const TQColor &  col,
TQWidget *  parent = 0,
const char *  name = 0 
)

Constructor with the ledcolor, the parent widget, and the name.

The State will be defaulted On and the Look round.

Parameters
colInitial color of the LED.
parentWill be handed over to TQWidget.
nameWill be handed over to TQWidget.

Constructor

Definition at line 67 of file kled.cpp.

◆ 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
colInitial color of the LED.
stateSets the State.
lookSets the Look.
shapeSets the Shape (rectangular or circular)
parentWill be handed over to TQWidget.
nameWill be handed over to TQWidget.

Constructor

Definition at line 83 of file kled.cpp.

◆ ~KLed()

KLed::~KLed ( )

Destructor.

Destructor

Definition at line 101 of file kled.cpp.

Member Function Documentation

◆ color()

TQColor KLed::color ( ) const

Returns the color of the widget.

See also
Color

Returns LED color.

Definition at line 534 of file kled.cpp.

◆ darkFactor()

int KLed::darkFactor ( ) const

Returns the factor to darken the LED.

See also
setDarkFactor()

Returns dark factor

Definition at line 611 of file kled.cpp.

◆ ensureRoundLed()

int KLed::ensureRoundLed ( )
protected

Compute LED width.

Definition at line 163 of file kled.cpp.

◆ look()

KLed::Look KLed::look ( ) const

Returns the look of the widget.

See also
Look

Returns LED look.

Definition at line 546 of file kled.cpp.

◆ minimumSizeHint()

TQSize KLed::minimumSizeHint ( ) const
virtual

Definition at line 653 of file kled.cpp.

◆ off

void KLed::off ( )
slot

Sets the state of the widget to Off.

The widget will be painted immediately.

See also
on() toggle() toggleState() setState()

Definition at line 641 of file kled.cpp.

◆ offColor()

TQColor KLed::offColor ( ) const

Returns the off color of the widget.

See also
OffColor

Returns LED off color.

Definition at line 540 of file kled.cpp.

◆ on

void KLed::on ( )
slot

Sets the state of the widget to On.

The widget will be painted immediately.

See also
off() toggle() toggleState() setState()

Definition at line 635 of file kled.cpp.

◆ paintCachedPixmap()

bool KLed::paintCachedPixmap ( )
protected

Paint the cached antialiased pixmap corresponding to the state if any.

Returns
true if the pixmap was painted, false if it hasn't been created yet

Definition at line 179 of file kled.cpp.

◆ paintEvent()

void KLed::paintEvent ( TQPaintEvent *  )
protected

Definition at line 109 of file kled.cpp.

◆ paintFlat()

void KLed::paintFlat ( )
protectedvirtual

Paints a circular, flat LED.

Definition at line 199 of file kled.cpp.

◆ paintRect()

void KLed::paintRect ( )
protectedvirtual

Paints a rectangular, flat LED.

Definition at line 459 of file kled.cpp.

◆ paintRectFrame()

void KLed::paintRectFrame ( bool  raised)
protectedvirtual

Paints a rectangular LED, either raised or sunken, depending on its argument.

Definition at line 490 of file kled.cpp.

◆ paintRound()

void KLed::paintRound ( )
protectedvirtual

Paints a circular, raised LED.

Definition at line 257 of file kled.cpp.

◆ paintSunken()

void KLed::paintSunken ( )
protectedvirtual

Paints a circular, sunken LED.

Definition at line 352 of file kled.cpp.

◆ 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
colorNew color of the LED.

Sets the LED color.

Definition at line 578 of file kled.cpp.

◆ 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
darkfactorsets the factor to darken the LED.

sets the factor to darken the LED.

Definition at line 601 of file kled.cpp.

◆ 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
colorNew color of the LED used for on state.
darkcolorDark 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
lookNew look of the LED.

Sets LED look.

Definition at line 617 of file kled.cpp.

◆ 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
colorNew off color of the LED.

Sets the LED off color.

Definition at line 590 of file kled.cpp.

◆ setShape()

void KLed::setShape ( KLed::Shape  s)

Set the shape of the LED to s.

Definition at line 568 of file kled.cpp.

◆ setState()

void KLed::setState ( State  state)

Sets the state of the widget to On or Off.

The widget will be painted immediately.

See also
on() off() toggle() toggleState()
Parameters
stateThe LED state: on or off.

Set LED state.

Definition at line 552 of file kled.cpp.

◆ shape()

KLed::Shape KLed::shape ( ) const

Definition at line 528 of file kled.cpp.

◆ sizeHint()

TQSize KLed::sizeHint ( void  ) const
virtual

Definition at line 647 of file kled.cpp.

◆ state()

KLed::State KLed::state ( ) const

Returns the current state of the widget (on/off).

See also
State

Returns LED state.

Definition at line 522 of file kled.cpp.

◆ toggle

void KLed::toggle ( )
slot

Toggles the state of the led from Off to On or vice versa.

The widget repaints itself immediately.

Definition at line 627 of file kled.cpp.

◆ 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.

Definition at line 562 of file kled.cpp.

◆ virtual_hook()

void KLed::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 658 of file kled.cpp.


The documentation for this class was generated from the following files:
  • kled.h
  • kled.cpp

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.