\section{KLed Class Reference}
\label{classKLed}\index{KLed@{KLed}}
An LED widget.  


{\tt \#include $<$kled.h$>$}

Inheritance diagram for KLed:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=45pt]{classKLed__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KLed:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=86pt]{classKLed__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf State} \{ {\bf Off}, 
{\bf On}
 \}
\item 
enum {\bf Shape} \{ {\bf Rectangular}, 
{\bf Circular}
 \}
\item 
enum {\bf Look} \{ {\bf Flat}, 
{\bf Raised}, 
{\bf Sunken}
 \}
\end{CompactItemize}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
void {\bf toggle} ()
\item 
void {\bf on} ()
\item 
void {\bf off} ()
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KLed} ({\bf QWidget} $\ast$parent=0, const char $\ast$name=0)
\item 
{\bf KLed} (const {\bf QColor} \&col, {\bf QWidget} $\ast$parent=0, const char $\ast$name=0)
\item 
{\bf KLed} (const {\bf QColor} \&col, {\bf KLed::State} state, {\bf KLed::Look} look, {\bf KLed::Shape} shape, {\bf QWidget} $\ast$parent=0, const char $\ast$name=0)
\item 
{\bf $\sim$KLed} ()
\item 
{\bf State} {\bf state} () const 
\item 
{\bf Shape} {\bf shape} () const \label{classKLed_a5}

\item 
{\bf QColor} {\bf color} () const 
\item 
{\bf Look} {\bf look} () const 
\item 
int {\bf dark\-Factor} () const 
\item 
void {\bf set\-State} ({\bf State} state)
\item 
void {\bf set\-Shape} ({\bf Shape} s)
\item 
void {\bf toggle\-State} () KDE\_\-DEPRECATED
\item 
void {\bf set\-Color} (const {\bf QColor} \&color)
\item 
void {\bf set\-Dark\-Factor} (int darkfactor)
\item 
void {\bf set\-Look} ({\bf Look} look)
\item 
virtual {\bf QSize} {\bf size\-Hint} () const \label{classKLed_a15}

\item 
virtual {\bf QSize} {\bf minimum\-Size\-Hint} () const \label{classKLed_a16}

\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual void {\bf paint\-Flat} ()
\item 
virtual void {\bf paint\-Round} ()
\item 
virtual void {\bf paint\-Sunken} ()
\item 
virtual void {\bf paint\-Rect} ()
\item 
virtual void {\bf paint\-Rect\-Frame} (bool raised)
\item 
void {\bf paint\-Event} ({\bf QPaint\-Event} $\ast$)\label{classKLed_b5}

\item 
int {\bf ensure\-Round\-Led} ()
\item 
bool {\bf paint\-Cached\-Pixmap} ()
\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKLed_b8}

\end{CompactItemize}
\subsection*{Properties}
\begin{CompactItemize}
\item 
{\bf State} {\bf state}\label{classKLed_00}

\item 
{\bf Shape} {\bf shape}\label{classKLed_01}

\item 
{\bf Look} {\bf look}\label{classKLed_02}

\item 
{\bf QColor} {\bf color}\label{classKLed_03}

\item 
int {\bf dark\-Factor}\label{classKLed_04}

\end{CompactItemize}


\subsection{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 \char`\"{}looks\char`\"{});

It may display itself in a performant flat view, a round view with light spot or a round view sunken in the screen.

 \begin{Desc}
\item[Author:]Joerg Habenicht, Richard J. Moore ({\tt rich@kde.org}) 1998, 1999 \end{Desc}




Definition at line 45 of file kled.h.

\subsection{Member Enumeration Documentation}
\index{KLed@{KLed}!State@{State}}
\index{State@{State}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KLed::State}}\label{classKLed_w7}


Status of the light is on/off. LED on/off. 



Definition at line 61 of file kled.h.\index{KLed@{KLed}!Shape@{Shape}}
\index{Shape@{Shape}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KLed::Shape}}\label{classKLed_w8}


Shades of the lamp. LED shape. 



Definition at line 67 of file kled.h.\index{KLed@{KLed}!Look@{Look}}
\index{Look@{Look}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KLed::Look}}\label{classKLed_w9}


Displays a flat, round or sunken LED. LED look. 

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.

{\bf Timings:} \par
 ( AMD K5/133, Diamond Stealth 64 PCI Graphics, widgetsize 29x29 ) \begin{itemize}
\item flat Approximately 0.7 msec per paint \item round Approximately 2.9 msec per paint \item sunken Approximately 3.3 msec per paint\end{itemize}
The widget will be updated on the next repaining event.

Definition at line 89 of file kled.h.

\subsection{Constructor \& Destructor Documentation}
\index{KLed@{KLed}!KLed@{KLed}}
\index{KLed@{KLed}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KLed::KLed ({\bf QWidget} $\ast$ {\em parent} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0})}\label{classKLed_a0}


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



Definition at line 50 of file kled.cpp.

References QColor::dark(), and set\-Color().\index{KLed@{KLed}!KLed@{KLed}}
\index{KLed@{KLed}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KLed::KLed (const {\bf QColor} \& {\em col}, {\bf QWidget} $\ast$ {\em parent} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0})}\label{classKLed_a1}


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

The State will be defaulted On and the Look round.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em col}]Initial color of the LED. \item[{\em parent}]Will be handed over to {\bf QWidget}. \item[{\em name}]Will be handed over to {\bf QWidget}. \end{description}
\end{Desc}


Definition at line 67 of file kled.cpp.

References QColor::dark(), and set\-Color().\index{KLed@{KLed}!KLed@{KLed}}
\index{KLed@{KLed}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KLed::KLed (const {\bf QColor} \& {\em col}, {\bf KLed::State} {\em state}, {\bf KLed::Look} {\em look}, {\bf KLed::Shape} {\em shape}, {\bf QWidget} $\ast$ {\em parent} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0})}\label{classKLed_a2}


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

Differs from above only in the parameters, which configure all settings.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em col}]Initial color of the LED. \item[{\em state}]Sets the State. \item[{\em look}]Sets the Look. \item[{\em shape}]Sets the Shape (rectangular or circular) \item[{\em parent}]Will be handed over to {\bf QWidget}. \item[{\em name}]Will be handed over to {\bf QWidget}. \end{description}
\end{Desc}


Definition at line 83 of file kled.cpp.

References QColor::dark(), and set\-Color().\index{KLed@{KLed}!~KLed@{$\sim$KLed}}
\index{~KLed@{$\sim$KLed}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KLed::$\sim${\bf KLed} ()}\label{classKLed_a3}


Destructor Destructor. 



Definition at line 101 of file kled.cpp.

\subsection{Member Function Documentation}
\index{KLed@{KLed}!state@{state}}
\index{state@{state}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf State} KLed::state () const}\label{classKLed_a4}


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

\begin{Desc}
\item[See also:]{\bf State}{\rm (p.\,\pageref{classKLed_w7})} \end{Desc}
\index{KLed@{KLed}!color@{color}}
\index{color@{color}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QColor} KLed::color () const}\label{classKLed_a6}


Returns the color of the widget Returns LED color. 

\begin{Desc}
\item[See also:]Color \end{Desc}
\index{KLed@{KLed}!look@{look}}
\index{look@{look}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Look} KLed::look () const}\label{classKLed_a7}


Returns the look of the widget. Returns LED look. 

\begin{Desc}
\item[See also:]{\bf Look}{\rm (p.\,\pageref{classKLed_w9})} \end{Desc}
\index{KLed@{KLed}!darkFactor@{darkFactor}}
\index{darkFactor@{darkFactor}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KLed::dark\-Factor () const}\label{classKLed_a8}


Returns the factor to darken the LED. Returns dark factor. 

\begin{Desc}
\item[See also:]{\bf set\-Dark\-Factor()}{\rm (p.\,\pageref{classKLed_a13})} \end{Desc}
\index{KLed@{KLed}!setState@{setState}}
\index{setState@{setState}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::set\-State ({\bf State} {\em state})}\label{classKLed_a9}


Sets the state of the widget to On or Off. Set LED state. 

The widget will be painted immediately. \begin{Desc}
\item[See also:]{\bf on()}{\rm (p.\,\pageref{classKLed_i1})} {\bf off()}{\rm (p.\,\pageref{classKLed_i2})} {\bf toggle()}{\rm (p.\,\pageref{classKLed_i0})} {\bf toggle\-State()}{\rm (p.\,\pageref{classKLed_a11})}\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]The LED state: on or off. \end{description}
\end{Desc}


Definition at line 546 of file kled.cpp.

References QWidget::update().

Referenced by off(), and on().\index{KLed@{KLed}!setShape@{setShape}}
\index{setShape@{setShape}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::set\-Shape ({\bf Shape} {\em s})}\label{classKLed_a10}


