2005-12-29 22:55:22 +01:00
|
|
|
/*
|
2007-08-06 13:20:02 +02:00
|
|
|
* Copyright 2006-2007 by Aaron Seigo <aseigo@kde.org>
|
|
|
|
* Copyright 2007 by Riccardo Iaconelli <riccardo@kde.org>
|
2005-12-29 22:55:22 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2007-09-14 21:06:18 +02:00
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2, or
|
|
|
|
* (at your option) any later version.
|
2005-12-29 22:55:22 +01:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc.,
|
2006-01-23 12:37:31 +01:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-12-29 22:55:22 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLASMA_APPLET_H
|
|
|
|
#define PLASMA_APPLET_H
|
|
|
|
|
2007-06-20 08:45:08 +02:00
|
|
|
#include <QtGui/QGraphicsItem>
|
2007-04-22 11:35:04 +02:00
|
|
|
#include <QtGui/QWidget>
|
2005-12-29 22:55:22 +01:00
|
|
|
|
2008-03-02 03:18:10 +01:00
|
|
|
#include <KDE/KPluginInfo>
|
|
|
|
#include <KDE/KGenericFactory>
|
2005-12-29 22:55:22 +01:00
|
|
|
|
2007-07-30 18:19:07 +02:00
|
|
|
#include <plasma/configxml.h>
|
2008-02-15 11:35:00 +01:00
|
|
|
#include <plasma/packagestructure.h>
|
2007-06-02 19:29:39 +02:00
|
|
|
#include <plasma/plasma.h>
|
2007-07-12 20:34:53 +02:00
|
|
|
#include <plasma/widgets/widget.h>
|
2005-12-29 22:55:22 +01:00
|
|
|
|
2008-04-02 17:37:17 +02:00
|
|
|
class KConfigDialog;
|
|
|
|
|
2005-12-29 22:55:22 +01:00
|
|
|
namespace Plasma
|
|
|
|
{
|
2007-06-02 19:29:39 +02:00
|
|
|
|
2007-09-18 23:22:45 +02:00
|
|
|
class Containment;
|
2007-06-02 19:29:39 +02:00
|
|
|
class DataEngine;
|
2007-07-20 05:34:20 +02:00
|
|
|
class Package;
|
2007-06-02 19:29:39 +02:00
|
|
|
|
2007-05-22 20:29:12 +02:00
|
|
|
/**
|
2007-07-28 21:59:22 +02:00
|
|
|
* @short The base Applet class
|
2007-05-22 20:29:12 +02:00
|
|
|
*
|
2007-07-28 21:59:22 +02:00
|
|
|
* Applet provides several important roles for add-ons widgets in Plasma.
|
2007-05-23 17:47:27 +02:00
|
|
|
*
|
2007-07-28 21:59:22 +02:00
|
|
|
* First, it is the base class for the plugin system and therefore is the
|
|
|
|
* interface to applets for host applications. It also handles the life time
|
|
|
|
* management of data engines (e.g. all data engines accessed via
|
2007-12-05 23:31:23 +01:00
|
|
|
* Applet::dataEngine(const QString&) are properly deref'd on Applet
|
2007-07-28 21:59:22 +02:00
|
|
|
* destruction), background painting (allowing for consistent and complex
|
|
|
|
* look and feel in just one line of code for applets), loading and starting
|
|
|
|
* of scripting support for each applet, providing access to the associated
|
|
|
|
* plasmoid package (if any) and access to configuration data.
|
|
|
|
*
|
|
|
|
* See techbase.kde.org for tutorial on writing Applets using this class.
|
2007-05-22 20:29:12 +02:00
|
|
|
*/
|
2007-09-28 07:46:37 +02:00
|
|
|
class PLASMA_EXPORT Applet : public Widget
|
2005-12-29 22:55:22 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2007-07-24 23:04:31 +02:00
|
|
|
// Q_PROPERTY( QRectF maxSizeHint READ maxSizeHint )
|
2008-01-10 20:02:05 +01:00
|
|
|
Q_PROPERTY(bool hasConfigurationInterface READ hasConfigurationInterface WRITE setHasConfigurationInterface)
|
|
|
|
Q_PROPERTY(QString name READ name)
|
|
|
|
Q_PROPERTY(QString category READ category)
|
|
|
|
Q_PROPERTY(bool immutable READ isImmutable WRITE setImmutable)
|
|
|
|
Q_PROPERTY(bool drawStandardBackground READ drawStandardBackground WRITE setDrawStandardBackground)
|
|
|
|
Q_PROPERTY(bool failedToLaunch READ failedToLaunch WRITE setFailedToLaunch)
|
|
|
|
Q_PROPERTY(bool needsConfiguring READ needsConfiguring WRITE setNeedsConfiguring)
|
|
|
|
Q_PROPERTY(QRectF boundingRect READ boundingRect)
|
|
|
|
Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry)
|
|
|
|
Q_PROPERTY(bool shouldConserveResources READ shouldConserveResources)
|
|
|
|
Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode)
|
2005-12-29 22:55:22 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
typedef QList<Applet*> List;
|
2007-05-24 22:01:12 +02:00
|
|
|
typedef QHash<QString, Applet*> Dict;
|
2005-12-29 22:55:22 +01:00
|
|
|
|
2007-05-22 20:29:12 +02:00
|
|
|
/**
|
2008-03-28 08:42:25 +01:00
|
|
|
* @param parent the QGraphicsItem this applet is parented to
|
|
|
|
* @param serviceId the name of the .desktop file containing the
|
2007-05-22 20:29:12 +02:00
|
|
|
* information about the widget
|
2008-03-28 08:42:25 +01:00
|
|
|
* @param appletId a unique id used to differentiate between multiple
|
2007-05-22 20:29:12 +02:00
|
|
|
* instances of the same Applet type
|
|
|
|
*/
|
2007-07-12 20:34:53 +02:00
|
|
|
explicit Applet(QGraphicsItem* parent = 0,
|
|
|
|
const QString& serviceId = QString(),
|
|
|
|
uint appletId = 0);
|
2007-05-25 04:36:22 +02:00
|
|
|
|
2007-05-24 22:01:12 +02:00
|
|
|
/**
|
|
|
|
* This constructor is to be used with the plugin loading systems
|
|
|
|
* found in KPluginInfo and KService. The argument list is expected
|
|
|
|
* to have two elements: the KService service ID for the desktop entry
|
|
|
|
* and an applet ID which must be a base 10 number.
|
|
|
|
*
|
2008-03-28 08:42:25 +01:00
|
|
|
* @param parent a QObject parent; you probably want to pass in 0
|
|
|
|
* @param args a list of strings containing two entries: the service id
|
2007-05-24 22:01:12 +02:00
|
|
|
* and the applet id
|
|
|
|
*/
|
2007-08-29 04:33:22 +02:00
|
|
|
Applet(QObject* parent, const QVariantList& args);
|
2007-05-24 22:01:12 +02:00
|
|
|
|
2005-12-29 22:55:22 +01:00
|
|
|
~Applet();
|
|
|
|
|
2008-02-15 11:35:00 +01:00
|
|
|
/**
|
|
|
|
* @return a package structure representing a Theme
|
|
|
|
*/
|
2008-02-26 05:08:51 +01:00
|
|
|
static PackageStructure::Ptr packageStructure();
|
2008-02-15 11:35:00 +01:00
|
|
|
|
2007-09-13 19:00:57 +02:00
|
|
|
/**
|
|
|
|
* This method is called once the applet is loaded and added to a Corona.
|
|
|
|
* If the applet requires a QGraphicsScene or has an particularly intensive
|
|
|
|
* set of initialization routines to go through, consider implementing it
|
2007-10-19 23:43:27 +02:00
|
|
|
* in this method instead of the constructor.
|
2007-09-13 19:00:57 +02:00
|
|
|
**/
|
|
|
|
virtual void init();
|
|
|
|
|
2007-08-05 15:01:09 +02:00
|
|
|
/**
|
|
|
|
* @return the id of this applet
|
|
|
|
*/
|
|
|
|
uint id() const;
|
|
|
|
|
2005-12-29 22:55:22 +01:00
|
|
|
/**
|
2007-05-25 04:36:22 +02:00
|
|
|
* Returns the KConfigGroup to access the applets configuration.
|
2005-12-29 22:55:22 +01:00
|
|
|
*
|
2007-05-25 04:36:22 +02:00
|
|
|
* This config object will write to an instance
|
2006-04-13 02:11:16 +02:00
|
|
|
* specific config file named \<appletname\>\<instanceid\>rc
|
2007-05-25 04:36:22 +02:00
|
|
|
* in the Plasma appdata directory.
|
2005-12-29 22:55:22 +01:00
|
|
|
**/
|
2007-07-12 21:14:23 +02:00
|
|
|
KConfigGroup config() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a config group with the name provided. This ensures
|
|
|
|
* that the group name is properly namespaced to avoid collision
|
|
|
|
* with other applets that may be sharing this config file
|
|
|
|
*
|
|
|
|
* @param group the name of the group to access
|
|
|
|
**/
|
2007-11-25 00:38:37 +01:00
|
|
|
KConfigGroup config(const QString &group) const;
|
2005-12-29 22:55:22 +01:00
|
|
|
|
2007-09-18 23:22:45 +02:00
|
|
|
/**
|
|
|
|
* Saves state information about this applet.
|
|
|
|
**/
|
|
|
|
void save(KConfigGroup* group) const;
|
|
|
|
|
2008-02-13 02:52:02 +01:00
|
|
|
/**
|
|
|
|
* Restores state information about this applet.
|
|
|
|
**/
|
|
|
|
void restore(KConfigGroup* group);
|
|
|
|
|
2006-04-13 02:11:16 +02:00
|
|
|
/**
|
2007-05-25 04:36:22 +02:00
|
|
|
* Returns a KConfigGroup object to be shared by all applets of this
|
|
|
|
* type.
|
|
|
|
*
|
|
|
|
* This config object will write to an applet-specific config object
|
|
|
|
* named plasma_\<appletname\>rc in the local config directory.
|
2006-04-13 02:11:16 +02:00
|
|
|
*/
|
2007-07-12 21:14:23 +02:00
|
|
|
KConfigGroup globalConfig() const;
|
2006-04-13 02:11:16 +02:00
|
|
|
|
2007-07-30 18:19:07 +02:00
|
|
|
/**
|
|
|
|
* Returns the config skeleton object from this applet's package,
|
|
|
|
* if any.
|
|
|
|
*
|
|
|
|
* @return config skeleton object, or 0 if none
|
|
|
|
**/
|
2007-08-05 11:39:32 +02:00
|
|
|
ConfigXml* configXml() const;
|
2007-07-30 18:19:07 +02:00
|
|
|
|
2006-04-13 02:11:16 +02:00
|
|
|
/**
|
2007-07-11 03:24:43 +02:00
|
|
|
* Loads the given DataEngine
|
2006-04-13 02:11:16 +02:00
|
|
|
*
|
2007-07-11 03:24:43 +02:00
|
|
|
* Tries to load the data engine given by @p name. Each engine is
|
|
|
|
* only loaded once, and that instance is re-used on all subsequent
|
|
|
|
* requests.
|
|
|
|
*
|
|
|
|
* If the data engine was not found, an invalid data engine is returned
|
|
|
|
* (see DataEngine::isValid()).
|
|
|
|
*
|
|
|
|
* Note that you should <em>not</em> delete the returned engine.
|
|
|
|
*
|
|
|
|
* @param name Name of the data engine to load
|
|
|
|
* @return pointer to the data engine if it was loaded,
|
|
|
|
* or an invalid data engine if the requested engine
|
|
|
|
* could not be loaded
|
2006-04-13 02:11:16 +02:00
|
|
|
*/
|
2007-08-05 14:39:13 +02:00
|
|
|
Q_INVOKABLE DataEngine* dataEngine(const QString& name) const;
|
2007-07-20 05:34:20 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Accessor for the associated Package object if any.
|
|
|
|
* Generally, only Plasmoids come in a Package.
|
|
|
|
*
|
|
|
|
* @return the Package object, or 0 if none
|
|
|
|
**/
|
|
|
|
const Package* package() const;
|
2006-04-13 02:11:16 +02:00
|
|
|
|
2007-08-05 10:41:55 +02:00
|
|
|
/**
|
|
|
|
* Called when any of the geometry constraints have been updated.
|
|
|
|
* This method calls constraintsUpdated, which may be reimplemented,
|
|
|
|
* once the Applet has been prepared for updating the constraints.
|
2007-10-02 01:24:38 +02:00
|
|
|
*
|
|
|
|
* @param constraints the type of constraints that were updated
|
2007-08-05 10:41:55 +02:00
|
|
|
*/
|
2007-10-02 01:30:47 +02:00
|
|
|
void updateConstraints(Plasma::Constraints constraints = Plasma::AllConstraints);
|
2007-08-05 10:41:55 +02:00
|
|
|
|
2006-04-13 02:11:16 +02:00
|
|
|
/**
|
2007-07-07 00:20:57 +02:00
|
|
|
* Called when any of the geometry constraints have been updated.
|
|
|
|
*
|
|
|
|
* This is always called prior to painting and should be used as an
|
2005-12-29 22:55:22 +01:00
|
|
|
* opportunity to layout the widget, calculate sizings, etc.
|
2007-06-01 00:40:38 +02:00
|
|
|
*
|
|
|
|
* Do not call update() from this method; an update() will be triggered
|
|
|
|
* at the appropriate time for the applet.
|
|
|
|
*
|
2007-10-02 01:24:38 +02:00
|
|
|
* @param constraints the type of constraints that were updated
|
2005-12-29 22:55:22 +01:00
|
|
|
* @property constraint
|
|
|
|
*/
|
2007-10-02 01:24:38 +02:00
|
|
|
virtual void constraintsUpdated(Plasma::Constraints constraints);
|
2005-12-29 22:55:22 +01:00
|
|
|
|
2007-06-01 00:40:38 +02:00
|
|
|
/**
|
|
|
|
* Returns the current form factor the applet is being displayed in.
|
2007-07-07 00:20:57 +02:00
|
|
|
*
|
2007-06-01 00:40:38 +02:00
|
|
|
* @see Plasma::FormFactor
|
|
|
|
*/
|
2007-09-18 23:22:45 +02:00
|
|
|
virtual FormFactor formFactor() const;
|
2007-06-01 00:40:38 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the location of the scene which is displaying applet.
|
2007-07-07 00:20:57 +02:00
|
|
|
*
|
2007-06-01 00:40:38 +02:00
|
|
|
* @see Plasma::Location
|
|
|
|
*/
|
2007-09-18 23:22:45 +02:00
|
|
|
virtual Location location() const;
|
2007-06-01 00:40:38 +02:00
|
|
|
|
2007-06-02 06:47:09 +02:00
|
|
|
/**
|
2007-12-05 21:24:40 +01:00
|
|
|
* Returns the rect that the contents are positioned within in local coordinates
|
|
|
|
*/
|
|
|
|
QRectF contentRect() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the area within which contents can be painted.
|
2007-09-01 14:34:22 +02:00
|
|
|
**/
|
|
|
|
QSizeF contentSize() const;
|
2007-07-24 23:04:31 +02:00
|
|
|
|
2007-11-29 21:38:13 +01:00
|
|
|
/**
|
|
|
|
* Sets the content size.
|
|
|
|
*
|
|
|
|
* @note Normally an applet should never
|
|
|
|
* call this directly except in the constructor to provide a default
|
|
|
|
* size
|
|
|
|
*
|
2008-03-28 08:42:25 +01:00
|
|
|
* @param size the new size of the contents area
|
2007-11-29 21:38:13 +01:00
|
|
|
*/
|
|
|
|
void setContentSize(const QSizeF &size);
|
|
|
|
|
2007-12-19 01:45:29 +01:00
|
|
|
/**
|
|
|
|
* Sets the content size.
|
|
|
|
*
|
|
|
|
* @note Normally an applet should never
|
|
|
|
* call this directly except in the constructor to provide a default
|
|
|
|
* size
|
|
|
|
*
|
2008-03-28 08:42:25 +01:00
|
|
|
* @param width the new width of the contents area
|
|
|
|
* @param height the new height of the contents area
|
2007-12-19 01:45:29 +01:00
|
|
|
*/
|
|
|
|
void setContentSize(int width, int height);
|
|
|
|
|
2007-07-24 23:04:31 +02:00
|
|
|
/**
|
2007-09-28 07:46:37 +02:00
|
|
|
* Returns an ideal size for the applet's content.
|
2007-09-01 14:34:22 +02:00
|
|
|
* Applets can re-implement this to provide a suitable size based
|
|
|
|
* on their contents.
|
2007-07-25 21:15:23 +02:00
|
|
|
*
|
2007-09-28 07:46:37 +02:00
|
|
|
* Unlike sizeHint() , contentSizeHint() does not include the
|
|
|
|
* size of any borders surrounding the content area.
|
2007-07-26 01:00:25 +02:00
|
|
|
*
|
2007-09-01 14:34:22 +02:00
|
|
|
* The default implementation returns the sizeHint() of the applet's
|
2007-09-28 07:46:37 +02:00
|
|
|
* layout if it has one, or a null size otherwise.
|
2007-09-01 14:34:22 +02:00
|
|
|
*/
|
|
|
|
virtual QSizeF contentSizeHint() const;
|
2007-06-02 06:47:09 +02:00
|
|
|
|
2007-11-28 22:08:12 +01:00
|
|
|
/**
|
|
|
|
* Sets the minimum size for the content of this applet
|
|
|
|
*/
|
|
|
|
void setMinimumContentSize(const QSizeF &minSize);
|
|
|
|
|
2007-12-19 01:45:29 +01:00
|
|
|
/**
|
|
|
|
* Sets the minimum size for the content of this applet
|
|
|
|
*
|
2008-03-28 08:42:25 +01:00
|
|
|
* @param minWidth the new minimum width of the contents area
|
|
|
|
* @param minHeight the new minimum height of the contents area
|
2007-12-19 01:45:29 +01:00
|
|
|
*/
|
|
|
|
void setMinimumContentSize(int minWidth, int minHeight);
|
|
|
|
|
2007-11-28 22:08:12 +01:00
|
|
|
/**
|
|
|
|
* Get the minimum size for the content of this applet
|
|
|
|
*/
|
|
|
|
QSizeF minimumContentSize() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the maximum size for the content of this applet.
|
|
|
|
*/
|
|
|
|
void setMaximumContentSize(const QSizeF &maxSize);
|
|
|
|
|
2007-12-19 01:45:29 +01:00
|
|
|
/**
|
|
|
|
* Sets the maximum size for the content of this applet
|
|
|
|
*
|
2008-03-28 08:42:25 +01:00
|
|
|
* @param maxWidth the new maximum width of the contents area
|
|
|
|
* @param maxHeight the new maximum height of the contents area
|
2007-12-19 01:45:29 +01:00
|
|
|
*/
|
|
|
|
void setMaximumContentSize(int maxWidth, int maxHeight);
|
|
|
|
|
2007-11-28 22:08:12 +01:00
|
|
|
/**
|
2008-03-20 08:47:05 +01:00
|
|
|
* Get the maximum size for the content of this applet
|
2007-11-28 22:08:12 +01:00
|
|
|
*/
|
|
|
|
QSizeF maximumContentSize() const;
|
|
|
|
|
2008-01-10 20:02:05 +01:00
|
|
|
/**
|
|
|
|
* @return the prefered aspect ratio mode for placement and resizing
|
|
|
|
*/
|
|
|
|
Qt::AspectRatioMode aspectRatioMode() const;
|
|
|
|
|
|
|
|
/**
|
2008-01-25 01:08:25 +01:00
|
|
|
* Sets the prefered aspect ratio mode for placement and resizing
|
2008-01-10 20:02:05 +01:00
|
|
|
*/
|
|
|
|
void setAspectRatioMode(Qt::AspectRatioMode);
|
|
|
|
|
2008-01-25 01:08:25 +01:00
|
|
|
/**
|
|
|
|
* @return whether or not to keep this applet square.
|
|
|
|
*/
|
|
|
|
bool remainSquare() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether or not this applet should be kept square.
|
|
|
|
*
|
|
|
|
* @param square true if the applet should always be square in shape.
|
|
|
|
*/
|
|
|
|
void setRemainSquare(bool square);
|
|
|
|
|
2007-05-24 22:01:12 +02:00
|
|
|
/**
|
2007-09-18 23:22:45 +02:00
|
|
|
* Returns a list of all known applets.
|
2007-05-24 22:01:12 +02:00
|
|
|
*
|
2007-07-17 23:30:27 +02:00
|
|
|
* @param category Only applets matchin this category will be returned.
|
|
|
|
* Useful in conjunction with knownCategories.
|
2007-09-28 07:46:37 +02:00
|
|
|
* If "Misc" is passed in, then applets without a
|
2007-07-18 00:26:18 +02:00
|
|
|
* Categories= entry are also returned.
|
2007-07-17 23:30:27 +02:00
|
|
|
* If an empty string is passed in, all applets are
|
|
|
|
* returned.
|
2007-09-28 07:46:37 +02:00
|
|
|
* @param parentApp the application to filter applets on. Uses the
|
2007-07-17 23:30:27 +02:00
|
|
|
* X-KDE-ParentApp entry (if any) in the plugin info.
|
|
|
|
* The default value of QString() will result in a
|
|
|
|
* list containing only applets not specifically
|
|
|
|
* registered to an application.
|
2007-05-24 22:01:12 +02:00
|
|
|
* @return list of applets
|
|
|
|
**/
|
2007-07-17 23:30:27 +02:00
|
|
|
static KPluginInfo::List knownApplets(const QString &category = QString(),
|
|
|
|
const QString &parentApp = QString());
|
2007-06-01 00:40:38 +02:00
|
|
|
|
2007-07-31 12:52:05 +02:00
|
|
|
/**
|
2007-09-18 23:22:45 +02:00
|
|
|
* Returns a list of all known applets associated with a certain mimetype.
|
2007-07-31 12:52:05 +02:00
|
|
|
*
|
|
|
|
* @return list of applets
|
|
|
|
**/
|
2007-07-31 12:56:05 +02:00
|
|
|
static KPluginInfo::List knownAppletsForMimetype(const QString &mimetype);
|
2007-07-31 12:52:05 +02:00
|
|
|
|
2007-07-12 15:24:35 +02:00
|
|
|
/**
|
|
|
|
* Returns a list of all the categories used by
|
|
|
|
* installed applets.
|
2007-07-17 23:30:27 +02:00
|
|
|
*
|
2007-09-28 07:46:37 +02:00
|
|
|
* @param parentApp the application to filter applets on. Uses the
|
2007-07-17 23:30:27 +02:00
|
|
|
* X-KDE-ParentApp entry (if any) in the plugin info.
|
|
|
|
* The default value of QString() will result in a
|
|
|
|
* list containing only applets not specifically
|
|
|
|
* registered to an application.
|
|
|
|
* @return list of categories
|
2007-11-19 10:46:52 +01:00
|
|
|
* @param visibleOnly true if it should only return applets that are marked as visible
|
2007-07-12 15:24:35 +02:00
|
|
|
*/
|
2007-11-19 10:46:52 +01:00
|
|
|
static QStringList knownCategories(const QString &parentApp = QString(), bool visibleOnly = true);
|
2007-07-12 15:24:35 +02:00
|
|
|
|
2007-05-24 22:01:12 +02:00
|
|
|
/**
|
2007-07-07 00:20:57 +02:00
|
|
|
* Attempts to load an applet
|
|
|
|
*
|
|
|
|
* Returns a pointer to the applet if successful.
|
|
|
|
* The caller takes responsibility for the applet, including
|
2007-05-24 22:01:12 +02:00
|
|
|
* deleting it when no longer needed.
|
|
|
|
*
|
|
|
|
* @param name the plugin name, as returned by KPluginInfo::pluginName()
|
2008-03-28 08:42:25 +01:00
|
|
|
* @param appletId unique ID to assign the applet, or zero to have one
|
2007-05-24 22:01:12 +02:00
|
|
|
* assigned automatically.
|
2007-06-20 10:11:59 +02:00
|
|
|
* @param args to send the applet extra arguments
|
2007-05-24 22:01:12 +02:00
|
|
|
* @return a pointer to the loaded applet, or 0 on load failure
|
|
|
|
**/
|
2008-02-26 02:48:52 +01:00
|
|
|
static Applet* load(const QString &name, uint appletId = 0,
|
|
|
|
const QVariantList& args = QVariantList());
|
2007-05-23 17:47:27 +02:00
|
|
|
|
2007-05-24 22:51:59 +02:00
|
|
|
/**
|
2007-07-07 00:20:57 +02:00
|
|
|
* Attempts to load an applet
|
|
|
|
*
|
|
|
|
* Returns a pointer to the applet if successful.
|
|
|
|
* The caller takes responsibility for the applet, including
|
2007-05-24 22:51:59 +02:00
|
|
|
* deleting it when no longer needed.
|
|
|
|
*
|
|
|
|
* @param info KPluginInfo object for the desired applet
|
2008-03-28 08:42:25 +01:00
|
|
|
* @param appletId unique ID to assign the applet, or zero to have one
|
2007-05-24 22:51:59 +02:00
|
|
|
* assigned automatically.
|
2008-03-28 08:42:25 +01:00
|
|
|
* @param args to send the applet extra arguments
|
2007-05-24 22:51:59 +02:00
|
|
|
* @return a pointer to the loaded applet, or 0 on load failure
|
|
|
|
**/
|
2008-02-26 02:48:52 +01:00
|
|
|
static Applet* load(const KPluginInfo& info, uint appletId = 0,
|
2007-08-29 04:33:22 +02:00
|
|
|
const QVariantList& args = QVariantList());
|
2007-05-24 22:51:59 +02:00
|
|
|
|
2008-01-12 07:02:29 +01:00
|
|
|
/**
|
|
|
|
* Get the category of the given applet
|
|
|
|
*
|
2008-03-28 08:42:25 +01:00
|
|
|
* @param applet a KPluginInfo object for the applet
|
2008-01-12 07:02:29 +01:00
|
|
|
*/
|
|
|
|
static QString category(const KPluginInfo& applet);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the category of the given applet
|
|
|
|
*
|
2008-03-28 08:42:25 +01:00
|
|
|
* @param appletName the name of the applet
|
2008-01-12 07:02:29 +01:00
|
|
|
*/
|
|
|
|
static QString category(const QString& appletName);
|
|
|
|
|
2007-06-22 22:28:42 +02:00
|
|
|
/**
|
|
|
|
* This method is called when the interface should be painted.
|
2007-07-07 00:20:57 +02:00
|
|
|
*
|
2007-07-24 23:04:31 +02:00
|
|
|
* @param painter the QPainter to use to do the paintiner
|
|
|
|
* @param option the style options object
|
|
|
|
* @param contentsRect the rect to paint within; automatically adjusted for
|
|
|
|
* the background, if any
|
2007-06-22 22:28:42 +02:00
|
|
|
**/
|
|
|
|
virtual void paintInterface(QPainter *painter,
|
|
|
|
const QStyleOptionGraphicsItem *option,
|
2007-07-24 23:04:31 +02:00
|
|
|
const QRect& contentsRect);
|
2007-06-22 22:28:42 +02:00
|
|
|
|
2007-06-05 21:31:48 +02:00
|
|
|
/**
|
|
|
|
* Returns the user-visible name for the applet, as specified in the
|
|
|
|
* .desktop file.
|
2007-07-07 00:20:57 +02:00
|
|
|
*
|
2007-06-05 21:31:48 +02:00
|
|
|
* @return the user-visible name for the applet.
|
|
|
|
**/
|
2007-06-21 20:24:05 +02:00
|
|
|
QString name() const;
|
|
|
|
|
2007-08-05 15:01:09 +02:00
|
|
|
/**
|
|
|
|
* Returns the plugin name for the applet
|
|
|
|
*/
|
|
|
|
QString pluginName() const;
|
|
|
|
|
2007-12-21 13:27:29 +01:00
|
|
|
/**
|
|
|
|
* Whether the applet should conserve resources. If true, try to avoid doing stuff which
|
|
|
|
* is computationally heavy. Try to conserve power and resources.
|
|
|
|
*
|
|
|
|
* @return true if it should conserve resources, false if it does not.
|
|
|
|
*/
|
2007-12-21 13:34:40 +01:00
|
|
|
bool shouldConserveResources() const;
|
2007-12-21 13:27:29 +01:00
|
|
|
|
2007-07-23 08:12:38 +02:00
|
|
|
/**
|
|
|
|
* Returns the icon related to this applet
|
|
|
|
**/
|
|
|
|
QString icon() const;
|
|
|
|
|
2007-07-12 15:24:35 +02:00
|
|
|
/**
|
|
|
|
* Returns the category the applet is in, as specified in the
|
|
|
|
* .desktop file.
|
|
|
|
*/
|
|
|
|
QString category() const;
|
2007-07-29 01:41:40 +02:00
|
|
|
|
2007-07-27 00:58:30 +02:00
|
|
|
/**
|
|
|
|
* Returns the color corresponding to the applet's category.
|
|
|
|
*/
|
|
|
|
QColor color() const;
|
2007-07-12 15:24:35 +02:00
|
|
|
|
2007-06-21 20:24:05 +02:00
|
|
|
/**
|
|
|
|
* @return true if this applet is immutable
|
|
|
|
**/
|
2007-07-23 02:24:36 +02:00
|
|
|
bool isImmutable() const;
|
2007-06-21 20:24:05 +02:00
|
|
|
|
2007-12-04 05:15:21 +01:00
|
|
|
/**
|
|
|
|
* @return true if this applet is immutable due to Kiosk settings
|
|
|
|
*/
|
|
|
|
bool isKioskImmutable() const;
|
|
|
|
|
2007-06-20 08:45:08 +02:00
|
|
|
/**
|
2007-06-22 22:28:42 +02:00
|
|
|
* @return returns whether or not the applet is using the standard
|
|
|
|
* background
|
2007-06-20 08:45:08 +02:00
|
|
|
**/
|
2008-01-18 01:09:33 +01:00
|
|
|
bool drawStandardBackground() const;
|
2007-06-22 22:28:42 +02:00
|
|
|
|
|
|
|
/**
|
2007-07-07 00:20:57 +02:00
|
|
|
* Sets whether the applet should automatically draw the standard
|
|
|
|
* background.
|
|
|
|
*
|
2007-11-08 08:53:56 +01:00
|
|
|
* Defaults to true
|
2007-06-22 22:28:42 +02:00
|
|
|
**/
|
|
|
|
void setDrawStandardBackground(bool drawBackground);
|
2007-06-20 08:45:08 +02:00
|
|
|
|
2007-07-12 20:34:53 +02:00
|
|
|
/**
|
|
|
|
* If for some reason, the applet fails to get up on its feet (the
|
|
|
|
* library couldn't be loaded, necessary hardware support wasn't found,
|
|
|
|
* etc..) this method returns true
|
|
|
|
**/
|
|
|
|
bool failedToLaunch() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Call this method when the applet fails to launch properly. An
|
|
|
|
* optional reason can be provided.
|
|
|
|
*
|
|
|
|
* Not that all children items will be deleted when this method is
|
|
|
|
* called. If you have pointers to these items, you will need to
|
|
|
|
* reset them after calling this method.
|
|
|
|
*
|
|
|
|
* @param failed true when the applet failed, false when it succeeded
|
|
|
|
* @param reason an optional reason to show the user why the applet
|
|
|
|
* failed to launch
|
|
|
|
**/
|
|
|
|
void setFailedToLaunch(bool failed, const QString& reason = QString());
|
|
|
|
|
2007-08-03 17:23:56 +02:00
|
|
|
/**
|
2007-09-28 07:46:37 +02:00
|
|
|
* @return true if the applet currently needs to be configured,
|
2007-08-03 17:23:56 +02:00
|
|
|
* otherwise, false
|
|
|
|
*/
|
|
|
|
bool needsConfiguring() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When the applet needs to be configured before being usable, this
|
|
|
|
* method can be called to show a standard interface prompting the user
|
|
|
|
* to configure the applet
|
|
|
|
*
|
|
|
|
* Not that all children items will be deleted when this method is
|
|
|
|
* called. If you have pointers to these items, you will need to
|
|
|
|
* reset them after calling this method.
|
|
|
|
*
|
|
|
|
* @param needsConfiguring true if the applet needs to be configured,
|
|
|
|
* or false if it doesn't
|
|
|
|
*/
|
|
|
|
void setNeedsConfiguring(bool needsConfiguring);
|
2007-07-20 10:12:20 +02:00
|
|
|
|
|
|
|
/**
|
2008-01-12 07:02:29 +01:00
|
|
|
* @return true if this plasmoid provides a GUI configuration
|
2007-07-20 10:12:20 +02:00
|
|
|
**/
|
2008-01-12 07:02:29 +01:00
|
|
|
bool hasConfigurationInterface();
|
2007-07-20 10:12:20 +02:00
|
|
|
|
|
|
|
/**
|
2008-01-12 07:02:29 +01:00
|
|
|
* Sets whether or not this applet provides a user interface for
|
|
|
|
* configuring the applet.
|
|
|
|
*
|
|
|
|
* It defaults to false, and if true is passed in you should
|
|
|
|
* also reimplement showConfigurationInterface()
|
|
|
|
*
|
2008-03-28 08:42:25 +01:00
|
|
|
* @param hasInterface whether or not there is a user interface available
|
2007-07-20 10:12:20 +02:00
|
|
|
**/
|
2008-01-12 07:02:29 +01:00
|
|
|
void setHasConfigurationInterface(bool hasInterface);
|
2007-06-21 20:07:39 +02:00
|
|
|
|
2007-07-31 02:20:19 +02:00
|
|
|
/**
|
|
|
|
* Returns a list of context-related QAction instances.
|
|
|
|
*
|
|
|
|
* This is used e.g. within the \a DesktopView to display a
|
|
|
|
* contextmenu.
|
|
|
|
*
|
|
|
|
* @return A list of actions. The default implementation returns an
|
|
|
|
* empty list.
|
|
|
|
**/
|
|
|
|
virtual QList<QAction*> contextActions();
|
|
|
|
|
2007-08-05 10:41:55 +02:00
|
|
|
/**
|
|
|
|
* Sets shadow for the given applet.
|
|
|
|
*/
|
|
|
|
void setShadowShown(bool);
|
2008-01-12 07:02:29 +01:00
|
|
|
|
2007-08-05 10:41:55 +02:00
|
|
|
/**
|
|
|
|
* Returns true if the given item has a shadow shown.
|
|
|
|
*/
|
|
|
|
bool isShadowShown() const;
|
|
|
|
|
2008-01-12 07:02:29 +01:00
|
|
|
/**
|
|
|
|
* Sets whether or not this Applet is acting as a Containment
|
|
|
|
*/
|
|
|
|
void setIsContainment(bool isContainment);
|
2007-09-01 14:34:22 +02:00
|
|
|
|
2007-09-28 07:46:37 +02:00
|
|
|
/**
|
2008-01-12 07:02:29 +01:00
|
|
|
* @return true if this Applet is currently being used as a Containment, false otherwise
|
|
|
|
*/
|
|
|
|
bool isContainment() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the geometry of this Plasma::Applet. Should not be used directly by
|
|
|
|
* applet subclasses.
|
2007-11-15 10:39:46 +01:00
|
|
|
* @param geometry the geometry to apply to this Plasma::Applet.
|
|
|
|
*/
|
2007-09-28 07:46:37 +02:00
|
|
|
void setGeometry(const QRectF &geometry);
|
|
|
|
|
2008-02-13 02:52:02 +01:00
|
|
|
/**
|
|
|
|
* Causes this applet to raise above all other applets.
|
|
|
|
*/
|
|
|
|
void raise();
|
|
|
|
|
2007-11-15 10:39:46 +01:00
|
|
|
/**
|
2008-01-12 07:02:29 +01:00
|
|
|
* Reimplemented from LayoutItem
|
2007-11-15 10:39:46 +01:00
|
|
|
*/
|
2008-02-29 18:50:57 +01:00
|
|
|
QSizeF sizeHint() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reimplemented from Plasma::Widget
|
|
|
|
*/
|
|
|
|
Qt::Orientations expandingDirections() const;
|
2007-11-15 10:39:46 +01:00
|
|
|
|
|
|
|
/**
|
2008-01-12 07:02:29 +01:00
|
|
|
* Reimplemented from QGraphicsItem
|
|
|
|
**/
|
|
|
|
int type() const;
|
|
|
|
enum { Type = Plasma::AppletType };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reimplemented from QGraphicsItem
|
|
|
|
**/
|
|
|
|
QRectF boundingRect() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reimplemented from QGraphicsItem
|
2007-11-15 10:39:46 +01:00
|
|
|
*/
|
2008-01-12 07:02:29 +01:00
|
|
|
QPainterPath shape() const;
|
2007-11-15 10:39:46 +01:00
|
|
|
|
2007-11-27 07:01:06 +01:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
void resetConfigurationObject();
|
|
|
|
|
2008-01-18 01:09:33 +01:00
|
|
|
/**
|
|
|
|
* @return the Containment, if any, this applet belongs to
|
|
|
|
**/
|
|
|
|
Containment* containment() const;
|
|
|
|
|
2008-04-04 15:16:55 +02:00
|
|
|
/**
|
|
|
|
* Sets the opacity of this Plasma::Applet
|
|
|
|
* @param opacity the new opacity
|
|
|
|
*/
|
|
|
|
void setOpacity( qreal opacity );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return opacity of this Applet
|
|
|
|
**/
|
|
|
|
qreal opacity() const;
|
|
|
|
|
2006-01-20 12:09:06 +01:00
|
|
|
Q_SIGNALS:
|
2007-05-27 10:01:31 +02:00
|
|
|
/**
|
2007-07-07 00:20:57 +02:00
|
|
|
* Emitted when the applet needs to take (or lose) keyboard focus.
|
|
|
|
*
|
|
|
|
* An applet should emit this signal to ensure that autohiding
|
|
|
|
* elements stay unhidden and other bits of bookkeeping are
|
|
|
|
* performed to ensure proper function.
|
2007-05-27 10:01:31 +02:00
|
|
|
*
|
|
|
|
* If you call watchForFocus on your applet, then this is handled for
|
|
|
|
* the applet and it is not necessary to emit the signal directly.
|
|
|
|
*
|
|
|
|
* @param focus true if the applet is taking keyboard focus, false if
|
|
|
|
* it is giving it up
|
|
|
|
**/
|
2007-03-03 02:41:27 +01:00
|
|
|
void requestFocus( bool focus );
|
2005-12-29 22:55:22 +01:00
|
|
|
|
2007-11-09 01:42:18 +01:00
|
|
|
/**
|
|
|
|
* Emitted whenever the applet makes a geometry change, so that views
|
|
|
|
* can coordinate themselves with these changes if they desire.
|
|
|
|
*/
|
|
|
|
void geometryChanged();
|
|
|
|
|
2008-01-01 23:44:56 +01:00
|
|
|
/**
|
|
|
|
* Emitted when an applet has changed values in its configuration
|
|
|
|
* and wishes for them to be saved at the next save point. As this implies
|
|
|
|
* disk activity, this signal should be used with care.
|
|
|
|
*
|
|
|
|
* @note This does not need to be emitted from saveState by individual
|
|
|
|
* applets.
|
|
|
|
*/
|
2008-01-01 23:54:33 +01:00
|
|
|
void configNeedsSaving();
|
2008-01-01 23:44:56 +01:00
|
|
|
|
2007-08-05 11:39:32 +02:00
|
|
|
public Q_SLOTS:
|
2007-12-04 03:17:21 +01:00
|
|
|
/**
|
|
|
|
* Sets whether or not this applet is immutable or not.
|
|
|
|
*
|
2008-03-28 08:42:25 +01:00
|
|
|
* @param immutable true if this applet should not be changeable
|
2007-12-04 03:17:21 +01:00
|
|
|
**/
|
|
|
|
void setImmutable(bool immutable);
|
|
|
|
|
2007-08-05 11:39:32 +02:00
|
|
|
/**
|
|
|
|
* Destroys the applet; it will be deleted and configurations reset.
|
|
|
|
*/
|
|
|
|
void destroy();
|
|
|
|
|
2007-10-19 23:43:27 +02:00
|
|
|
/**
|
2008-04-02 17:37:17 +02:00
|
|
|
* Lets the user interact with the plasmoid options.
|
2007-10-19 23:43:27 +02:00
|
|
|
* Called when the user selects the configure entry
|
|
|
|
* from the context menu.
|
2008-04-02 17:37:17 +02:00
|
|
|
*
|
|
|
|
* Applets should NOT reimplement this method unless there is good
|
|
|
|
* reason to do so, but instead reimplment createConfigurationInterface
|
2007-10-19 23:43:27 +02:00
|
|
|
*/
|
|
|
|
virtual void showConfigurationInterface();
|
|
|
|
|
2008-04-02 17:37:17 +02:00
|
|
|
/**
|
|
|
|
* Reimplement this method so provide a configuration interface,
|
|
|
|
* parented to the supplied widget. Ownership of the widgets is passed
|
|
|
|
* to the parent widget.
|
|
|
|
*
|
|
|
|
* @param parent the dialog which is the parent of the configuration
|
|
|
|
* widgets
|
|
|
|
*/
|
|
|
|
virtual void createConfigurationInterface(KConfigDialog *parent);
|
|
|
|
|
2007-10-26 03:04:56 +02:00
|
|
|
/**
|
|
|
|
* Sends all pending contraints updates to the applet. Will usually
|
|
|
|
* be called automatically, but can also be called manually if needed.
|
|
|
|
*/
|
|
|
|
void flushUpdatedConstraints();
|
|
|
|
|
2007-11-27 07:01:06 +01:00
|
|
|
/**
|
2008-01-18 01:09:33 +01:00
|
|
|
* This method should be invoked whenever an application launch or other window
|
|
|
|
* creation of focussing event was triggered
|
|
|
|
*/
|
|
|
|
void launchActivated();
|
2007-11-27 07:01:06 +01:00
|
|
|
|
2008-02-12 08:33:07 +01:00
|
|
|
/**
|
|
|
|
* called when the Plasma::Theme has changed
|
|
|
|
*/
|
|
|
|
void themeChanged();
|
|
|
|
|
2005-12-29 22:55:22 +01:00
|
|
|
protected:
|
2007-09-18 23:22:45 +02:00
|
|
|
/**
|
|
|
|
* Called when a request to save the state of the applet is made
|
|
|
|
* during runtime
|
|
|
|
**/
|
|
|
|
virtual void saveState(KConfigGroup* config) const;
|
|
|
|
|
2007-05-27 10:01:31 +02:00
|
|
|
/**
|
2007-07-07 00:20:57 +02:00
|
|
|
* Returns the name of the applet.
|
|
|
|
*
|
|
|
|
* This will be the same for all instances of this applet.
|
2007-05-27 10:01:31 +02:00
|
|
|
**/
|
2005-12-29 22:55:22 +01:00
|
|
|
QString globalName() const;
|
2007-05-27 10:01:31 +02:00
|
|
|
|
|
|
|
/**
|
2007-07-07 00:20:57 +02:00
|
|
|
* Returns a name unique to the instance of this applet.
|
|
|
|
*
|
|
|
|
* Useful for being able to refer directly to a particular
|
|
|
|
* applet. Combines the global name with the applet id
|
2007-05-27 10:01:31 +02:00
|
|
|
**/
|
2005-12-29 22:55:22 +01:00
|
|
|
QString instanceName() const;
|
|
|
|
|
|
|
|
/**
|
2007-07-07 00:20:57 +02:00
|
|
|
* Register widgets that can receive keyboard focus.
|
|
|
|
*
|
2008-02-21 11:26:40 +01:00
|
|
|
* Calling this results in an eventFilter being placed on the widget.
|
2007-07-07 00:20:57 +02:00
|
|
|
*
|
2005-12-29 22:55:22 +01:00
|
|
|
* @param widget the widget to watch for keyboard focus
|
|
|
|
* @param watch whether to start watching the widget, or to stop doing so
|
|
|
|
*/
|
2008-02-21 11:26:40 +01:00
|
|
|
void watchForFocus(QObject *widget, bool watch = true);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register the widgets that manages mouse clicks but you still want
|
|
|
|
* to be able to drag the applet around when holding the mouse pointer
|
|
|
|
* on that widgets.
|
|
|
|
*
|
|
|
|
* Calling this results in an eventFilter being places on the widget.
|
|
|
|
*
|
|
|
|
* @param widget the widget to watch for mouse move
|
|
|
|
* @param watch whether to start watching the widget, or to stop doing so
|
|
|
|
*/
|
2008-03-28 08:42:25 +01:00
|
|
|
void watchForMouseMove(QGraphicsItem *widget, bool watch);
|
2005-12-29 22:55:22 +01:00
|
|
|
|
|
|
|
/**
|
2007-07-07 00:20:57 +02:00
|
|
|
* Call this whenever focus is needed or not needed.
|
|
|
|
*
|
|
|
|
* You do not have to call this method for widgets that have
|
|
|
|
* been registered with watchForFocus
|
|
|
|
*
|
2005-12-29 22:55:22 +01:00
|
|
|
* @see watchForFocus
|
|
|
|
* @param focus whether to or not to request focus
|
|
|
|
*/
|
2007-06-21 20:24:05 +02:00
|
|
|
void needsFocus(bool focus);
|
2005-12-29 22:55:22 +01:00
|
|
|
|
2007-05-27 10:01:31 +02:00
|
|
|
/**
|
|
|
|
* @internal event filter; used for focus watching
|
|
|
|
**/
|
2007-03-03 02:41:27 +01:00
|
|
|
bool eventFilter( QObject *o, QEvent *e );
|
2007-09-27 01:01:57 +02:00
|
|
|
|
2008-02-21 11:26:40 +01:00
|
|
|
/**
|
|
|
|
* @internal scene event filter; used to manage applet dragging
|
|
|
|
*/
|
|
|
|
bool sceneEventFilter ( QGraphicsItem * watched, QEvent * event );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal manage the mouse movement to drag the applet around
|
|
|
|
*/
|
|
|
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
|
2008-02-13 02:52:02 +01:00
|
|
|
/**
|
|
|
|
* Reimpmlemented from LayoutItem
|
|
|
|
*/
|
|
|
|
QPointF topLeft() const;
|
|
|
|
|
2007-08-05 10:41:55 +02:00
|
|
|
/**
|
2007-11-27 07:01:06 +01:00
|
|
|
* Reimplemented from QGraphicsItem
|
2007-08-05 10:41:55 +02:00
|
|
|
*/
|
|
|
|
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
|
|
|
|
2007-08-03 17:23:56 +02:00
|
|
|
protected Q_SLOTS:
|
2007-11-27 07:01:06 +01:00
|
|
|
/**
|
|
|
|
* @internal used to check the immutability of the item in the config file
|
|
|
|
*/
|
|
|
|
void checkImmutability();
|
|
|
|
|
2005-12-29 22:55:22 +01:00
|
|
|
private:
|
2007-07-20 05:34:20 +02:00
|
|
|
Q_DISABLE_COPY(Applet)
|
|
|
|
|
2007-07-20 10:12:20 +02:00
|
|
|
/**
|
|
|
|
* Reimplemented from QGraphicsItem
|
|
|
|
**/
|
2007-09-10 20:50:36 +02:00
|
|
|
void paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
2007-06-22 22:28:42 +02:00
|
|
|
|
2005-12-29 22:55:22 +01:00
|
|
|
class Private;
|
2007-05-21 16:28:03 +02:00
|
|
|
Private* const d;
|
2005-12-29 22:55:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // Plasma namespace
|
|
|
|
|
2007-07-07 00:20:57 +02:00
|
|
|
/**
|
|
|
|
* Register an applet when it is contained in a loadable module
|
|
|
|
*/
|
2007-05-24 22:01:12 +02:00
|
|
|
#define K_EXPORT_PLASMA_APPLET(libname, classname) \
|
2007-08-29 04:33:22 +02:00
|
|
|
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
|
|
|
|
K_EXPORT_PLUGIN(factory("plasma_applet_" #libname))
|
2007-05-24 22:01:12 +02:00
|
|
|
|
2005-12-29 22:55:22 +01:00
|
|
|
#endif // multiple inclusion guard
|