\section{KPanel\-Menu Class Reference}
\label{classKPanelMenu}\index{KPanelMenu@{KPanelMenu}}
Base class to build dynamically loaded menu entries for the K-menu, or the panel.  


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

Inheritance diagram for KPanel\-Menu:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=57pt]{classKPanelMenu__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KPanel\-Menu:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=57pt]{classKPanelMenu__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
void {\bf reinitialize} ()
\item 
void {\bf deinitialize} ()
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KPanel\-Menu} ({\bf QWidget} $\ast$parent=0, const char $\ast$name=0)
\item 
{\bf KPanel\-Menu} (const {\bf QString} \&start\-Dir, {\bf QWidget} $\ast$parent=0, const char $\ast$name=0)
\item 
virtual {\bf $\sim$KPanel\-Menu} ()
\item 
const {\bf QString} \& {\bf path} () const 
\item 
void {\bf set\-Path} (const {\bf QString} \&p)
\item 
bool {\bf initialized} () const 
\item 
void {\bf set\-Initialized} (bool on)
\item 
void {\bf disable\-Auto\-Clear} ()
\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
virtual void {\bf slot\-About\-To\-Show} ()
\item 
virtual void {\bf slot\-Exec} (int id)=0
\item 
virtual void {\bf initialize} ()=0
\item 
void {\bf slot\-Clear} ()
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual void {\bf hide\-Event} ({\bf QHide\-Event} $\ast$ev)
\item 
void {\bf init} (const {\bf QString} \&path=QString::null)
\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKPanelMenu_b2}

\end{CompactItemize}


\subsection{Detailed Description}
Base class to build dynamically loaded menu entries for the K-menu, or the panel. 

This class allows to build menu entries that will be dynamically added either to the K-menu, or to the panel as a normal button. These dynamic menus are located in shared libraries that will be loaded at runtime by Kicker (the KDE panel).

To build such a menu, you have to inherit this class and implement the pure virtual functions {\bf initialize()}{\rm (p.\,\pageref{classKPanelMenu_j2})} and {\bf slot\-Exec()}{\rm (p.\,\pageref{classKPanelMenu_j1})}. You also have to provide a factory object in your library, see {\bf KLib\-Factory}. This factory is only used to construct the menu object.

Finally, you also have to provide a desktop file describing your dynamic menu. The relevant entries are: Name, Comment, Icon and X-KDE-Library (which contains the library name without any extension). This desktop file has to be installed in \$KDEDIR/share/apps/kicker/menuext/.

\begin{Desc}
\item[Author:]The kicker maintainers, Michael Goffioul $<${\tt kdeprint@swing.be}$>$ \end{Desc}




Definition at line 53 of file kpanelmenu.h.

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


Construct a KPanel\-Menu object. 

This is the normal constructor to use when building extrernal menu entries. 

Definition at line 49 of file kpanelmenu.cpp.

References init().\index{KPanelMenu@{KPanel\-Menu}!KPanelMenu@{KPanelMenu}}
\index{KPanelMenu@{KPanelMenu}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KPanel\-Menu::KPanel\-Menu (const {\bf QString} \& {\em start\-Dir}, {\bf QWidget} $\ast$ {\em parent} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0})}\label{classKPanelMenu_a1}


Constructor used internally by Kicker. 

You don't really want to use it. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em start\-Dir}]a directory to associate with this menu \item[{\em parent}]parent object \item[{\em name}]name of the object \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf path()}{\rm (p.\,\pageref{classKPanelMenu_a3})}, {\bf set\-Path()}{\rm (p.\,\pageref{classKPanelMenu_a4})} \end{Desc}


Definition at line 43 of file kpanelmenu.cpp.

References init().\index{KPanelMenu@{KPanel\-Menu}!~KPanelMenu@{$\sim$KPanelMenu}}
\index{~KPanelMenu@{$\sim$KPanelMenu}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KPanel\-Menu::$\sim${\bf KPanel\-Menu} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKPanelMenu_a2}


Destructor. 



Definition at line 74 of file kpanelmenu.cpp.

\subsection{Member Function Documentation}
\index{KPanelMenu@{KPanel\-Menu}!path@{path}}
\index{path@{path}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf QString} \& KPanel\-Menu::path () const}\label{classKPanelMenu_a3}