Set the shape of the LED to {\tt s}. 



Definition at line 562 of file kled.cpp.

References QWidget::update().\index{KLed@{KLed}!toggleState@{toggleState}}
\index{toggleState@{toggleState}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::toggle\-State ()}\label{classKLed_a11}


Toggle the state of the LED from Off to On and vice versa. Toggles LED on-$>$off / off-$>$on. 

The widget will be repainted when returning to the main event loop. 

\begin{Desc}
\item[{\bf Deprecated}], use {\bf toggle()}{\rm (p.\,\pageref{classKLed_i0})} instead. \end{Desc}


Definition at line 556 of file kled.cpp.

References toggle().\index{KLed@{KLed}!setColor@{setColor}}
\index{setColor@{setColor}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::set\-Color (const {\bf QColor} \& {\em color})}\label{classKLed_a12}


Set the color of the widget. Sets the LED color. 

The Color is shown with the KLed::On state. The KLed::Off state is shown with {\bf QColor.dark()} method

The widget calls the {\bf update()} method, so it will be updated when entering the main event loop.

\begin{Desc}
\item[See also:]Color\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em color}]New color of the LED. \end{description}
\end{Desc}


Definition at line 572 of file kled.cpp.

References QColor::dark(), and QWidget::update().

Referenced by KLed().\index{KLed@{KLed}!setDarkFactor@{setDarkFactor}}
\index{setDarkFactor@{setDarkFactor}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::set\-Dark\-Factor (int {\em darkfactor})}\label{classKLed_a13}


Sets the factor to darken the LED in OFF state. sets the factor to darken the LED. 

