libplasma
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
00025 #include <plasma/plasma_export.h>
00026
00027 class QPainter;
00028 class QPoint;
00029 class QPointF;
00030 class QRect;
00031 class QRectF;
00032 class QSize;
00033 class QSizeF;
00034 class QMatrix;
00035
00036 namespace Plasma
00037 {
00038
00039 class SvgPrivate;
00040 class PanelSvgPrivate;
00041
00050 class PLASMA_EXPORT Svg : public QObject
00051 {
00052 Q_OBJECT
00053 Q_ENUMS( ContentType )
00054 Q_PROPERTY( QSize size READ size )
00055 Q_PROPERTY( bool multipleImages READ containsMultipleImages WRITE setContainsMultipleImages )
00056 Q_PROPERTY( QString filePath READ imagePath WRITE setImagePath )
00057
00058 public:
00059
00073 explicit Svg(QObject* parent = 0);
00074 ~Svg();
00075
00076
00083 Q_INVOKABLE void paint(QPainter* painter, const QPointF& point,
00084 const QString& elementID = QString());
00085
00092 Q_INVOKABLE void paint(QPainter* painter, int x, int y,
00093 const QString& elementID = QString());
00094
00102 Q_INVOKABLE void paint(QPainter* painter, const QRectF& rect,
00103 const QString& elementID = QString());
00104
00109 QSize size() const;
00110
00117 Q_INVOKABLE void resize( qreal width, qreal height );
00118
00124 Q_INVOKABLE void resize( const QSizeF& size );
00125
00130 Q_INVOKABLE void resize();
00131
00137 Q_INVOKABLE QSize elementSize( const QString& elementId ) const;
00138
00144 Q_INVOKABLE QRectF elementRect(const QString& elementId) const;
00145
00151 Q_INVOKABLE bool hasElement( const QString& elementId ) const;
00152
00157 Q_INVOKABLE QString elementAtPoint(const QPoint &point) const;
00158
00164 Q_INVOKABLE bool isValid() const;
00165
00170 void setContainsMultipleImages(bool multiple);
00171
00175 bool containsMultipleImages() const;
00176
00181 void setImagePath(const QString &svgFilePath);
00182
00187 QString imagePath() const;
00188
00189 Q_SIGNALS:
00190 void repaintNeeded();
00191
00192 private:
00193 SvgPrivate* const d;
00194
00195 Q_PRIVATE_SLOT(d, void themeChanged())
00196 Q_PRIVATE_SLOT(d, void colorsChanged())
00197
00198 friend class SvgPrivate;
00199 friend class PanelSvgPrivate;
00200 };
00201
00202 }
00203
00204 #endif // multiple inclusion guard
00205