Get the directory path associated with this menu, or QString::null if there's no such associated path. 

\begin{Desc}
\item[Returns:]the associated directory path \end{Desc}
\begin{Desc}
\item[See also:]{\bf set\-Path()}{\rm (p.\,\pageref{classKPanelMenu_a4})} \end{Desc}


Definition at line 114 of file kpanelmenu.cpp.

Referenced by init().\index{KPanelMenu@{KPanel\-Menu}!setPath@{setPath}}
\index{setPath@{setPath}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPanel\-Menu::set\-Path (const {\bf QString} \& {\em p})}\label{classKPanelMenu_a4}


Set a directory path to be associated with this menu. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em p}]the directory path \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf path()}{\rm (p.\,\pageref{classKPanelMenu_a3})} \end{Desc}


Definition at line 119 of file kpanelmenu.cpp.\index{KPanelMenu@{KPanel\-Menu}!initialized@{initialized}}
\index{initialized@{initialized}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KPanel\-Menu::initialized () const}\label{classKPanelMenu_a5}


Tell if the menu has been initialized, that is it already contains items. 

This is useful when you need to know if you have to clear the menu, or to fill it. \begin{Desc}
\item[Returns:]the initial state \end{Desc}
\begin{Desc}
\item[See also:]{\bf set\-Initialized()}{\rm (p.\,\pageref{classKPanelMenu_a6})}, {\bf initialize()}{\rm (p.\,\pageref{classKPanelMenu_j2})} \end{Desc}


Definition at line 124 of file kpanelmenu.cpp.\index{KPanelMenu@{KPanel\-Menu}!setInitialized@{setInitialized}}
\index{setInitialized@{setInitialized}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPanel\-Menu::set\-Initialized (bool {\em on})}\label{classKPanelMenu_a6}


Set the initial state. 

Set it to true when you menu is filled with the items you want. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em on}]the initial state \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf initialized()}{\rm (p.\,\pageref{classKPanelMenu_a5})}, {\bf initialize()}{\rm (p.\,\pageref{classKPanelMenu_j2})} \end{Desc}


Definition at line 129 of file kpanelmenu.cpp.

Referenced by init(), and slot\-Clear().\index{KPanelMenu@{KPanel\-Menu}!disableAutoClear@{disableAutoClear}}
\index{disableAutoClear@{disableAutoClear}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPanel\-Menu::disable\-Auto\-Clear ()}\label{classKPanelMenu_a7}


Disable the automatic clearing of the menu. 

Kicker uses a cache system for its menus. After a specific configurable delay, the menu will be cleared. Use this function if you want to disable kicker's cache system, and avoid the clearing of your menu. 

Definition at line 109 of file kpanelmenu.cpp.\index{KPanelMenu@{KPanel\-Menu}!reinitialize@{reinitialize}}
\index{reinitialize@{reinitialize}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPanel\-Menu::reinitialize ()\hspace{0.3cm}{\tt  [slot]}}\label{classKPanelMenu_i0}


Reinitialize the menu: the menu is first cleared, the initial state is set to false, and finally {\bf initialize()}{\rm (p.\,\pageref{classKPanelMenu_j2})} is called. 

Use this if you want to refill your menu immediately. 

Definition at line 134 of file kpanelmenu.cpp.

References deinitialize().\index{KPanelMenu@{KPanel\-Menu}!deinitialize@{deinitialize}}
\index{deinitialize@{deinitialize}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPanel\-Menu::deinitialize ()\hspace{0.3cm}{\tt  [slot]}}\label{classKPanelMenu_i1}


Deinitialize the menu: the menu is cleared and the initialized state is set to false. 

{\bf initialize()}{\rm (p.\,\pageref{classKPanelMenu_j2})} is NOT called. It will be called before the menu is next shown, however. Use this slot if you want a delayed reinitialization. \begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 143 of file kpanelmenu.cpp.

References slot\-Clear().

Referenced by reinitialize().\index{KPanelMenu@{KPanel\-Menu}!slotAboutToShow@{slotAboutToShow}}
\index{slotAboutToShow@{slotAboutToShow}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPanel\-Menu::slot\-About\-To\-Show ()\hspace{0.3cm}{\tt  [protected, virtual, slot]}}\label{classKPanelMenu_j0}


