class KPanelApplet

KDE Panel Applet class. More...

Definition#include <kpanelapplet.h>
InheritsDCOPObject (dcop) [private], QWidget (kdecore)
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods


Detailed Description

KDE Panel Applet class

This class implements panel applets.

 KPanelApplet ( QWidget* parent = 0, const char* name = 0 )

Construct a KApplet widget just like any other widget.

KPanelApplet ()

[virtual]

Destructor

void  init ( int& argc, char ** argv )

Initialize the applet according to the passed command line parameters. Call this function after instantiating the applet widget in your main() function.

Evalutate some command line arguments and get docked by the panel.

void  setFlags (int f)

Set the applet flags.

Supported flags:

Stretch: -------- Most applets might want to have a fixed size. Applets like a taskbar however can set the stretch flag to get all space available on the panel between the two surrounding applets and/or the panel borders.

TopLevel: --------- Some applets do not want to dock into the panel but map toplevel windows only. A example is the kasbar applet.

bool  flags ()

Returns: int indicating the applet flags.

void  setActions ( int a)

Set the RMB menu actions supported by the applet

The panel supports 3 default actions besides 'Move' and 'Remove' in the applets RMB menu:

About - Launch about dialog. Help - Show applet manual/help. Preferences - Launch preferences dialog.

Not all of these make sense/are supported by all applets, so you can use this method to enable the actions supported by your applet.

Example: setActions( About | Help | Preferences );

int  actions ()

Returns: a int indicating the supported RMB menu actions.

int  widthForHeight (int height)

[virtual]

Applets should reimplement this function.

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.

On a horizontal panel the applet height is fixed, the panel will call widthForHeight(int height) with height == 'the fixed applet height' when layouting the applets.

The applet can now choose the other size component (width) based on the given height.

The width you return is guaranteed.

Returns: A suggested width for a given height.

int  heightForWidth (int width)

[virtual]

Applets should reimplement this function.

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.

On a vertical panel the applet width is fixed, the panel will call heightForWidth(int width) with width == 'the fixed applet width' when layouting the applets.

The applet can now choose the other size component (height) based on the given width.

The height you return is guaranteed.

Returns: A suggested height for a given width.

void  removedFromPanel ()

[virtual]

Is called when the applet is removed from the panel.

The default implementation will simply call "kapp->quit()". If the KPanelApplet widget is only a part of a bigger application you might want to reimplement this to avoid the app shutdown and do something else like simply deleting the applet widget instead.

void  about ()

[virtual]

Is called when 'About' is selcted from the applets RMB menu.

There is no default implementation. Reimplement this to launch a about dialog in for your applet.

void  help ()

[virtual]

Is called when 'Help' is selcted from the applets RMB menu.

There is no default implementation. Reimplement this to launch the applet-manual / help for your applet.

void  preferences ()

[virtual]

Is called when 'Preferences' is selcted from the applets RMB menu.

There is no default implementation. Reimplement this to launch a preferences dialog for your applet.

void  updateLayout ()

Notify the panel about a new applet layout.

Call this 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).

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.

Orientation  orientation ()

[const]

Returns: The panel orientation. You may need this if you want to popup menus at the right position.

Position  position ()

[const]

Returns: The panel position. You may need this if you want to popup menus at the right position.