.TH "KPanelApplet" 3 "28 Jan 2004" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KPanelApplet \- Implement a panel applet. \fBKDE\fP Panel Applet class.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kpanelapplet.h>\fP
.PP
Inherits \fBQFrame\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBType\fP { \fBNormal\fP =  0, \fBStretch\fP }"
.br
.RI "\fIThis enum describes the type of the applet. \fP"
.ti -1c
.RI "enum \fBAction\fP { \fBAbout\fP =  1, \fBHelp\fP =  2, \fBPreferences\fP =  4, \fBReportBug\fP =  8 }"
.br
.RI "\fIThis enum holds flags which can be ORed together to describe which items the context menu over the applet handle contains. \fP"
.ti -1c
.RI "enum \fBPosition\fP { \fBpLeft\fP =  0, \fBpRight\fP, \fBpTop\fP, \fBpBottom\fP }"
.br
.ti -1c
.RI "enum \fBAlignment\fP { \fBLeftTop\fP =  0, \fBCenter\fP, \fBRightBottom\fP }"
.br
.ti -1c
.RI "enum \fBDirection\fP { \fBUp\fP =  0, \fBDown\fP, \fBLeft\fP, \fBRight\fP }"
.br
.in -1c
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBupdateLayout\fP ()"
.br
.RI "\fIEmit this signal to make the panel relayout all applets, when you want to change your width (horizontal panel) or height (vertical panel). \fP"
.ti -1c
.RI "void \fBrequestFocus\fP ()"
.br
.RI "\fIRequest keyboard focus from the panel. \fP"
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKPanelApplet\fP (const  \fBQString\fP &configFile, \fBType\fP t=Normal, int actions=0, \fBQWidget\fP *parent=0, const  char *name=0, WFlags f=0)"
.br
.RI "\fIConstructs a KPanelApplet just like any other widget. \fP"
.ti -1c
.RI "\fB~KPanelApplet\fP ()"
.br
.RI "\fIDestructor. \fP"
.ti -1c
.RI "virtual int \fBwidthForHeight\fP (int height) const "
.br
.RI "\fIReturns a suggested width for a given height. \fP"
.ti -1c
.RI "virtual int \fBheightForWidth\fP (int width) const "
.br
.ti -1c
.RI "\fBKConfig\fP * \fBconfig\fP () const "
.br
.RI "\fIAlways use this \fBKConfig\fP object to save/load your applets configuration. \fP"
.ti -1c
.RI "\fBType\fP \fBtype\fP () const "
.br
.ti -1c
.RI "int \fBactions\fP () const "
.br
.ti -1c
.RI "virtual void \fBaction\fP (\fBAction\fP a)"
.br
.RI "\fIGeneric action dispatcher. \fP"
.ti -1c
.RI "void \fBsetPosition\fP (Position p)"
.br
.ti -1c
.RI "void \fBsetAlignment\fP (Alignment a)"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual void \fBabout\fP ()"
.br
.RI "\fIIs called when the user selects 'About' from the applet's RMB menu. \fP"
.ti -1c
.RI "virtual void \fBhelp\fP ()"
.br
.RI "\fIIs called when the user selects 'Help' from the applet's RMB menu. \fP"
.ti -1c
.RI "virtual void \fBpreferences\fP ()"
.br
.RI "\fIIs called when the user selects 'Preferences' from the applet's RMB menu. \fP"
.ti -1c
.RI "virtual void \fBreportBug\fP ()"
.br
.RI "\fIIs called when the user selects 'Report bug' from the applet's RMB menu. \fP"
.ti -1c
.RI "Orientation \fBorientation\fP () const "
.br
.ti -1c
.RI "Position \fBposition\fP () const "
.br
.ti -1c
.RI "Alignment \fBalignment\fP () const "
.br
.ti -1c
.RI "virtual void \fBpositionChange\fP (Position p)"
.br
.RI "\fIThe panel on which this applet resides has changed its position. \fP"
.ti -1c
.RI "virtual void \fBalignmentChange\fP (Alignment)"
.br
.RI "\fIThe panel on which this applet resides has changed its alignment. \fP"
.ti -1c
.RI "virtual void \fBorientationChange\fP (Orientation)"
.br
.RI "\fIThe orientation changed to \fCorientation\fP. \fP"
.ti -1c
.RI "Direction \fBpopupDirection\fP ()"
.br
.RI "\fIYou may need this if you want to popup menus at the right position. \fP"
.ti -1c
.RI "virtual void \fBpopupDirectionChange\fP (Direction)"
.br
.RI "\fIThe popup direction changed to \fCdirection\fP. \fP"
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SS "Protected Attributes"

