Plasma
appletscript.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PLASMA_APPLETSCRIPT_H
00021 #define PLASMA_APPLETSCRIPT_H
00022
00023 #include <QtCore/QObject>
00024 #include <QtCore/QRect>
00025 #include <QtCore/QSizeF>
00026
00027 #include <kgenericfactory.h>
00028
00029 #include <plasma/plasma_export.h>
00030 #include <plasma/scripting/scriptengine.h>
00031
00032 class QAction;
00033 class QPainter;
00034 class QStyleOptionGraphicsItem;
00035
00036 namespace Plasma
00037 {
00038
00039 class AppletScriptPrivate;
00040
00046 class PLASMA_EXPORT AppletScript : public ScriptEngine
00047 {
00048 Q_OBJECT
00049
00050 public:
00059 explicit AppletScript(QObject *parent = 0);
00060 ~AppletScript();
00061
00065 void setApplet(Plasma::Applet *applet);
00066
00070 Plasma::Applet *applet() const;
00071
00080 virtual void paintInterface(QPainter *painter,
00081 const QStyleOptionGraphicsItem *option,
00082 const QRect &contentsRect);
00083
00087 Q_INVOKABLE QSizeF size() const;
00088
00100 virtual void constraintsEvent(Plasma::Constraints constraints);
00101
00108 virtual QList<QAction*> contextualActions();
00109
00113 virtual QPainterPath shape() const;
00114
00120 void setHasConfigurationInterface(bool hasInterface);
00121
00125 void setConfigurationRequired(bool req, const QString &reason = QString());
00126
00130 void setFailedToLaunch(bool failed, const QString &reason = QString());
00131
00135 void configNeedsSaving() const;
00136
00137 public Q_SLOTS:
00138
00142 virtual void showConfigurationInterface();
00143
00147 virtual void configChanged();
00148
00149 protected:
00154 Q_INVOKABLE DataEngine *dataEngine(const QString &engine) const;
00155
00159 QString mainScript() const;
00160
00166 const Package *package() const;
00167
00168 private:
00169 AppletScriptPrivate *const d;
00170 };
00171
00172 #define K_EXPORT_PLASMA_APPLETSCRIPTENGINE(libname, classname) \
00173 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
00174 K_EXPORT_PLUGIN(factory("plasma_appletscriptengine_" #libname))
00175
00176 }
00177
00178 #endif