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

Plasma

  • sources
  • kde-4.12
  • kdelibs
  • 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 
34 class QAction;
35 class QPainter;
36 class QStyleOptionGraphicsItem;
37 class KConfigDialog;
38 
39 namespace Plasma
40 {
41 
42 class Animation;
43 class AppletScriptPrivate;
44 class Extender;
45 
51 class PLASMA_EXPORT AppletScript : public ScriptEngine
52 {
53  Q_OBJECT
54 
55 public:
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 
173 Q_SIGNALS:
177  void saveState(KConfigGroup &group) const;
178 
182  void popupEvent(bool popped) const;
183 
184 public Q_SLOTS:
185 
189  virtual void showConfigurationInterface();
190 
194  virtual void configChanged();
195 
196 protected:
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 
264 private:
265  friend class Applet;
266  friend class PopupApplet;
267 
268  AppletScriptPrivate *const d;
269 };
270 
271 #define K_EXPORT_PLASMA_APPLETSCRIPTENGINE(libname, classname) \
272 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
273 K_EXPORT_PLUGIN(factory("plasma_appletscriptengine_" #libname))
274 
275 } //Plasma namespace
276 
277 #endif
Plasma::Extender
Extends applets to allow detachable parts.
Definition: extender.h:65
containment.h
Plasma::Animation
Abstract representation of a single animation.
Definition: animation.h:46
QObject
Plasma::Applet
The base Applet class.
Definition: applet.h:77
Plasma::PopupApplet
Allows applets to automatically 'collapse' into an icon when put in an panel, and is a convenient bas...
Definition: popupapplet.h:52
Plasma::ScriptEngine
The base class for scripting interfaces to be used in loading plasmoids of a given language...
Definition: scriptengine.h:65
Plasma::DataEngine
Data provider for plasmoids (Plasma plugins)
Definition: dataengine.h:58
Plasma::AppletScript
Provides a restricted interface for scripted applets.
Definition: appletscript.h:51
Plasma::Package
object representing an installed Plasmagik package
Definition: package.h:42
Plasma::type
static QScriptValue type(QScriptContext *ctx, QScriptEngine *eng)
Definition: easingcurve.cpp:63
scriptengine.h
Plasma::Containment::Type
Type
Definition: containment.h:99
QStyleOptionGraphicsItem
plasma_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:33 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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