/usr/include/plasma/scripting/appletscript.h is in kdelibs5-dev 4:4.8.4-4+deb7u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | /*
* Copyright 2007 by Aaron Seigo <aseigo@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* 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.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PLASMA_APPLETSCRIPT_H
#define PLASMA_APPLETSCRIPT_H
#include <QtCore/QObject>
#include <QtCore/QRect>
#include <QtCore/QSizeF>
#include <kgenericfactory.h>
#include <kplugininfo.h>
#include <plasma/containment.h>
#include <plasma/plasma_export.h>
#include <plasma/scripting/scriptengine.h>
class QAction;
class QPainter;
class QStyleOptionGraphicsItem;
class KConfigDialog;
namespace Plasma
{
class Animation;
class AppletScriptPrivate;
class Extender;
/**
* @class AppletScript plasma/scripting/appletscript.h <Plasma/Scripting/AppletScript>
*
* @short Provides a restricted interface for scripted applets.
*/
class PLASMA_EXPORT AppletScript : public ScriptEngine
{
Q_OBJECT
public:
/**
* Default constructor for an AppletScript.
*
* Subclasses should not attempt to access the Plasma::Applet
* associated with this AppletScript in the constructor. All
* such set up that requires the Applet itself should be done
* in the init() method.
*/
explicit AppletScript(QObject *parent = 0);
~AppletScript();
/**
* Sets the applet associated with this AppletScript
*/
void setApplet(Plasma::Applet *applet);
/**
* Returns the Plasma::Applet associated with this script component
*/
Plasma::Applet *applet() const;
/**
* Called when the script should paint the applet
*
* @param painter the QPainter to use
* @param option the style option containing such flags as selection, level of detail, etc
* @param contentsRect the rect to paint within; automatically adjusted for
* the background, if any
*/
virtual void paintInterface(QPainter *painter,
const QStyleOptionGraphicsItem *option,
const QRect &contentsRect);
/**
* Returns the area within which contents can be painted.
**/
Q_INVOKABLE QSizeF size() const;
/**
* Called when any of the geometry constraints have been updated.
*
* This is always called prior to painting and should be used as an
* opportunity to layout the widget, calculate sizings, etc.
*
* Do not call update() from this method; an update() will be triggered
* at the appropriate time for the applet.
*
* @param constraints the type of constraints that were updated
*/
virtual void constraintsEvent(Plasma::Constraints constraints);
/**
* Returns a list of context-related QAction instances.
*
* @return A list of actions. The default implementation returns an
* empty list.
*/
virtual QList<QAction*> contextualActions();
/**
* Returns the shape of the widget, defaults to the bounding rect
*/
virtual QPainterPath shape() const;
/**
* Sets whether or not this script has a configuration interface or not
*
* @param hasInterface true if the applet is user configurable
*/
void setHasConfigurationInterface(bool hasInterface);
/**
* @see Applet
*/
void setConfigurationRequired(bool req, const QString &reason = QString());
/**
* @see Applet
*/
void setFailedToLaunch(bool failed, const QString &reason = QString());
/**
* @see Applet
*/
void configNeedsSaving() const;
/**
* @see Applet
*/
Extender *extender() const;
//FIXME plasma2: setWallpaperEnabled and setContainmentType should become public?
/**
* @return true if the applet is a containment AND if the wallpaper is enabled
* @see Containment
* @since 4.7
*/
bool drawWallpaper() const;
/**
* set if the containment draws its own wallpaper: it has no effect if the applet is not a containment
* @see Containment
* @since 4.7
*/
void setDrawWallpaper(bool drawWallpaper);
/**
* @see Containment
* @since 4.7
*/
Containment::Type containmentType() const;
/**
* @see Containment
* @since 4.7
*/
void setContainmentType(Containment::Type type);
Q_SIGNALS:
/**
* @see Applet
*/
void saveState(KConfigGroup &group) const;
/**
* @see PopupApplet
*/
void popupEvent(bool popped) const;
public Q_SLOTS:
/**
* Show a configuration dialog.
*/
virtual void showConfigurationInterface();
/**
* Configure was changed.
*/
virtual void configChanged();
protected:
/**
* @param engine name of the engine
* @return a data engine associated with this plasmoid
*/
Q_INVOKABLE DataEngine *dataEngine(const QString &engine) const;
/**
* @return absolute path to the main script file for this plasmoid
*/
QString mainScript() const;
/**
* @return the Package associated with this plasmoid which can
* be used to request resources, such as images and
* interface files.
*/
const Package *package() const;
/**
* @return the KPluginInfo associated with this plasmoid
*/
KPluginInfo description() const;
/**
* @return a standard Plasma applet configuration dialog, ready
* to have pages added to it.
*
* Note that the dialog returned is set to delete on close.
*/
KConfigDialog *standardConfigurationDialog();
/**
* This method should be called after a scripting applet has added
* its own pages to a configuration dialog
*
* @since 4.3.1
*/
void addStandardConfigurationPages(KConfigDialog *dialog);
/**
* @see Applet
*/
void showMessage(const QIcon &icon, const QString &message, const MessageButtons buttons);
/**
* @see Applet
*/
void registerAsDragHandle(QGraphicsItem *item);
/**
* @see Applet
*/
void unregisterAsDragHandle(QGraphicsItem *item);
/**
* @see Applet
*/
bool isRegisteredAsDragHandle(QGraphicsItem *item);
/**
* Loads an animation from the applet package
* @param animation the animation to load
* @return an Animation object on success, a NULL pointer on failure
* @since 4.5
*/
Animation *loadAnimationFromPackage(const QString &name, QObject *parent);
private:
friend class Applet;
friend class PopupApplet;
AppletScriptPrivate *const d;
};
#define K_EXPORT_PLASMA_APPLETSCRIPTENGINE(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(factory("plasma_appletscriptengine_" #libname))
} //Plasma namespace
#endif
|