export the class, clean up the api

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=742874
This commit is contained in:
Aaron J. Seigo 2007-11-29 04:30:48 +00:00
parent d06a97fa73
commit 1c91abba17
3 changed files with 24 additions and 6 deletions

View File

@ -865,7 +865,7 @@ void Applet::paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *o
Q_UNUSED(contentsRect) Q_UNUSED(contentsRect)
if (d->scriptEngine) { if (d->scriptEngine) {
d->scriptEngine->paintInterface(painter, option); d->scriptEngine->paintInterface(painter, option, contentsRect);
} else { } else {
//kDebug() << "Applet::paintInterface() default impl"; //kDebug() << "Applet::paintInterface() default impl";
} }

View File

@ -55,13 +55,14 @@ void ScriptEngine::init(Applet* applet)
} }
} }
void ScriptEngine::paintInterface(QPainter* painter, const QStyleOptionGraphicsItem* option) void ScriptEngine::paintInterface(QPainter* painter, const QStyleOptionGraphicsItem* option, const QRect &contentsRect)
{ {
Q_UNUSED(painter) Q_UNUSED(painter)
Q_UNUSED(option) Q_UNUSED(option)
Q_UNUSED(contentsRect)
} }
QSizeF ScriptEngine::size() QSizeF ScriptEngine::size() const
{ {
return QSizeF(0, 0); return QSizeF(0, 0);
} }
@ -84,6 +85,12 @@ Applet* ScriptEngine::applet() const
return d->applet; return d->applet;
} }
DataEngine* ScriptEngine::dataEngine(const QString &engine) const
{
Q_ASSERT(d->applet);
return d->applet->dataEngine(engine);
}
const Package* ScriptEngine::package() const const Package* ScriptEngine::package() const
{ {
Q_ASSERT(d->applet); Q_ASSERT(d->applet);

View File

@ -20,7 +20,10 @@
#ifndef PLASMA_SCRIPTENGINE_H #ifndef PLASMA_SCRIPTENGINE_H
#define PLASMA_SCRIPTENGINE_H #define PLASMA_SCRIPTENGINE_H
#include <plasma/plasma_export.h>
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QRect>
#include <QtCore/QSizeF> #include <QtCore/QSizeF>
class QPainter; class QPainter;
@ -31,6 +34,7 @@ namespace Plasma
class Applet; class Applet;
class Package; class Package;
class DataEngine;
/** /**
* @brief The base class for scripting interfaces to be used in loading * @brief The base class for scripting interfaces to be used in loading
@ -46,7 +50,7 @@ class Package;
* LoadImage - loads an image resource out of the plasmoid's package * LoadImage - loads an image resource out of the plasmoid's package
* PlasmaSvg - creates and returns an Svg file * PlasmaSvg - creates and returns an Svg file
**/ **/
class ScriptEngine : public QObject class PLASMA_EXPORT ScriptEngine : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -81,12 +85,12 @@ public:
* @param painter the QPainter to use * @param painter the QPainter to use
* @param option the style option containing such flags as selection, level of detail, etc * @param option the style option containing such flags as selection, level of detail, etc
**/ **/
virtual void paintInterface(QPainter* painter, const QStyleOptionGraphicsItem* option); virtual void paintInterface(QPainter* painter, const QStyleOptionGraphicsItem* option, const QRect &contentsRect);
/** /**
* @return the size of the applet * @return the size of the applet
**/ **/
virtual QSizeF size(); virtual QSizeF size() const;
protected: protected:
/** /**
@ -112,6 +116,13 @@ protected:
**/ **/
Applet* applet() const; Applet* applet() const;
/**
* @return a data engine associated with this plasmoid
*
* @arg engine name of the engine
*/
Q_INVOKABLE DataEngine* dataEngine(const QString &engine) const;
private: private:
class Private; class Private;
Private * const d; Private * const d;