\section{KPanel\-Extension Class Reference}
\label{classKPanelExtension}\index{KPanelExtension@{KPanelExtension}}
KDE Panel Extension class  


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

Inheritance diagram for KPanel\-Extension:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=64pt]{classKPanelExtension__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KPanel\-Extension:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=244pt]{classKPanelExtension__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Type} \{ {\bf Normal} =  0, 
{\bf Stretch}
 \}
\item 
enum {\bf Action} \{ {\bf About} =  1, 
{\bf Help} =  2, 
{\bf Preferences} =  4, 
{\bf Report\-Bug} =  8
 \}
\item 
enum {\bf Position} \{ \par
{\bf Left} =  0, 
{\bf Right}, 
{\bf Top}, 
{\bf Bottom}, 
\par
{\bf Floating}
 \}
\item 
enum {\bf Alignment} \{ {\bf Left\-Top} =  0, 
{\bf Center}, 
{\bf Right\-Bottom}
 \}
\item 
enum {\bf Size} \{ \par
{\bf Size\-Tiny} =  0, 
{\bf Size\-Small}, 
{\bf Size\-Normal}, 
{\bf Size\-Large}, 
\par
{\bf Size\-Custom}
 \}
\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf update\-Layout} ()
\item 
void {\bf maintain\-Focus} (bool)
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KPanel\-Extension} (const {\bf QString} \&config\-File, {\bf Type} t=Normal, int actions=0, {\bf QWidget} $\ast$parent=0, const char $\ast$name=0)
\item 
{\bf $\sim$KPanel\-Extension} ()
\item 
virtual {\bf QSize} {\bf size\-Hint} (Position, {\bf QSize} maxsize) const 
\item 
{\bf KConfig} $\ast$ {\bf config} () const 
\item 
{\bf Type} {\bf type} () const 
\item 
int {\bf actions} () const 
\item 
virtual void {\bf action} (Action a)
\item 
virtual Position {\bf prefered\-Position} () const 
\item 
void {\bf set\-Position} (Position p)\label{classKPanelExtension_a8}

\item 
void {\bf set\-Alignment} (Alignment a)\label{classKPanelExtension_a9}

\item 
void {\bf set\-Size} ({\bf Size} size, int custom\-Size)\label{classKPanelExtension_a10}

\item 
{\bf Size} {\bf size\-Setting} () const 
\item 
int {\bf custom\-Size} () const 
\item 
{\bf QPopup\-Menu} $\ast$ {\bf custom\-Menu} () const 
\item 
bool {\bf reserve\-Strut} () const 
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual void {\bf about} ()
\item 
virtual void {\bf help} ()
\item 
virtual void {\bf preferences} ()
\item 
virtual void {\bf report\-Bug} ()
\item 
Position {\bf position} () const 
\item 
Alignment {\bf alignment} () const 
\item 
Orientation {\bf orientation} ()
\item 
int {\bf size\-In\-Pixels} () const 
\item 
virtual void {\bf position\-Change} (Position)
\item 
virtual void {\bf alignment\-Change} (Alignment)
\item 
void {\bf set\-Custom\-Menu} ({\bf QPopup\-Menu} $\ast$)
\item 
void {\bf set\-Reserve\-Strut} (bool should\-Use\-Strut)
\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKPanelExtension_b12}

\end{CompactItemize}


\subsection{Detailed Description}
KDE Panel Extension class 

Panel extensions \begin{itemize}
\item Are small applications living in the Window Manager dock managed by the panel. \item Are implemented as DSOs (Dynamic Shared Objects).\end{itemize}
Note: For security and stability reasons the panel won't load untrusted third party extensions directly into its namespace but via an external wrapper process.

The panel locates available extensions by searching for extension desktop files in (ALL\_\-KDEDIRS)/share/apps/kicker/extensions. Every panel extension should install a desktop file there to be recognized by the panel.

Besides standard keys like \char`\"{}Name\char`\"{}, \char`\"{}Comment\char`\"{} and \char`\"{}Icon\char`\"{} there are two panel extension specific keys:

