\section{KSystem\-Tray Class Reference}
\label{classKSystemTray}\index{KSystemTray@{KSystemTray}}
KDE System Tray Window class  


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

Inheritance diagram for KSystem\-Tray:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=58pt]{classKSystemTray__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KSystem\-Tray:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=90pt]{classKSystemTray__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
void {\bf toggle\-Active} ()
\item 
void {\bf set\-Active} ()
\item 
void {\bf set\-Inactive} ()
\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf quit\-Selected} ()
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KSystem\-Tray} ({\bf QWidget} $\ast$parent=0, const char $\ast$name=0)
\item 
{\bf KPopup\-Menu} $\ast$ {\bf context\-Menu} () const 
\item 
{\bf KAction\-Collection} $\ast$ {\bf action\-Collection} ()
\item 
virtual void {\bf set\-Pixmap} (const {\bf QPixmap} \&icon)
\item 
virtual void {\bf set\-Caption} (const {\bf QString} \&title)
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf QPixmap} {\bf load\-Icon} (const {\bf QString} \&icon, {\bf KInstance} $\ast$instance={\bf KGlobal::instance}())
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf mouse\-Press\-Event} ({\bf QMouse\-Event} $\ast$)
\item 
void {\bf mouse\-Release\-Event} ({\bf QMouse\-Event} $\ast$)
\item 
virtual void {\bf context\-Menu\-About\-To\-Show} ({\bf KPopup\-Menu} $\ast$menu)
\item 
void {\bf show\-Event} ({\bf QShow\-Event} $\ast$)
\item 
void {\bf enter\-Event} ({\bf QEvent} $\ast$)
\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKSystemTray_b5}

\end{CompactItemize}


\subsection{Detailed Description}
KDE System Tray Window class 

This class implements system tray windows.

A tray window is a small window (typically 24x24 pixel) that docks into the system tray in the desktop panel. It usually displays an icon or an animated icon there. The icon represents the application, similar to a taskbar button, but consumes less screen space.

When the user clicks with the left mouse button on the icon, the main application window is shown/raised and activated. With the right mouse button, she gets a popupmenu with application specific commands, including \char`\"{}Minimize/Restore\char`\"{} and \char`\"{}Quit\char`\"{}.

Docking happens magically when calling show(). The window undocks with either hide() or when it is destroyed.

KSystem\-Tray inherits methods such as {\bf set\-Pixmap()}{\rm (p.\,\pageref{classKSystemTray_a4})} and {\bf set\-Movie()} to specify an icon or movie (animated icon) respectively. It is designed to be usable \char`\"{}as is\char`\"{}, without the need to subclass it. In case you need to provide something special (such as an additional popupmenu on a click with the left mouse button), you can subclass anyway, of course.

Having an icon on the system tray is a useful technique for daemon-like applications that may run for some time without user interaction but have to be there immediately when the user needs them. Examples are kppp, kisdn, kscd, kmix or knotes. With kppp and kisdn, the docked icon even provides real-time information about the network status.

\begin{Desc}
\item[Author:]Matthias Ettrich $<${\tt ettrich@kde.org}$>$ \end{Desc}




Definition at line 63 of file ksystemtray.h.

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


Construct a KSystem\-Tray widget just like any other widget. 

The parent widget {\tt parent} has a special meaning: Besides owning the tray window, the parent widget will dissappear from taskbars when it is iconified while the tray window is visible. This is the desired behavior. After all, the tray window {\tt is} the parent's taskbar icon.

Furthermore, the parent widget is shown or raised respectively when the user clicks on the trray window with the left mouse button. 

Definition at line 59 of file ksystemtray.cpp.

References QXEmbed::initialize(), KPopup\-Menu::insert\-Title(), KStd\-Action::quit(), and set\-Caption().

\subsection{Member Function Documentation}
\index{KSystemTray@{KSystem\-Tray}!contextMenu@{contextMenu}}
\index{contextMenu@{contextMenu}!KSystemTray@{KSystem\-Tray}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KPopup\-Menu} $\ast$ KSystem\-Tray::context\-Menu () const}\label{classKSystemTray_a2}


