• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

Public Types | Signals | Public Member Functions | Protected Member Functions | List of all members
KPanelExtension Class Reference

#include <kpanelextension.h>

Inherits TQFrame.

Public Types

enum  Type { Normal = 0 , Stretch }
 
enum  Action { About = 1 , Help = 2 , Preferences = 4 , ReportBug = 8 }
 
enum  Position {
  Left = 0 , Right , Top , Bottom ,
  Floating
}
 
enum  Alignment { LeftTop = 0 , Center , RightBottom }
 
enum  Size {
  SizeTiny = 0 , SizeSmall , SizeNormal , SizeLarge ,
  SizeCustom
}
 

Signals

void updateLayout ()
 
void maintainFocus (bool)
 

Public Member Functions

 KPanelExtension (const TQString &configFile, Type t=Normal, int actions=0, TQWidget *parent=0, const char *name=0)
 
 ~KPanelExtension ()
 
virtual TQSize sizeHint (Position, TQSize maxsize) const
 
TDEConfig * config () const
 
Type type () const
 
int actions () const
 
virtual void action (Action a)
 
virtual Position preferedPosition () const
 
void setPosition (Position p)
 
void setAlignment (Alignment a)
 
void setSize (Size size, int customSize)
 
Size sizeSetting () const
 
int customSize () const
 
TQPopupMenu * customMenu () const
 
bool reserveStrut () const
 

Protected Member Functions

virtual void about ()
 
virtual void help ()
 
virtual void preferences ()
 
virtual void reportBug ()
 
Position position () const
 
Alignment alignment () const
 
Orientation orientation ()
 
int sizeInPixels () const
 
virtual void positionChange (Position)
 
virtual void alignmentChange (Alignment)
 
void setCustomMenu (TQPopupMenu *)
 
void setReserveStrut (bool shouldUseStrut)
 
virtual void virtual_hook (int id, void *data)
 

Detailed Description

TDE Panel Extension class

Panel extensions

  • Are small applications living in the Window Manager dock managed by the panel.
  • Are implemented as DSOs (Dynamic Shared Objects).

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_TDEDIRS)/share/apps/kicker/extensions. Every panel extension should install a desktop file there to be recognized by the panel.

Besides standard keys like "Name", "Comment" and "Icon" there are two panel extension specific keys:

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

X-TDE-UniqueExtension
Similar to TDEApplication and TDEUniqueApplication 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-TDE-UniqueExtension is a boolean key which defaults to "false". Example: X-TDE-UniqueExtension=true

Back to panel extension DSOs, the following conventions are used for 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 KPanelExtension but you also have to provide a factory function in your DSO. A sample factory function could look like this:

extern "C"
{
KPanelExtension* init(TQWidget *parent, const TQString& configFile)
{
TDEGlobal::locale()->insertCatalogue("exampleextension");
return new ExampleExtension(configFile, KPanelExtension::Normal,
KPanelExtension::About | KPanelExtension::Help | KPanelExtension::Preferences,
parent, "exampleextension");
}
}
KPanelExtension
TDE Panel Extension class
Definition: kpanelextension.h:98
TDEGlobal::locale
static TDELocale * locale()
TDELocale::insertCatalogue
void insertCatalogue(const TQString &catalog)

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

Author
Matthias Elter elter.nosp@m.@kde.nosp@m..org

Definition at line 97 of file kpanelextension.h.

Member Enumeration Documentation

◆ Action

enum KPanelExtension::Action

An action to be taken sometime.

Definition at line 107 of file kpanelextension.h.

◆ Alignment

enum KPanelExtension::Alignment

Definition at line 109 of file kpanelextension.h.

◆ Position

enum KPanelExtension::Position

Definition at line 108 of file kpanelextension.h.

◆ Size

enum KPanelExtension::Size
Since
3.1

Definition at line 111 of file kpanelextension.h.

◆ Type

enum KPanelExtension::Type

The type of the extension (TODO)

Definition at line 104 of file kpanelextension.h.

Constructor & Destructor Documentation

◆ KPanelExtension()

KPanelExtension::KPanelExtension ( const TQString &  configFile,
Type  t = Normal,
int  actions = 0,
TQWidget *  parent = 0,
const char *  name = 0 
)

Constructs a KPanelExtension just like any other widget.

Parameters
configFileThe configFile handed over in the factory function.
tThe extension type().
actionsStandard RMB menu actions supported by the extension (see action() ).
parentThe pointer to the parent widget handed over in the factory function.
nameA Qt object name for your extension.

Definition at line 47 of file kpanelextension.cpp.

◆ ~KPanelExtension()

KPanelExtension::~KPanelExtension ( )

Destructor.

Definition at line 61 of file kpanelextension.cpp.

Member Function Documentation

◆ about()

virtual void KPanelExtension::about ( )
inlineprotectedvirtual

Is called when the user selects "About" 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.