{\bf X-KDE-Library} \par


Used by the panel to locate the extension DSO (Dynamic Shared Object) Example: X-KDE-Library=libexampleextension

{\bf X-KDE-Unique\-Extension} \par


Similar to {\bf KApplication} and {\bf KUnique\-Application} there are two types of panel extensions. Use unique extensions when it makes no sence to run more than one instance of an extension in the panel. A good example for unique extensions is the taskbar extension. Use normal extensions when you need instance specific configuration. An example is a subpanel extension where you might want to run more than one instances. X-KDE-Unique\-Extension is a boolean key which defaults to \char`\"{}false\char`\"{}. Example: X-KDE-Unique\-Extension=true

Back to panel extension DSOs, the following conventions are used for {\bf KDE}: Name: lib$<$extensionname$>$extension.la LDFLAGS: -module -no-undefined

To implement a panel extension it is not enough to write a class inheriting from KPanel\-Extension but you also have to provide a factory function in your DSO. A sample factory function could look like this:



\footnotesize\begin{verbatim} extern "C"
 {
     KPanelExtension* init(QWidget *parent, const QString& configFile)
     {
         KGlobal::locale()->insertCatalogue("exampleextension");
         return new ExampleExtension(configFile, KPanelExtension::Normal,
                       KPanelExtension::About | KPanelExtension::Help | KPanelExtension::Preferences,
                       parent, "exampleextension");
     }
 }
\end{verbatim}
\normalsize


Note: Don't change the factory function signature or the panel will fail to load your extension.

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




Definition at line 98 of file kpanelextension.h.

\subsection{Member Enumeration Documentation}
\index{KPanelExtension@{KPanel\-Extension}!Type@{Type}}
\index{Type@{Type}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KPanel\-Extension::Type}}\label{classKPanelExtension_w19}


The type of the extension (TODO). 



Definition at line 105 of file kpanelextension.h.\index{KPanelExtension@{KPanel\-Extension}!Size@{Size}}
\index{Size@{Size}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KPanel\-Extension::Size}}\label{classKPanelExtension_w23}


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




Definition at line 111 of file kpanelextension.h.

\subsection{Constructor \& Destructor Documentation}
\index{KPanelExtension@{KPanel\-Extension}!KPanelExtension@{KPanelExtension}}
\index{KPanelExtension@{KPanelExtension}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KPanel\-Extension::KPanel\-Extension (const {\bf QString} \& {\em config\-File}, {\bf Type} {\em t} = {\tt Normal}, int {\em actions} = {\tt 0}, {\bf QWidget} $\ast$ {\em parent} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0})}\label{classKPanelExtension_a0}


Constructs a KPanel\-Extension just like any other widget. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em config\-File}]The config\-File handed over in the factory function. \item[{\em t}]The extension {\bf type()}{\rm (p.\,\pageref{classKPanelExtension_a4})}. \item[{\em actions}]Standard RMB menu actions supported by the extension (see {\bf action()}{\rm (p.\,\pageref{classKPanelExtension_a6})} ). \item[{\em parent}]The pointer to the parent widget handed over in the factory function. \item[{\em name}]A {\bf Qt} object name for your extension. \end{description}
\end{Desc}


Definition at line 47 of file kpanelextension.cpp.

References QFrame::set\-Frame\-Style().\index{KPanelExtension@{KPanel\-Extension}!~KPanelExtension@{$\sim$KPanelExtension}}
\index{~KPanelExtension@{$\sim$KPanelExtension}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KPanel\-Extension::$\sim${\bf KPanel\-Extension} ()}\label{classKPanelExtension_a1}


Destructor. 



Definition at line 61 of file kpanelextension.cpp.

\subsection{Member Function Documentation}
\index{KPanelExtension@{KPanel\-Extension}!sizeHint@{sizeHint}}
\index{sizeHint@{sizeHint}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual {\bf QSize} KPanel\-Extension::size\-Hint (Position, {\bf QSize} {\em maxsize}) const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKPanelExtension_a2}


