• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • plasma
  • scripting
appletscript.h
Go to the documentation of this file.
1/*
2 * Copyright 2007 by Aaron Seigo <aseigo@kde.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef PLASMA_APPLETSCRIPT_H
21#define PLASMA_APPLETSCRIPT_H
22
23#include <QtCore/QObject>
24#include <QtCore/QRect>
25#include <QtCore/QSizeF>
26
27#include <kgenericfactory.h>
28#include <kplugininfo.h>
29
30#include <plasma/containment.h>
31#include <plasma/plasma_export.h>
32#include <plasma/scripting/scriptengine.h>
33
34class QAction;
35class QPainter;
36class QStyleOptionGraphicsItem;
37class KConfigDialog;
38
39namespace Plasma
40{
41
42class Animation;
43class AppletScriptPrivate;
44class Extender;
45
51class PLASMA_EXPORT AppletScript : public ScriptEngine
52{
53 Q_OBJECT
54
55public:
64 explicit AppletScript(QObject *parent = 0);
65 ~AppletScript();
66
70 void setApplet(Plasma::Applet *applet);
71
75 Plasma::Applet *applet() const;
76
85 virtual void paintInterface(QPainter *painter,
86 const QStyleOptionGraphicsItem *option,
87 const QRect &contentsRect);
88
92 Q_INVOKABLE QSizeF size() const;
93
105 virtual void constraintsEvent(Plasma::Constraints constraints);
106
113 virtual QList<QAction*> contextualActions();
114
118 virtual QPainterPath shape() const;
119
125 void setHasConfigurationInterface(bool hasInterface);
126
130 void setConfigurationRequired(bool req, const QString &reason = QString());
131
135 void setFailedToLaunch(bool failed, const QString &reason = QString());
136
140 void configNeedsSaving() const;
141
145 Extender *extender() const;
146
147 //FIXME plasma2: setWallpaperEnabled and setContainmentType should become public?
153 bool drawWallpaper() const;
159 void setDrawWallpaper(bool drawWallpaper);
160
165 Containment::Type containmentType() const;
166
171 void setContainmentType(Containment::Type type);
172
173Q_SIGNALS:
177 void saveState(KConfigGroup &group) const;
178
182 void popupEvent(bool popped) const;
183
184public Q_SLOTS:
185
189 virtual void showConfigurationInterface();
190
194 virtual void configChanged();
195
196protected:
201 Q_INVOKABLE DataEngine *dataEngine(const QString &engine) const;
202
206 QString mainScript() const;
207
213 const Package *package() const;
214
218 KPluginInfo description() const;
219
226 KConfigDialog *standardConfigurationDialog();
227
234 void addStandardConfigurationPages(KConfigDialog *dialog);
235
239 void showMessage(const QIcon &icon, const QString &message, const MessageButtons buttons);
240
244 void registerAsDragHandle(QGraphicsItem *item);
245
249 void unregisterAsDragHandle(QGraphicsItem *item);
250
254 bool isRegisteredAsDragHandle(QGraphicsItem *item);
255
262 Animation *loadAnimationFromPackage(const QString &name, QObject *parent);
263
264private:
265 friend class Applet;
266 friend class PopupApplet;
267
268 AppletScriptPrivate *const d;
269};
270
271#define K_EXPORT_PLASMA_APPLETSCRIPTENGINE(libname, classname) \
272K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
273K_EXPORT_PLUGIN(factory("plasma_appletscriptengine_" #libname))
274
275} //Plasma namespace
276
277#endif
Plasma::Animation
Abstract representation of a single animation.
Definition: animation.h:47
Plasma::AppletScript
Provides a restricted interface for scripted applets.
Definition: appletscript.h:52
Plasma::AppletScript::popupEvent
void popupEvent(bool popped) const
Plasma::AppletScript::saveState
void saveState(KConfigGroup &group) const
Plasma::Applet
The base Applet class.
Definition: applet.h:78
Plasma::Containment::Type
Type
Definition: containment.h:99
Plasma::DataEngine
Data provider for plasmoids (Plasma plugins)
Definition: dataengine.h:59
Plasma::Extender
Extends applets to allow detachable parts.
Definition: extender.h:66
Plasma::Package
object representing an installed Plasmagik package
Definition: package.h:43
Plasma::PopupApplet
Allows applets to automatically 'collapse' into an icon when put in an panel, and is a convenient bas...
Definition: popupapplet.h:53
Plasma::ScriptEngine
The base class for scripting interfaces to be used in loading plasmoids of a given language.
Definition: scriptengine.h:66
QObject
QStyleOptionGraphicsItem
containment.h
Plasma
Namespace for everything in libplasma.
Definition: abstractdialogmanager.cpp:25
plasma_export.h
scriptengine.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal