.TH "KPanelApplet" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KPanelApplet \- KDE 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
.ti -1c
.RI "enum \fBAction\fP { \fBAbout\fP =  1, \fBHelp\fP =  2, \fBPreferences\fP =  4, \fBReportBug\fP =  8 }"
.br
.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
.ti -1c
.RI "void \fBrequestFocus\fP ()"
.br
.ti -1c
.RI "void \fBrequestFocus\fP (bool focus)"
.br
.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
.ti -1c
.RI "\fB~KPanelApplet\fP ()"
.br
.ti -1c
.RI "virtual int \fBwidthForHeight\fP (int height) const "
.br
.ti -1c
.RI "virtual int \fBheightForWidth\fP (int width) const "
.br
.ti -1c
.RI "\fBKConfig\fP * \fBconfig\fP () const "
.br
.ti -1c
.RI "\fBKSharedConfig::Ptr\fP \fBsharedConfig\fP () const "
.br
.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
.ti -1c
.RI "const \fBQPopupMenu\fP * \fBcustomMenu\fP () const "
.br
.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
.ti -1c
.RI "virtual void \fBhelp\fP ()"
.br
.ti -1c
.RI "virtual void \fBpreferences\fP ()"
.br
.ti -1c
.RI "virtual void \fBreportBug\fP ()"
.br
.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
.ti -1c
.RI "virtual void \fBalignmentChange\fP (Alignment)"
.br
.ti -1c
.RI "void \fBsetCustomMenu\fP (const \fBQPopupMenu\fP *)"
.br
.ti -1c
.RI "void \fBwatchForFocus\fP (\fBQWidget\fP *widget, bool watch=true)"
.br
.ti -1c
.RI "void \fBneedsFocus\fP (bool focus)"
.br
.ti -1c
.RI "virtual KDE_DEPRECATED void \fBorientationChange\fP (Orientation)"
.br
.ti -1c
.RI "Direction \fBpopupDirection\fP ()"
.br
.ti -1c
.RI "virtual KDE_DEPRECATED void \fBpopupDirectionChange\fP (Direction)"
.br
.ti -1c
.RI "bool \fBeventFilter\fP (\fBQObject\fP *, \fBQEvent\fP *)"
.br
.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 
KDE Panel Applet class 

Panel applets 
.PD 0

.IP "\(bu" 2
Are small applications living in the KDE 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_DIRS)/share/apps/kicker/applets. Every panel applet should install a desktop file there to be recognized by the panel.
.PP
Besides standard keys like 'Name', 'Comment' and 'Icon' there are two panel applet specific keys:
.PP
\fBX-KDE-Library\fP 
.br
.PP
Used by the panel to locate the applet DSO (Dynamic Shared Object) Example: X-KDE-Library=libexampleapplet
.PP
\fBX-KDE-UniqueApplet\fP 
.br
.PP
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
.PP
Back to panel applet DSOs, the following conventions are used for KDE: Name: lib<appletname>applet.la LDFLAGS: -module -no-undefined
.PP
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:
.PP
.PP
.nf
 extern 'C'
 {
     KPanelApplet* init(QWidget *parent, const QString& configFile)
     {
         KGlobal::locale()->insertCatalogue('exampleapplet');
         return new ExampleApplet(configFile, KPanelApplet::Normal,
                       KPanelApplet::About | KPanelApplet::Help | KPanelApplet::Preferences,
                       parent, 'exampleapplet');
     }
 }
.fi
.PP
.PP
Note: Don't change the factory function signature or the panel will fail to load your applet.
.PP
\fBAuthor:\fP
.RS 4
Matthias Elter <elter@kde.org> 
.RE
.PP