Returns the preferred size for a given Position. 

Every extension should reimplement this function.

Depending on the panel position the extensions can choose a preferred size for that location in the Window Manager Dock. Please note that the size can not be larger than the maxsize given by the handler. 

Definition at line 139 of file kpanelextension.h.\index{KPanelExtension@{KPanel\-Extension}!config@{config}}
\index{config@{config}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KConfig}$\ast$ KPanel\-Extension::config () const\hspace{0.3cm}{\tt  [inline]}}\label{classKPanelExtension_a3}


Always use this {\bf KConfig} object to save/load your extensions configuration. 

For unique extensions this config object will write to a config file called $<$extensionname$>$rc in the users local {\bf KDE} directory.

For normal extensions this config object will write to a instance specific config file called $<$extensionname$>$$<$instanceid$>$rc in the users local {\bf KDE} directory. 

Definition at line 150 of file kpanelextension.h.\index{KPanelExtension@{KPanel\-Extension}!type@{type}}
\index{type@{type}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Type} KPanel\-Extension::type () const\hspace{0.3cm}{\tt  [inline]}}\label{classKPanelExtension_a4}


\begin{Desc}
\item[Returns:]Type indicating the extensions type. Type \end{Desc}


Definition at line 156 of file kpanelextension.h.\index{KPanelExtension@{KPanel\-Extension}!actions@{actions}}
\index{actions@{actions}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KPanel\-Extension::actions () const\hspace{0.3cm}{\tt  [inline]}}\label{classKPanelExtension_a5}


\begin{Desc}
\item[Returns:]int indicating the supported RMB menu actions. \#Action \end{Desc}


Definition at line 162 of file kpanelextension.h.\index{KPanelExtension@{KPanel\-Extension}!action@{action}}
\index{action@{action}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPanel\-Extension::action (Action {\em a})\hspace{0.3cm}{\tt  [virtual]}}\label{classKPanelExtension_a6}


Generic action dispatcher. 

Called when the user selects an item from the extensions RMB menu.

Reimplement this function to handle actions.

For About, Help, Preferences and Report\-Bug use the convenience handlers ref {\bf about()}{\rm (p.\,\pageref{classKPanelExtension_b0})}, {\bf help()}{\rm (p.\,\pageref{classKPanelExtension_b1})}, {\bf preferences()}{\rm (p.\,\pageref{classKPanelExtension_b2})}, {\bf report\-Bug()}{\rm (p.\,\pageref{classKPanelExtension_b3})} 

Definition at line 89 of file kpanelextension.cpp.

References about(), help(), preferences(), and report\-Bug().\index{KPanelExtension@{KPanel\-Extension}!preferedPosition@{preferedPosition}}
\index{preferedPosition@{preferedPosition}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual Position KPanel\-Extension::prefered\-Position () const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKPanelExtension_a7}


Reimplement this function to set a preferred dock position for your extension. 

The extension manager will try to place new instances of this extension according to this setting. \begin{Desc}
\item[Returns:]Position \end{Desc}


Definition at line 183 of file kpanelextension.h.\index{KPanelExtension@{KPanel\-Extension}!sizeSetting@{sizeSetting}}
\index{sizeSetting@{sizeSetting}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KPanel\-Extension::Size} KPanel\-Extension::size\-Setting () const}\label{classKPanelExtension_a11}


\begin{Desc}
\item[Returns:]the extension's size \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 109 of file kpanelextension.cpp.\index{KPanelExtension@{KPanel\-Extension}!customSize@{customSize}}
\index{customSize@{customSize}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KPanel\-Extension::custom\-Size () const}\label{classKPanelExtension_a12}


\begin{Desc}
\item[Returns:]the custom sizel setting in pixels \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 114 of file kpanelextension.cpp.\index{KPanelExtension@{KPanel\-Extension}!customMenu@{customMenu}}
\index{customMenu@{customMenu}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QPopup\-Menu} $\ast$ KPanel\-Extension::custom\-Menu () const}\label{classKPanelExtension_a13}