.in +1c
.ti -1c
.RI "KPanelAppletPrivate * \fBd\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
Implement a panel applet. \fBKDE\fP Panel Applet class. 

Panel applets 
.IP "\(bu" 2
Are small applications living in the \fBKDE\fP panel. 
.IP "\(bu" 2
Are implemented as DSOs (Dynamic Shared Objects).
.PP
Note: For security and stability reasons the panel won't load untrusted third party applets directly into its namespace but via an external wrapper process.
.PP
The panel locates available applets by searching for applet desktop files in (ALL_KDEDIRS)/share/apps/kicker/applets. Every panel applet should install a desktop file there to be recognised by the panel.
.PP
Besides standard keys like 'Name', 'Comment' and 'Icon' there are two panel applet specific keys:
.PP
\fB X-KDE-Library\fP
.PP
\fB Used by the panel to locate the applet DSO (Dynamic Shared Object) Example: X-KDE-Library=libexampleapplet\fP
.PP
\fB \fP
.PP
\fB\fB X-KDE-UniqueApplet\fP\fP
.PP
\fB\fB Similar to \fBKApplication\fP and \fBKUniqueApplication\fP there are two types of panel applets. Use unique applets when it makes no sence to run more than one instance of a applet in the panel. A good example for unique applets is the taskbar applet. Use normal applets when you need instance specific configuration. An example is the koolclock applet where you might want to run two instances in your panel, one configured as analog clock, the other one as digital clock. X-KDE-UniqueApplet is a boolean key which defaults to 'false'. Example: X-KDE-UniqueApplet=true\fP\fP
.PP
\fB\fB Back to panel applet DSOs, the following conventions are used for \fBKDE\fP: Name: lib<appletname>applet.la LDFLAGS: -module -no-undefined\fP\fP
.PP
\fB\fB To implement a panel applet it is not enough to write a class inheriting from KPanelApplet but you also have to provide a factory function in your DSO. A sample factory function could look like this:\fP\fP
.PP
\fB\fB 
.PP
.nf

.PP
\fP\fP
.PP
\fB\fB
.PP
.nf
 extern 'C'
 {
     KPanelApplet* init(QWidget *parent, const QString& configFile)
     {
         \fBKGlobal::locale()\fP->insertCatalogue('exampleapplet');
         return new ExampleApplet(configFile, KPanelApplet::Normal,
                       KPanelApplet::About | KPanelApplet::Help | KPanelApplet::Preferences,
                       parent, 'exampleapplet');
     }
 }
.PP
\fP\fP
.PP
\fB\fB
.PP
.nf
 
