Plasma
svg.h
Go to the documentation of this file.
00001 /* 00002 * Copyright 2006-2007 Aaron Seigo <aseigo@kde.org> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License as 00006 * published by the Free Software Foundation; either version 2, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this program; if not, write to the 00016 * Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 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 FrameSvgPrivate; 00041 class SvgPrivate; 00042 class Theme; 00043 00056 class PLASMA_EXPORT Svg : public QObject 00057 { 00058 Q_OBJECT 00059 Q_ENUMS(ContentType) 00060 Q_PROPERTY(QSize size READ size WRITE resize NOTIFY sizeChanged) 00061 Q_PROPERTY(bool multipleImages READ containsMultipleImages WRITE setContainsMultipleImages) 00062 Q_PROPERTY(QString imagePath READ imagePath WRITE setImagePath) 00063 Q_PROPERTY(bool usingRenderingCache READ isUsingRenderingCache WRITE setUsingRenderingCache) 00064 00065 public: 00079 explicit Svg(QObject *parent = 0); 00080 ~Svg(); 00081 00089 Q_INVOKABLE QPixmap pixmap(const QString &elementID = QString()); 00090 00099 Q_INVOKABLE void paint(QPainter *painter, const QPointF &point, 00100 const QString &elementID = QString()); 00101 00110 Q_INVOKABLE void paint(QPainter *painter, int x, int y, 00111 const QString &elementID = QString()); 00112 00121 Q_INVOKABLE void paint(QPainter *painter, const QRectF &rect, 00122 const QString &elementID = QString()); 00123 00134 Q_INVOKABLE void paint(QPainter *painter, int x, int y, int width, 00135 int height, const QString &elementID = QString()); 00136 00141 QSize size() const; 00142 00149 Q_INVOKABLE void resize(qreal width, qreal height); 00150 00156 Q_INVOKABLE void resize(const QSizeF &size); 00157 00162 Q_INVOKABLE void resize(); 00163 00169 Q_INVOKABLE QSize elementSize(const QString &elementId) const; 00170 00176 Q_INVOKABLE QRectF elementRect(const QString &elementId) const; 00177 00183 Q_INVOKABLE bool hasElement(const QString &elementId) const; 00184 00189 Q_INVOKABLE QString elementAtPoint(const QPoint &point) const; 00190 00196 Q_INVOKABLE bool isValid() const; 00197 00202 void setContainsMultipleImages(bool multiple); 00203 00207 bool containsMultipleImages() const; 00208 00213 void setImagePath(const QString &svgFilePath); 00214 00219 QString imagePath() const; 00220 00235 void setUsingRenderingCache(bool useCache); 00236 00241 bool isUsingRenderingCache() const; 00242 00249 void setTheme(Plasma::Theme *theme); 00250 00254 Theme *theme() const; 00255 00256 Q_SIGNALS: 00257 void repaintNeeded(); 00258 void sizeChanged(); 00259 00260 private: 00261 SvgPrivate *const d; 00262 00263 Q_PRIVATE_SLOT(d, void themeChanged()) 00264 Q_PRIVATE_SLOT(d, void colorsChanged()) 00265 00266 friend class SvgPrivate; 00267 friend class FrameSvgPrivate; 00268 friend class FrameSvg; 00269 }; 00270 00271 } // Plasma namespace 00272 00273 #endif // multiple inclusion guard 00274
KDE 4.6 API Reference