Plasma
svg.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_SVG_H
00021 #define PLASMA_SVG_H
00022
00023 #include <QtCore/QObject>
00024 #include <QtGui/QPixmap>
00025
00026 #include <plasma/plasma_export.h>
00027
00028 class QPainter;
00029 class QPoint;
00030 class QPointF;
00031 class QRect;
00032 class QRectF;
00033 class QSize;
00034 class QSizeF;
00035 class QMatrix;
00036
00037 namespace Plasma
00038 {
00039
00040 class SvgPrivate;
00041 class FrameSvgPrivate;
00042
00055 class PLASMA_EXPORT Svg : public QObject
00056 {
00057 Q_OBJECT
00058 Q_ENUMS(ContentType)
00059 Q_PROPERTY(QSize size READ size)
00060 Q_PROPERTY(bool multipleImages READ containsMultipleImages WRITE setContainsMultipleImages)
00061 Q_PROPERTY(QString imagePath READ imagePath WRITE setImagePath)
00062
00063 public:
00064
00078 explicit Svg(QObject *parent = 0);
00079 ~Svg();
00080
00088 Q_INVOKABLE QPixmap pixmap(const QString &elementID = QString());
00089
00098 Q_INVOKABLE void paint(QPainter *painter, const QPointF &point,
00099 const QString &elementID = QString());
00100
00109 Q_INVOKABLE void paint(QPainter *painter, int x, int y,
00110 const QString &elementID = QString());
00111
00120 Q_INVOKABLE void paint(QPainter *painter, const QRectF &rect,
00121 const QString &elementID = QString());
00122
00133 Q_INVOKABLE void paint(QPainter *painter, int x, int y, int width,
00134 int height, const QString &elementID = QString());
00135
00140 QSize size() const;
00141
00148 Q_INVOKABLE void resize(qreal width, qreal height);
00149
00155 Q_INVOKABLE void resize(const QSizeF &size);
00156
00161 Q_INVOKABLE void resize();
00162
00168 Q_INVOKABLE QSize elementSize(const QString &elementId) const;
00169
00175 Q_INVOKABLE QRectF elementRect(const QString &elementId) const;
00176
00182 Q_INVOKABLE bool hasElement(const QString &elementId) const;
00183
00188 Q_INVOKABLE QString elementAtPoint(const QPoint &point) const;
00189
00195 Q_INVOKABLE bool isValid() const;
00196
00201 void setContainsMultipleImages(bool multiple);
00202
00206 bool containsMultipleImages() const;
00207
00212 void setImagePath(const QString &svgFilePath);
00213
00218 QString imagePath() const;
00219
00220 Q_SIGNALS:
00221 void repaintNeeded();
00222
00223 private:
00224 SvgPrivate *const d;
00225
00226 Q_PRIVATE_SLOT(d, void themeChanged())
00227 Q_PRIVATE_SLOT(d, void colorsChanged())
00228 Q_PRIVATE_SLOT(d, void scheduledCacheUpdate())
00229
00230 friend class SvgPrivate;
00231 friend class FrameSvgPrivate;
00232 };
00233
00234 }
00235
00236 #endif // multiple inclusion guard
00237