.PP
\fP\fP
.PP
\fB\fB Note: Don't change the factory function signature or the panel will fail to load your applet.\fP\fP
.PP
\fB\fB 
.PP
\fBAuthor:\fP
.RS 4
Matthias Elter <elter@kde.org> 
.RE
.PP
\fP\fP
.PP
Definition at line 96 of file kpanelapplet.h.
.SH "Member Enumeration Documentation"
.PP 
.SS "\fBenum\fP \fBKPanelApplet::Type\fP"
.PP
This enum describes the type of the applet. Definition at line 105 of file kpanelapplet.h.
.PP
Referenced by type().
.SS "\fBenum\fP \fBKPanelApplet::Action\fP"
.PP
This enum holds flags which can be ORed together to describe which items the context menu over the applet handle contains. Definition at line 110 of file kpanelapplet.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KPanelApplet::KPanelApplet (const \fBQString\fP & configFile, \fBType\fP t = Normal, int actions = 0, \fBQWidget\fP * parent = 0, const char * name = 0, WFlags f = 0)"
.PP
Constructs a KPanelApplet just like any other widget. \fBParameters:\fP
.RS 4
\fIconfigFile\fP The configFile handed over in the factory function. 
.br
\fIType\fP The applet \fBtype\fP(). 
.br
\fIactions\fP Standard RMB menu actions supported by the applet (see \fBaction\fP() ). 
.br
\fIparent\fP The pointer to the parent widget handed over in the factory function. 
.br
\fIname\fP A \fBQt\fP object name for your applet. 
.RE
.PP
Definition at line 30 of file kpanelapplet.cpp.
.PP
References QPalette::active(), QPalette::inactive(), KStdAccel::name(), QFrame::setFrameStyle(), and QPalette::setInactive().
.SS "KPanelApplet::~\fBKPanelApplet\fP ()"
.PP
Destructor. Definition at line 49 of file kpanelapplet.cpp.
.SH "Member Function Documentation"
.PP 
.SS "virtual int KPanelApplet::widthForHeight (int height) const\fC [inline, virtual]\fP"
.PP
Returns a suggested width for a given height. Every applet should reimplement this function.
.PP
Depending on the panel orientation the height (horizontal panel) or the width (vertical panel) of the applets is fixed. The exact values of the fixed size component depend on the panel size.
.PP
On a horizontal panel the applet height is fixed, the panel will call \fBwidthForHeight\fP(int height) with \fCheight\fP equal to 'the fixed applet height' when laying out the applets.
.PP
The applet can now choose the other size component (width) based on the given height.
.PP
The width you return is granted. Definition at line 154 of file kpanelapplet.h.
.SS "virtual int KPanelApplet::heightForWidth (int width) const\fC [inline, virtual]\fP"
.PP
\fBReturns:\fP
.RS 4
A suggested height for a given width.
.RE
.PP
Every applet should reimplement this function.
.PP
Depending on the panel orientation the height (horizontal panel) or the width (vertical panel) of the applets is fixed. The exact values of the fixed size component depend on the panel size.
.PP
On a vertical panel the applet width is fixed, the panel will call \fBheightForWidth\fP(int width) with \fCwidth\fP equal to 'the fixed applet width' when layint out the applets.
.PP
The applet can now choose the other size component (height) based on the given width.
.PP
The height you return is granted. Definition at line 175 of file kpanelapplet.h.
.SS "\fBKConfig\fP* KPanelApplet::config () const\fC [inline]\fP"
.PP
Always use this \fBKConfig\fP object to save/load your applets configuration. For unique applets this config object will write to a config file called rc in the users local \fBKDE\fP directory.
.PP
For normal applets this config object will write to a instance specific config file called rc in the users local \fBKDE\fP directory. Definition at line 186 of file kpanelapplet.h.
.SS "\fBType\fP KPanelApplet::type () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
Type indicating the applet's type. \fBType\fP 
.RE
.PP
Definition at line 192 of file kpanelapplet.h.
.PP
References Type.
.SS "int KPanelApplet::actions () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
int indicating the supported RMB menu actions. \fBAction\fP 
.RE
.PP
Definition at line 198 of file kpanelapplet.h.
.SS "void KPanelApplet::action (\fBAction\fP a)\fC [virtual]\fP"
.PP
Generic action dispatcher. Called when the user selects an item from the applets RMB menu.
.PP
Reimplement this function to handle actions.
.PP
For About, Help, Preferences and ReportBug, use the convenience handlers ref \fBabout()\fP, \fBhelp()\fP, \fBpreferences()\fP, \fBreportBug()\fP Definition at line 98 of file kpanelapplet.cpp.
.PP
References about(), help(), preferences(), and reportBug().
.SS "void KPanelApplet::updateLayout ()\fC [signal]\fP"
.PP
Emit this signal to make the panel relayout all applets, when you want to change your width (horizontal panel) or height (vertical panel). The panel is going to relayout all applets based on their widthForHeight(int height) (horizontal panel) or heightForWidth(int width) (vertical panel).
.PP
Please note that the panel may change the applets location if the new widthForHeight(int height) (horizontal panel) or heightForWidth(int width) (vertical panel) does not fit into the current panel layout. 
.SS "void KPanelApplet::requestFocus ()\fC [signal]\fP"
.PP
Request keyboard focus from the panel. 
.SS "virtual void KPanelApplet::about ()\fC [inline, protected, virtual]\fP"
.PP
Is called when the user selects 'About' from the applet's RMB menu. Reimplement this function to launch a about dialog.
.PP
Note that this is called only when your applet supports the About action. See \fBAction\fP and \fBKPanelApplet()\fP. Definition at line 252 of file kpanelapplet.h.
.PP
Referenced by action().
.SS "virtual void KPanelApplet::help ()\fC [inline, protected, virtual]\fP"
.PP
Is called when the user selects 'Help' from the applet's RMB menu. Reimplement this function to launch a manual or help page.
.PP
Note that this is called only when your applet supports the Help action. See \fBAction\fP and \fBKPanelApplet()\fP. Definition at line 261 of file kpanelapplet.h.
.PP
Referenced by action().
.SS "virtual void KPanelApplet::preferences ()\fC [inline, protected, virtual]\fP"
.PP
Is called when the user selects 'Preferences' from the applet's RMB menu. Reimplement this function to launch a preferences dialog or kcontrol module.
.PP
Note that this is called only when your applet supports the preferences action. See \fBAction\fP and \fBKPanelApplet()\fP. Definition at line 270 of file kpanelapplet.h.
.PP
Referenced by action().
.SS "virtual void KPanelApplet::reportBug ()\fC [inline, protected, virtual]\fP"
.PP
Is called when the user selects 'Report bug' from the applet's RMB menu. Reimplement this function to launch a bug reporting dialog.
.PP
Note that this is called only when your applet supports the ReportBug action. See \fBAction\fP and \fBKPanelApplet()\fP Definition at line 280 of file kpanelapplet.h.
.PP
Referenced by action().
.SS "Qt::Orientation KPanelApplet::orientation () const\fC [protected]\fP"
.PP
\fBReturns:\fP
.RS 4
the applet's orientation. (horizontal or vertical) 
.RE
.PP
Definition at line 77 of file kpanelapplet.cpp.
.PP
Referenced by positionChange().
.SS "Position KPanelApplet::position () const\fC [inline, protected]\fP"
.PP
\fBReturns:\fP
.RS 4
the applet's position. (top, left, bottom, or right) 
.RE
.PP
Definition at line 289 of file kpanelapplet.h.
.SS "Alignment KPanelApplet::alignment () const\fC [inline, protected]\fP"
.PP
\fBReturns:\fP
.RS 4
the applet's alignment. (top/left, center, or bottom/right) 
.RE
.PP
Definition at line 293 of file kpanelapplet.h.
.SS "void KPanelApplet::positionChange (Position p)\fC [protected, virtual]\fP"
.PP
The panel on which this applet resides has changed its position. Reimplement this change handler in order to adjust the look of your applet. Definition at line 69 of file kpanelapplet.cpp.
.PP
References orientation(), orientationChange(), popupDirection(), popupDirectionChange(), and QFrame::resizeEvent().
.SS "virtual void KPanelApplet::alignmentChange (Alignment)\fC [inline, protected, virtual]\fP"
.PP
The panel on which this applet resides has changed its alignment. Reimplement this change handler in order to adjust the look of your applet. Definition at line 307 of file kpanelapplet.h.
.SS "virtual void KPanelApplet::orientationChange (Orientation)\fC [inline, protected, virtual]\fP"
.PP
The orientation changed to \fCorientation\fP. Reimplement this change handler in order to adjust the look of your applet.
.PP
\fBThis class or method is obsolete, it is provided for compatibility only.\fP Reimplement positionChange instead. Definition at line 316 of file kpanelapplet.h.
.PP
Referenced by positionChange().
.SS "KPanelApplet::Direction KPanelApplet::popupDirection ()\fC [protected]\fP"
.PP
You may need this if you want to popup menus at the right position. See \fBpopupDirectionChange\fP()
.PP
\fBThis class or method is obsolete, it is provided for compatibility only.\fP Use \fBposition()\fP instead. Definition at line 87 of file kpanelapplet.cpp.
.PP
Referenced by positionChange().
.SS "virtual void KPanelApplet::popupDirectionChange (Direction)\fC [inline, protected, virtual]\fP"
.PP
The popup direction changed to \fCdirection\fP. Reimplement this change handler in order to adjust the look of your applet.
.PP
\fBThis class or method is obsolete, it is provided for compatibility only.\fP Reimplement positionChange instead. Definition at line 335 of file kpanelapplet.h.
.PP
Referenced by positionChange().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdeui Library from the source code.