This slot is called just before the menu is shown. 

This allows your menu to update itself if needed. However you should instead re-implement {\bf initialize}{\rm (p.\,\pageref{classKPanelMenu_j2})} to provide this feature. This function is responsible for the cache system handling, so if you re-implement it, you should call the base function also. Calls {\bf initialize()}{\rm (p.\,\pageref{classKPanelMenu_j2})}. \begin{Desc}
\item[See also:]{\bf disable\-Auto\-Clear()}{\rm (p.\,\pageref{classKPanelMenu_a7})} \end{Desc}


Definition at line 79 of file kpanelmenu.cpp.

Referenced by init().\index{KPanelMenu@{KPanel\-Menu}!slotExec@{slotExec}}
\index{slotExec@{slotExec}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KPanel\-Menu::slot\-Exec (int {\em id})\hspace{0.3cm}{\tt  [protected, pure virtual, slot]}}\label{classKPanelMenu_j1}


This is slot is called when an item from the menu has been selected. 

Your applet is then supposed to perform some action. You must re-implement this function. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em id}]the ID associated with the selected item \end{description}
\end{Desc}


Referenced by init().\index{KPanelMenu@{KPanel\-Menu}!initialize@{initialize}}
\index{initialize@{initialize}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KPanel\-Menu::initialize ()\hspace{0.3cm}{\tt  [protected, pure virtual, slot]}}\label{classKPanelMenu_j2}


This slots is called to initialize the menu. 

It is called automatically by {\bf slot\-About\-To\-Show()}{\rm (p.\,\pageref{classKPanelMenu_j0})}. By re-implementing this functions, you can reconstruct the menu before it is being shown. At the end of this function, you should call set\-Initialize() with true to tell the system that the menu is OK. You applet must re-implement this function. \begin{Desc}
\item[See also:]{\bf slot\-About\-To\-Show()}{\rm (p.\,\pageref{classKPanelMenu_j0})}, {\bf initialized()}{\rm (p.\,\pageref{classKPanelMenu_a5})}, {\bf set\-Initialized()}{\rm (p.\,\pageref{classKPanelMenu_a6})} \end{Desc}
\index{KPanelMenu@{KPanel\-Menu}!slotClear@{slotClear}}
\index{slotClear@{slotClear}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPanel\-Menu::slot\-Clear ()\hspace{0.3cm}{\tt  [protected, slot]}}\label{classKPanelMenu_j3}


Clears the menu, and update the initial state accordingly. 

\begin{Desc}
\item[See also:]{\bf initialized()}{\rm (p.\,\pageref{classKPanelMenu_a5})} \end{Desc}


Definition at line 92 of file kpanelmenu.cpp.

References QPopup\-Menu::clear(), and set\-Initialized().

Referenced by deinitialize(), and hide\-Event().\index{KPanelMenu@{KPanel\-Menu}!hideEvent@{hideEvent}}
\index{hideEvent@{hideEvent}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPanel\-Menu::hide\-Event ({\bf QHide\-Event} $\ast$ {\em ev})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKPanelMenu_b0}


Re-implemented for internal reasons. 



Reimplemented from {\bf KPopup\-Menu} {\rm (p.\,\pageref{classKPopupMenu})}.

Definition at line 98 of file kpanelmenu.cpp.

References slot\-Clear().\index{KPanelMenu@{KPanel\-Menu}!init@{init}}
\index{init@{init}!KPanelMenu@{KPanel\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPanel\-Menu::init (const {\bf QString} \& {\em path} = {\tt QString::null})\hspace{0.3cm}{\tt  [protected]}}\label{classKPanelMenu_b1}


For internal use only. 

Used by constructors. 

Definition at line 55 of file kpanelmenu.cpp.

References QPopup\-Menu::about\-To\-Show(), QPopup\-Menu::activated(), KGlobal::config(), path(), KConfig\-Base::read\-Num\-Entry(), KConfig\-Base::set\-Group(), set\-Initialized(), KPopup\-Menu::set\-Keyboard\-Shortcuts\-Enabled(), slot\-About\-To\-Show(), and slot\-Exec().

Referenced by KPanel\-Menu().

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