\begin{Desc}
\item[Returns:]the extension's custom menu, usually the same as the context menu, or 0 if none \end{Desc}
\begin{Desc}
\item[See also:]{\bf set\-Custom\-Menu(QPopup\-Menu$\ast$)}{\rm (p.\,\pageref{classKPanelExtension_b10})} \end{Desc}
\begin{Desc}
\item[Since:]3.4 \end{Desc}


Definition at line 141 of file kpanelextension.cpp.\index{KPanelExtension@{KPanel\-Extension}!reserveStrut@{reserveStrut}}
\index{reserveStrut@{reserveStrut}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KPanel\-Extension::reserve\-Strut () const}\label{classKPanelExtension_a14}


\begin{Desc}
\item[Returns:]whether or not to set a desktop geometry claiming strut for this panel defaults to true \end{Desc}
\begin{Desc}
\item[See also:]set\-Reservetrut(bool) \end{Desc}
\begin{Desc}
\item[Since:]3.4 \end{Desc}


Definition at line 151 of file kpanelextension.cpp.

References position().\index{KPanelExtension@{KPanel\-Extension}!updateLayout@{updateLayout}}
\index{updateLayout@{updateLayout}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPanel\-Extension::update\-Layout ()\hspace{0.3cm}{\tt  [signal]}}\label{classKPanelExtension_l0}


Emit this signal to make the panel relayout all extensions in the dock, when you want to change the extensions size. 

The panel is going to relayout all extensions based on their preferred size. \index{KPanelExtension@{KPanel\-Extension}!maintainFocus@{maintainFocus}}
\index{maintainFocus@{maintainFocus}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPanel\-Extension::maintain\-Focus (bool)\hspace{0.3cm}{\tt  [signal]}}\label{classKPanelExtension_l1}


Emit this signal to make the panel maintain focus, e.g. 

don't autohide \begin{Desc}
\item[Since:]3.4 \end{Desc}
\index{KPanelExtension@{KPanel\-Extension}!about@{about}}
\index{about@{about}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KPanel\-Extension::about ()\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKPanelExtension_b0}


Is called when the user selects \char`\"{}About\char`\"{} from the extensions RMB menu. 

Reimplement this function to launch a about dialog.

Note that this is called only when your extension supports the About action. See \#Action. 

Definition at line 249 of file kpanelextension.h.

Referenced by action().\index{KPanelExtension@{KPanel\-Extension}!help@{help}}
\index{help@{help}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KPanel\-Extension::help ()\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKPanelExtension_b1}


Is called when the user selects \char`\"{}Help\char`\"{} from the extensions RMB menu. 

Reimplement this function to launch a manual or help page.

Note that this is called only when your extension supports the Help action. See \#Action. 

Definition at line 258 of file kpanelextension.h.

Referenced by action().\index{KPanelExtension@{KPanel\-Extension}!preferences@{preferences}}
\index{preferences@{preferences}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KPanel\-Extension::preferences ()\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKPanelExtension_b2}


Is called when the user selects \char`\"{}Preferences\char`\"{} from the extensions RMB menu. 

Reimplement this function to launch a preferences dialog or kcontrol module.

Note that this is called only when your extension supports the preferences action. See \#Action. 

Definition at line 267 of file kpanelextension.h.

Referenced by action().\index{KPanelExtension@{KPanel\-Extension}!reportBug@{reportBug}}
\index{reportBug@{reportBug}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KPanel\-Extension::report\-Bug ()\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKPanelExtension_b3}


Is called when the user selects \char`\"{}Report bug\char`\"{} from the applet's RMB menu. 

Reimplement this function to launch a bug reporting dialog.

Note that this is called only when your applet supports the Report\-Bug action. See \#Action. 

Definition at line 277 of file kpanelextension.h.