Access to the context menu. 

This makes it easy to add new items to it. 

Definition at line 133 of file ksystemtray.cpp.\index{KSystemTray@{KSystem\-Tray}!actionCollection@{actionCollection}}
\index{actionCollection@{actionCollection}!KSystemTray@{KSystem\-Tray}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KAction\-Collection} $\ast$ KSystem\-Tray::action\-Collection ()}\label{classKSystemTray_a3}


Easy access to the actions in the context menu Currently includes KStd\-Action::Quit and minimize\-Restore \begin{Desc}
\item[Since:]3.1. \end{Desc}




Definition at line 304 of file ksystemtray.cpp.\index{KSystemTray@{KSystem\-Tray}!setPixmap@{setPixmap}}
\index{setPixmap@{setPixmap}!KSystemTray@{KSystem\-Tray}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSystem\-Tray::set\-Pixmap (const {\bf QPixmap} \& {\em icon})\hspace{0.3cm}{\tt  [virtual]}}\label{classKSystemTray_a4}


Changes the tray's icon. 



Reimplemented from {\bf QLabel}.

Definition at line 317 of file ksystemtray.cpp.

References QLabel::set\-Pixmap().

Referenced by KWindow\-Info::display(), and KWindow\-Info::restore().\index{KSystemTray@{KSystem\-Tray}!setCaption@{setCaption}}
\index{setCaption@{setCaption}!KSystemTray@{KSystem\-Tray}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSystem\-Tray::set\-Caption (const {\bf QString} \& {\em title})\hspace{0.3cm}{\tt  [virtual]}}\label{classKSystemTray_a5}


Changes the tray's text description (which can be seen e.g. 

in the systray configuration dialog). The default value is {\bf KAbout\-Data::program\-Name()}. 

Definition at line 325 of file ksystemtray.cpp.

Referenced by KSystem\-Tray().\index{KSystemTray@{KSystem\-Tray}!loadIcon@{loadIcon}}
\index{loadIcon@{loadIcon}!KSystemTray@{KSystem\-Tray}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QPixmap} KSystem\-Tray::load\-Icon (const {\bf QString} \& {\em icon}, {\bf KInstance} $\ast$ {\em instance} = {\tt {\bf KGlobal::instance}()})\hspace{0.3cm}{\tt  [static]}}\label{classKSystemTray_e0}


{\bf Loads} an icon {\tt icon} using the icon loader class of the given instance {\tt instance}. 

The icon is applied the panel effect as it should only be used to be shown in the system tray. It's commonly used in the form : systray-$>$set\-Pixmap( systray-$>$load\-Icon( \char`\"{}mysystray\char`\"{} ) );

\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 309 of file ksystemtray.cpp.

References KInstance::icon\-Loader(), KIcon\-Loader::load\-Icon(), and KConfig\-Base::read\-Num\-Entry().\index{KSystemTray@{KSystem\-Tray}!quitSelected@{quitSelected}}
\index{quitSelected@{quitSelected}!KSystemTray@{KSystem\-Tray}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSystem\-Tray::quit\-Selected ()\hspace{0.3cm}{\tt  [signal]}}\label{classKSystemTray_l0}


Emitted when quit is selected in the menu. 

If you want to perform any other action than to close the main application window please connect to this signal. \begin{Desc}
\item[Since:]3.1 \end{Desc}
\index{KSystemTray@{KSystem\-Tray}!toggleActive@{toggleActive}}
\index{toggleActive@{toggleActive}!KSystemTray@{KSystem\-Tray}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSystem\-Tray::toggle\-Active ()\hspace{0.3cm}{\tt  [slot]}}\label{classKSystemTray_i0}


Toggles the state of the window associated with this system tray icon (hides it, shows it or activates it depending on the window state). 

The default implementation of {\bf mouse\-Press\-Event()}{\rm (p.\,\pageref{classKSystemTray_b0})} calls {\bf toggle\-Active()}{\rm (p.\,\pageref{classKSystemTray_i0})} when the tray icon is left-clicked, use it when reimplementing {\bf mouse\-Press\-Event()}{\rm (p.\,\pageref{classKSystemTray_b0})}. \begin{Desc}
\item[Since:]3.3 \end{Desc}