Same as {\bf QColor::dark()}. \char`\"{}darkfactor should be greater than 100, else the LED gets lighter in OFF state. Defaults to 300.

\begin{Desc}
\item[See also:]{\bf QColor}\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em darkfactor}]sets the factor to darken the LED. \end{description}
\end{Desc}


Definition at line 584 of file kled.cpp.

References QColor::dark(), and QWidget::update().\index{KLed@{KLed}!setLook@{setLook}}
\index{setLook@{setLook}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::set\-Look ({\bf Look} {\em look})}\label{classKLed_a14}


Sets the look of the widget. Sets LED look. 

The look may be flat, round or sunken. The widget calls the {\bf update()} method, so it will be updated when entering the main event loop.

\begin{Desc}
\item[See also:]{\bf Look}{\rm (p.\,\pageref{classKLed_w9})}\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em look}]New look of the LED. \end{description}
\end{Desc}


Definition at line 600 of file kled.cpp.

References QWidget::update().\index{KLed@{KLed}!toggle@{toggle}}
\index{toggle@{toggle}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::toggle ()\hspace{0.3cm}{\tt  [slot]}}\label{classKLed_i0}


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

The widget repaints itself immediately. 

Definition at line 610 of file kled.cpp.

References QWidget::update().

Referenced by toggle\-State().\index{KLed@{KLed}!on@{on}}
\index{on@{on}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::on ()\hspace{0.3cm}{\tt  [slot]}}\label{classKLed_i1}


Sets the state of the widget to On. 

The widget will be painted immediately. \begin{Desc}
\item[See also:]{\bf off()}{\rm (p.\,\pageref{classKLed_i2})} {\bf toggle()}{\rm (p.\,\pageref{classKLed_i0})} {\bf toggle\-State()}{\rm (p.\,\pageref{classKLed_a11})} {\bf set\-State()}{\rm (p.\,\pageref{classKLed_a9})} \end{Desc}


Definition at line 618 of file kled.cpp.

References set\-State().\index{KLed@{KLed}!off@{off}}
\index{off@{off}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::off ()\hspace{0.3cm}{\tt  [slot]}}\label{classKLed_i2}


Sets the state of the widget to Off. 

The widget will be painted immediately. \begin{Desc}
\item[See also:]{\bf on()}{\rm (p.\,\pageref{classKLed_i1})} {\bf toggle()}{\rm (p.\,\pageref{classKLed_i0})} {\bf toggle\-State()}{\rm (p.\,\pageref{classKLed_a11})} {\bf set\-State()}{\rm (p.\,\pageref{classKLed_a9})} \end{Desc}


Definition at line 624 of file kled.cpp.

References set\-State().\index{KLed@{KLed}!paintFlat@{paintFlat}}
\index{paintFlat@{paintFlat}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::paint\-Flat ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKLed_b0}


Paints a circular, flat LED. 



Definition at line 199 of file kled.cpp.

References QPainter::begin(), QWidget::color\-Group(), QPixmap::convert\-To\-Image(), QColor::dark(), QPainter::draw\-Ellipse(), QPainter::draw\-Pixmap(), QPainter::end(), ensure\-Round\-Led(), QPixmap::fill(), paint\-Cached\-Pixmap(), QWidget::palette\-Background\-Color(), QPainter::set\-Brush(), QPen::set\-Color(), QBrush::set\-Color(), QPainter::set\-Pen(), QBrush::set\-Style(), QPen::set\-Width(), and QImage::smooth\-Scale().\index{KLed@{KLed}!paintRound@{paintRound}}
\index{paintRound@{paintRound}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::paint\-Round ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKLed_b1}


Paints a circular, raised LED. 



Definition at line 257 of file kled.cpp.

References QPainter::begin(), QWidget::color\-Group(), QPixmap::convert\-To\-Image(), QColor::dark(), QPainter::draw\-Ellipse(), QPainter::draw\-Pixmap(), QPainter::end(), ensure\-Round\-Led(), QPixmap::fill(), QColor::light(), paint\-Cached\-Pixmap(), QWidget::palette\-Background\-Color(), QPainter::set\-Brush(), QPen::set\-Color(), QBrush::set\-Color(), QPainter::set\-Pen(), QBrush::set\-Style(), QPen::set\-Width(), and QImage::smooth\-Scale().\index{KLed@{KLed}!paintSunken@{paintSunken}}
\index{paintSunken@{paintSunken}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::paint\-Sunken ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKLed_b2}


Paints a circular, sunken LED. 



Definition at line 352 of file kled.cpp.

References QPainter::begin(), QWidget::color\-Group(), QPixmap::convert\-To\-Image(), QColor::dark(), QPainter::draw\-Arc(), QPainter::draw\-Ellipse(), QPainter::draw\-Pixmap(), QPainter::end(), ensure\-Round\-Led(), QPixmap::fill(), QColor::light(), paint\-Cached\-Pixmap(), QWidget::palette\-Background\-Color(), QPainter::set\-Brush(), QPen::set\-Color(), QBrush::set\-Color(), QPainter::set\-Pen(), QBrush::set\-Style(), QPen::set\-Width(), QImage::smooth\-Scale(), and QPen::width().\index{KLed@{KLed}!paintRect@{paintRect}}
\index{paintRect@{paintRect}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::paint\-Rect ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKLed_b3}


Paints a rectangular, flat LED. 



Definition at line 459 of file kled.cpp.

References QColor::dark(), QPainter::draw\-Line(), QPainter::draw\-Rect(), QWidget::height(), QPainter::set\-Brush(), QPainter::set\-Pen(), and QWidget::width().\index{KLed@{KLed}!paintRectFrame@{paintRectFrame}}
\index{paintRectFrame@{paintRectFrame}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::paint\-Rect\-Frame (bool {\em raised})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKLed_b4}


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



Definition at line 490 of file kled.cpp.

References QPainter::draw\-Line(), QPainter::draw\-Rect(), QPainter::fill\-Rect(), QWidget::height(), QPainter::set\-Pen(), and QWidget::width().\index{KLed@{KLed}!ensureRoundLed@{ensureRoundLed}}
\index{ensureRoundLed@{ensureRoundLed}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KLed::ensure\-Round\-Led ()\hspace{0.3cm}{\tt  [protected]}}\label{classKLed_b6}


Compute LED width. 



Definition at line 163 of file kled.cpp.

References QWidget::height(), and QWidget::width().

Referenced by paint\-Flat(), paint\-Round(), and paint\-Sunken().\index{KLed@{KLed}!paintCachedPixmap@{paintCachedPixmap}}
\index{paintCachedPixmap@{paintCachedPixmap}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KLed::paint\-Cached\-Pixmap ()\hspace{0.3cm}{\tt  [protected]}}\label{classKLed_b7}


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

\begin{Desc}
\item[Returns:]true if the pixmap was painted, false if it hasn't been created yet \end{Desc}


Definition at line 179 of file kled.cpp.

References QPainter::draw\-Pixmap().

Referenced by paint\-Flat(), paint\-Round(), and paint\-Sunken().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kled.h\item 
kled.cpp\end{CompactItemize}