Referenced by action().\index{KPanelExtension@{KPanel\-Extension}!position@{position}}
\index{position@{position}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Position KPanel\-Extension::position () const\hspace{0.3cm}{\tt  [inline, protected]}}\label{classKPanelExtension_b4}


\begin{Desc}
\item[Returns:]the extension's position. (left, right, top, bottom) \end{Desc}


Definition at line 282 of file kpanelextension.h.

Referenced by reserve\-Strut().\index{KPanelExtension@{KPanel\-Extension}!alignment@{alignment}}
\index{alignment@{alignment}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Alignment KPanel\-Extension::alignment () const\hspace{0.3cm}{\tt  [inline, protected]}}\label{classKPanelExtension_b5}


\begin{Desc}
\item[Returns:]the extension's alignment. (left/top, center, or right/bottom) \end{Desc}


Definition at line 287 of file kpanelextension.h.\index{KPanelExtension@{KPanel\-Extension}!orientation@{orientation}}
\index{orientation@{orientation}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Qt::Orientation KPanel\-Extension::orientation ()\hspace{0.3cm}{\tt  [protected]}}\label{classKPanelExtension_b6}


\begin{Desc}
\item[Returns:]the extensions orientation. (horizontal or vertical) \end{Desc}


Definition at line 101 of file kpanelextension.cpp.\index{KPanelExtension@{KPanel\-Extension}!sizeInPixels@{sizeInPixels}}
\index{sizeInPixels@{sizeInPixels}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KPanel\-Extension::size\-In\-Pixels () const\hspace{0.3cm}{\tt  [protected]}}\label{classKPanelExtension_b7}


\begin{Desc}
\item[Returns:]the appropriate size in pixels for the panel \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 119 of file kpanelextension.cpp.\index{KPanelExtension@{KPanel\-Extension}!positionChange@{positionChange}}
\index{positionChange@{positionChange}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KPanel\-Extension::position\-Change (Position)\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKPanelExtension_b8}


This extension has changed its position. 

Reimplement this change handler in order to adjust the look of your applet. 

Definition at line 305 of file kpanelextension.h.\index{KPanelExtension@{KPanel\-Extension}!alignmentChange@{alignmentChange}}
\index{alignmentChange@{alignmentChange}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KPanel\-Extension::alignment\-Change (Alignment)\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKPanelExtension_b9}


This extension has changed its alignment. 

Reimplement this change handler in order to adjust the look of your applet. 

Definition at line 312 of file kpanelextension.h.\index{KPanelExtension@{KPanel\-Extension}!setCustomMenu@{setCustomMenu}}
\index{setCustomMenu@{setCustomMenu}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPanel\-Extension::set\-Custom\-Menu ({\bf QPopup\-Menu} $\ast$)\hspace{0.3cm}{\tt  [protected]}}\label{classKPanelExtension_b10}


Use this method to set the custom menu for this extensions so that it can be shown at the appropriate places/times that the extension many not itself be aware of. 

The extension itself is still responsible for deleting and managing the the menu.

If the menu is deleted during the life of the extension, be sure to call this method again with the new menu (or 0) to avoid crashes \begin{Desc}
\item[Since:]3.4 \end{Desc}


Definition at line 146 of file kpanelextension.cpp.\index{KPanelExtension@{KPanel\-Extension}!setReserveStrut@{setReserveStrut}}
\index{setReserveStrut@{setReserveStrut}!KPanelExtension@{KPanel\-Extension}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPanel\-Extension::set\-Reserve\-Strut (bool {\em should\-Use\-Strut})\hspace{0.3cm}{\tt  [protected]}}\label{classKPanelExtension_b11}


Use this method to set the return value for reserve\-Strut. 

\begin{Desc}
\item[See also:]{\bf reserve\-Strut}{\rm (p.\,\pageref{classKPanelExtension_a14})} \end{Desc}
\begin{Desc}
\item[Since:]3.4 \end{Desc}


Definition at line 156 of file kpanelextension.cpp.

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