/usr/include/plasma/scripting/wallpaperscript.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 | /*
* Copyright 2009 by Aaron Seigo <aseigo@kde.org>
* Copyright 2009 by Petri Damsten <damu@iki.fi>
*
* 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_WALLPAPERSCRIPT_H
#define PLASMA_WALLPAPERSCRIPT_H
#include <kgenericfactory.h>
#include <kplugininfo.h>
#include <plasma/plasma_export.h>
#include <plasma/scripting/scriptengine.h>
#include <plasma/wallpaper.h>
namespace Plasma
{
class WallpaperScriptPrivate;
class Service;
/**
* @class WallpaperScript plasma/scripting/wallpaperscript.h <Plasma/Scripting/WallpaperScript>
*
* @short Provides a restricted interface for scripting a Wallpaper
*/
class PLASMA_EXPORT WallpaperScript : public ScriptEngine
{
Q_OBJECT
public:
/**
* Default constructor for a WallpaperScript.
* Subclasses should not attempt to access the Plasma::Wallpaper
* associated with this WallpaperScript in the constructor. All
* such set up that requires the Wallpaper itself should be done
* in the init() method.
*/
explicit WallpaperScript(QObject *parent = 0);
~WallpaperScript();
/**
* Sets the Plasma::Wallpaper associated with this WallpaperScript
*/
void setWallpaper(Wallpaper *wallpaper);
/**
* Returns the Plasma::Wallpaper associated with this script component
*/
Wallpaper *wallpaper() const;
/**
* This method is called once the wallpaper is loaded or mode is changed.
*
* The mode can be retrieved using the renderingMode() method.
*
* @param config Config group to load settings
**/
virtual void initWallpaper(const KConfigGroup &config);
/**
* This method is called when the wallpaper should be painted.
*
* @param painter the QPainter to use to do the painting
* @param exposedRect the rect to paint within
**/
virtual void paint(QPainter *painter, const QRectF &exposedRect);
/**
* This method is called when settings need to be saved.
* @param config Config group to save settings
**/
virtual void save(KConfigGroup &config);
/**
* Returns a widget that can be used to configure the options (if any)
* associated with this wallpaper. It will be deleted by the caller
* when it complete. The default implementation returns a null pointer.
*
* To signal that settings have changed connect to
* settingsChanged(bool modified) in @p parent.
*
* @code connect(this, SIGNAL(settingsChanged(bool), parent, SLOT(settingsChanged(bool)))
* @endcode
*
* Emit settingsChanged(true) when the settings are changed and false when the original state is restored.
*
* Implementation detail note: for best visual results, use a QGridLayout with two columns,
* with the option labels in column 0
*/
virtual QWidget *createConfigurationInterface(QWidget *parent);
/**
* Mouse move event. To prevent further propagation of the event,
* the event must be accepted.
*
* @param event the mouse event object
*/
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
/**
* Mouse press event. To prevent further propagation of the even,
* and to receive mouseMoveEvents, the event must be accepted.
*
* @param event the mouse event object
*/
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
/**
* Mouse release event. To prevent further propagation of the event,
* the event must be accepted.
*
* @param event the mouse event object
*/
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
/**
* Mouse wheel event. To prevent further propagation of the event,
* the event must be accepted.
*
* @param event the wheel event object
*/
virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
/**
* Adds urls (e.g. from a drop)
* @since 4.7
*/
void setUrls(const KUrl::List urls);
protected:
/**
* @return absolute path to the main script file for this wallpaper
*/
QString mainScript() const;
/**
* @return the Package associated with this wallpaper which can
* be used to request resources, such as images and
* interface files.
*/
const Package *package() const;
/**
* @return the KPluginInfo associated with this wallpaper
*/
KPluginInfo description() const;
bool isInitialized() const;
QRectF boundingRect() const;
DataEngine *dataEngine(const QString &name) const;
void setResizeMethodHint(Wallpaper::ResizeMethod resizeMethod);
void setTargetSizeHint(const QSizeF &targetSize);
void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
void render(const QString &sourceImagePath, const QSize &size,
Wallpaper::ResizeMethod resizeMethod = Plasma::Wallpaper::ScaledResize,
const QColor &color = QColor(0, 0, 0));
void setUsingRenderingCache(bool useCache);
bool findInCache(const QString &key, QImage &image, unsigned int lastModified = 0);
void insertIntoCache(const QString& key, const QImage &image);
void setContextualActions(const QList<QAction*> &actions);
void update(const QRectF &exposedArea);
void configNeedsSaving();
protected Q_SLOTS:
virtual void renderCompleted(const QImage &image);
virtual void urlDropped(const KUrl &url);
private:
WallpaperScriptPrivate *const d;
};
#define K_EXPORT_PLASMA_WALLPAPERSCRIPTENGINE(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(factory("plasma_wallpaperscriptengine_" #libname))
} //Plasma namespace
#endif
|