◆ action()

void KPanelExtension::action ( Action  a)
virtual

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 ReportBug use the convenience handlers ref about(), help(), preferences(), reportBug()

Definition at line 89 of file kpanelextension.cpp.

◆ actions()

int KPanelExtension::actions ( ) const
inline
Returns
int indicating the supported RMB menu actions. Action

Definition at line 162 of file kpanelextension.h.

◆ alignment()

Alignment KPanelExtension::alignment ( ) const
inlineprotected
Returns
the extension's alignment. (left/top, center, or right/bottom)

Definition at line 287 of file kpanelextension.h.

◆ alignmentChange()

virtual void KPanelExtension::alignmentChange ( Alignment  )
inlineprotectedvirtual

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.

◆ config()

TDEConfig * KPanelExtension::config ( ) const
inline

Always use this TDEConfig 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 KDE directory.

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

Definition at line 150 of file kpanelextension.h.

◆ customMenu()

TQPopupMenu * KPanelExtension::customMenu ( ) const
Returns
the extension's custom menu, usually the same as the context menu, or 0 if none
See also
setCustomMenu(TQPopupMenu*)
Since
3.4

Definition at line 141 of file kpanelextension.cpp.

◆ customSize()

int KPanelExtension::customSize ( ) const
Returns
the custom sizel setting in pixels
Since
3.1

Definition at line 114 of file kpanelextension.cpp.

◆ help()

virtual void KPanelExtension::help ( )
inlineprotectedvirtual

Is called when the user selects "Help" 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.

◆ maintainFocus

void KPanelExtension::maintainFocus ( bool  )
signal

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

don't autohide

Since
3.4

◆ orientation()

TQt::Orientation KPanelExtension::orientation ( )
protected
Returns
the extensions orientation. (horizontal or vertical)

Definition at line 101 of file kpanelextension.cpp.

◆ position()

Position KPanelExtension::position ( ) const
inlineprotected
Returns
the extension's position. (left, right, top, bottom)

Definition at line 282 of file kpanelextension.h.

◆ positionChange()

virtual void KPanelExtension::positionChange ( Position  )
inlineprotectedvirtual

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.

◆ preferedPosition()

virtual Position KPanelExtension::preferedPosition ( ) const
inlinevirtual

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.

Returns
Position

Definition at line 183 of file kpanelextension.h.

◆ preferences()

virtual void KPanelExtension::preferences ( )
inlineprotectedvirtual

Is called when the user selects "Preferences" 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.

◆ reportBug()

virtual void KPanelExtension::reportBug ( )
inlineprotectedvirtual

Is called when the user selects "Report bug" 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 ReportBug action. See Action.

Definition at line 277 of file kpanelextension.h.

◆ reserveStrut()

bool KPanelExtension::reserveStrut ( ) const
Returns
whether or not to set a desktop geometry claiming strut for this panel defaults to true
See also
setReservetrut(bool)
Since
3.4

Definition at line 151 of file kpanelextension.cpp.

◆ setAlignment()

void KPanelExtension::setAlignment ( Alignment  a)

Definition at line 74 of file kpanelextension.cpp.

◆ setCustomMenu()

void KPanelExtension::setCustomMenu ( TQPopupMenu *  menu)
protected

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

Since
3.4

Definition at line 146 of file kpanelextension.cpp.

◆ setPosition()

void KPanelExtension::setPosition ( Position  p)

Definition at line 67 of file kpanelextension.cpp.

◆ setReserveStrut()

void KPanelExtension::setReserveStrut ( bool  shouldUseStrut)
protected

Use this method to set the return value for reserveStrut.

See also
reserveStrut
Since
3.4

Definition at line 156 of file kpanelextension.cpp.

◆ setSize()

void KPanelExtension::setSize ( Size  size,
int  customSize 
)
Since
3.1

Definition at line 81 of file kpanelextension.cpp.

◆ sizeHint()

virtual TQSize KPanelExtension::sizeHint ( Position  ,
TQSize  maxsize 
) const
inlinevirtual

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.

◆ sizeInPixels()

int KPanelExtension::sizeInPixels ( ) const
protected
Returns
the appropriate size in pixels for the panel
Since
3.1

Definition at line 119 of file kpanelextension.cpp.

◆ sizeSetting()

KPanelExtension::Size KPanelExtension::sizeSetting ( ) const
Returns
the extension's size
Since
3.1

Definition at line 109 of file kpanelextension.cpp.

◆ type()

Type KPanelExtension::type ( ) const
inline
Returns
Type indicating the extensions type. Type

Definition at line 156 of file kpanelextension.h.

◆ updateLayout

void KPanelExtension::updateLayout ( )
signal

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.

◆ virtual_hook()

void KPanelExtension::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 161 of file kpanelextension.cpp.


The documentation for this class was generated from the following files:
  • kpanelextension.h
  • kpanelextension.cpp

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.