.PP
Definition at line 97 of file kpanelapplet.h.
.SH "Member Enumeration Documentation"
.PP 
.SS "\fBenum\fP \fBKPanelApplet::Type\fP"
.PP
This enum describes the type of the applet. 
.PP
Definition at line 106 of file kpanelapplet.h.
.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. 
.PP
Definition at line 112 of file kpanelapplet.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KPanelApplet::KPanelApplet (const \fBQString\fP & configFile, \fBType\fP t = \fCNormal\fP, int actions = \fC0\fP, \fBQWidget\fP * parent = \fC0\fP, const char * name = \fC0\fP, WFlags f = \fC0\fP)"
.PP
Constructs a KPanelApplet just like any other widget. 
.PP
\fBParameters:\fP
.RS 4
\fIconfigFile\fP The configFile handed over in the factory function. 
.br
\fIt\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. 
.br
\fIf\fP Window control flags 
.RE
.PP

.PP
Definition at line 45 of file kpanelapplet.cpp.
.PP
References QPalette::active(), QPalette::inactive(), KSharedConfig::openConfig(), QFrame::setFrameStyle(), and QPalette::setInactive().
.SS "KPanelApplet::~\fBKPanelApplet\fP ()"
.PP
Destructor. 
.PP
Definition at line 67 of file kpanelapplet.cpp.
.PP
References needsFocus().
.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. 
.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 horizontal panel the applet height is fixed, the panel will call widthForHeight(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. 
.PP
Definition at line 155 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 heightForWidth(int width) with \fCwidth\fP equal to 'the fixed applet width' when laying 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. 
.PP
Definition at line 176 of file kpanelapplet.h.
.SS "\fBKConfig\fP* KPanelApplet::config () const\fC [inline]\fP"
.PP
Always use this \fBKConfig\fP object to save/load your applet's configuration. 
.PP
For unique applets this config object will write to a config file called <appletname>rc in the user's local KDE directory.
.PP
For normal applets this config object will write to a instance specific config file called <appletname><instanceid>rc in the user's local KDE directory. 
.PP
Definition at line 187 of file kpanelapplet.h.
.SS "\fBType\fP KPanelApplet::type () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
Type indicating the applet's type. Type 
.RE
.PP

.PP
Definition at line 194 of file kpanelapplet.h.
.SS "int KPanelApplet::actions () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
int indicating the supported RMB menu actions. Action 
.RE
.PP

.PP
Definition at line 200 of file kpanelapplet.h.
.SS "void KPanelApplet::action (\fBAction\fP a)\fC [virtual]\fP"
.PP
Generic action dispatcher. 
.PP
Called when the user selects an item from the applet's 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 
.PP
Definition at line 118 of file kpanelapplet.cpp.
.PP
References about(), help(), preferences(), and reportBug().
.SS "const \fBQPopupMenu\fP * KPanelApplet::customMenu () const"
.PP
\fBReturns:\fP
.RS 4
the applet's custom menu, usually the same as the context menu, or 0 if none see setCustomMenu(QPopupMenu*) 
.RE
.PP

.PP
Definition at line 130 of file kpanelapplet.cpp.
.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). 
.PP
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 applet's 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. 
.PP
\fBDeprecated\fP
.RS 4
.RE
.PP

.PP
Referenced by needsFocus().
.SS "void KPanelApplet::requestFocus (bool focus)\fC [signal]\fP"
.PP
Request keyboard focus from the panel. 
.PP
Applets should never call this directly but rather call \fBneedsFocus(bool)\fP 
.PP
\fBSee also:\fP
.RS 4
\fBneedsFocus\fP 
.RE
.PP
\fBParameters:\fP
.RS 4
\fIfocus\fP activate the window and ensure the panel remains visible when true Each and ever time a requestFocus(true) is emitted, it MUST be paired eventually with a requestFocus(false) otherwise the panel may end up never hiding 
.RE
.PP
\fBSince:\fP
.RS 4
3.4 
.RE
.PP