Definition at line 216 of file ksystemtray.cpp.

Referenced by mouse\-Press\-Event().\index{KSystemTray@{KSystem\-Tray}!setActive@{setActive}}
\index{setActive@{setActive}!KSystemTray@{KSystem\-Tray}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSystem\-Tray::set\-Active ()\hspace{0.3cm}{\tt  [slot]}}\label{classKSystemTray_i1}


Activates the window associated with this system tray icon, regardless of its current state. 

\begin{Desc}
\item[Since:]3.3 \end{Desc}


Definition at line 221 of file ksystemtray.cpp.\index{KSystemTray@{KSystem\-Tray}!setInactive@{setInactive}}
\index{setInactive@{setInactive}!KSystemTray@{KSystem\-Tray}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSystem\-Tray::set\-Inactive ()\hspace{0.3cm}{\tt  [slot]}}\label{classKSystemTray_i2}


Hides the window associated with this system tray icon, regardless of its current state. 

\begin{Desc}
\item[Since:]3.3 \end{Desc}


Definition at line 226 of file ksystemtray.cpp.\index{KSystemTray@{KSystem\-Tray}!mousePressEvent@{mousePressEvent}}
\index{mousePressEvent@{mousePressEvent}!KSystemTray@{KSystem\-Tray}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSystem\-Tray::mouse\-Press\-Event ({\bf QMouse\-Event} $\ast$)\hspace{0.3cm}{\tt  [protected]}}\label{classKSystemTray_b0}


Reimplemented to provide the standard show/raise behavior for the parent\-Widget() and the context menu. 

Feel free to reimplement this if you need something special. 

Definition at line 139 of file ksystemtray.cpp.

References context\-Menu\-About\-To\-Show(), QPopup\-Menu::popup(), and toggle\-Active().\index{KSystemTray@{KSystem\-Tray}!mouseReleaseEvent@{mouseReleaseEvent}}
\index{mouseReleaseEvent@{mouseReleaseEvent}!KSystemTray@{KSystem\-Tray}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSystem\-Tray::mouse\-Release\-Event ({\bf QMouse\-Event} $\ast$)\hspace{0.3cm}{\tt  [protected]}}\label{classKSystemTray_b1}


Reimplemented to provide the standard show/raise behavior for the parent\-Widget() and the context menu. 

Feel free to reimplement this if you need something special. 

Definition at line 167 of file ksystemtray.cpp.\index{KSystemTray@{KSystem\-Tray}!contextMenuAboutToShow@{contextMenuAboutToShow}}
\index{contextMenuAboutToShow@{contextMenuAboutToShow}!KSystemTray@{KSystem\-Tray}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSystem\-Tray::context\-Menu\-About\-To\-Show ({\bf KPopup\-Menu} $\ast$ {\em menu})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKSystemTray_b2}


Makes it easy to adjust some menu items right before the context menu becomes visible. 



Definition at line 172 of file ksystemtray.cpp.

Referenced by mouse\-Press\-Event().\index{KSystemTray@{KSystem\-Tray}!showEvent@{showEvent}}
\index{showEvent@{showEvent}!KSystemTray@{KSystem\-Tray}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSystem\-Tray::show\-Event ({\bf QShow\-Event} $\ast$)\hspace{0.3cm}{\tt  [protected]}}\label{classKSystemTray_b3}


Reimplemented for internal reasons. 



Definition at line 105 of file ksystemtray.cpp.

References QPopup\-Menu::insert\-Separator().\index{KSystemTray@{KSystem\-Tray}!enterEvent@{enterEvent}}
\index{enterEvent@{enterEvent}!KSystemTray@{KSystem\-Tray}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSystem\-Tray::enter\-Event ({\bf QEvent} $\ast$)\hspace{0.3cm}{\tt  [protected]}}\label{classKSystemTray_b4}


Reimplemented for internal reasons. 



Definition at line 128 of file ksystemtray.cpp.

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