.SS "virtual void KPanelApplet::about ()\fC [inline, protected, virtual]\fP"
.PP
Is called when the user selects 'About' from the applet's RMB menu. 
.PP
Reimplement this function to launch a about dialog.
.PP
Note that this is called only when your applet supports the About action. See Action and \fBKPanelApplet()\fP. 
.PP
Definition at line 272 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. 
.PP
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 Action and \fBKPanelApplet()\fP. 
.PP
Definition at line 281 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. 
.PP
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 Action and \fBKPanelApplet()\fP. 
.PP
Definition at line 290 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. 
.PP
Reimplement this function to launch a bug reporting dialog.
.PP
Note that this is called only when your applet supports the ReportBug action. See Action and \fBKPanelApplet()\fP 
.PP
Definition at line 300 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

.PP
Definition at line 97 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

.PP
Definition at line 309 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

.PP
Definition at line 313 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. 
.PP
Reimplement this change handler in order to adjust the look of your applet. 
.PP
Definition at line 89 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. 
.PP
Reimplement this change handler in order to adjust the look of your applet. 
.PP
Definition at line 327 of file kpanelapplet.h.
.SS "void KPanelApplet::setCustomMenu (const \fBQPopupMenu\fP *)\fC [protected]\fP"
.PP
Use this method to set the custom menu for this applet so that it can be shown in the applet handle menu and other appropriate places that the applet many not itself be aware of. 
.PP
The applet itself is still responsible for deleting and managing the the menu.
.PP
If the menu is deleted during the life of the applet, be sure to call this method again with the new menu (or 0) to avoid crashes 
.PP
Definition at line 135 of file kpanelapplet.cpp.
.SS "void KPanelApplet::watchForFocus (\fBQWidget\fP * widget, bool watch = \fCtrue\fP)\fC [protected]\fP"
.PP
Register widgets that can receive keyboard focus with this this method This call results in an eventFilter being places on the widget. 
.PP
\fBParameters:\fP
.RS 4
\fIwidget\fP the widget to watch for keyboard focus 
.br
\fIwatch\fP whether to start watching the widget, or to stop doing so 
.RE
.PP
\fBSince:\fP
.RS 4
3.4 
.RE
.PP

.PP
Definition at line 140 of file kpanelapplet.cpp.
.SS "void KPanelApplet::needsFocus (bool focus)\fC [protected]\fP"
.PP
Call this whenever focus is needed or not needed. 
.PP
You do not have to call this method for widgets that have been registered with watchForFocus 
.PP
\fBParameters:\fP
.RS 4
\fIfocus\fP whether to or not to request focus 
.RE
.PP
\fBSince:\fP
.RS 4
3.4 
.RE
.PP

.PP
Definition at line 162 of file kpanelapplet.cpp.
.PP
References requestFocus().
.PP
Referenced by ~KPanelApplet().
.SS "virtual KDE_DEPRECATED void KPanelApplet::orientationChange (Orientation)\fC [inline, protected, virtual]\fP"
.PP
The orientation changed to \fCorientation\fP. 
.PP
Reimplement this change handler in order to adjust the look of your applet.
.PP
\fBDeprecated\fP
.RS 4
Reimplement positionChange instead. 
.RE
.PP

.PP
Definition at line 364 of file kpanelapplet.h.
.PP
Referenced by positionChange().
.SS "KPanelApplet::Direction KPanelApplet::popupDirection ()\fC [protected]\fP"
.PP
A convenience method that translates the position of the applet into which direction to show a popup. 
.PP
Definition at line 107 of file kpanelapplet.cpp.
.PP
Referenced by positionChange().
.SS "virtual KDE_DEPRECATED void KPanelApplet::popupDirectionChange (Direction)\fC [inline, protected, virtual]\fP"
.PP
The popup direction changed to \fCdirection\fP. 
.PP
Reimplement this change handler in order to adjust the look of your applet.
.PP
\fBDeprecated\fP
.RS 4
Reimplement positionChange instead. 
.RE
.PP

.PP
Definition at line 379 of file kpanelapplet.h.
.PP
Referenced by positionChange().

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