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: 00080 explicit Svg(QObject *parent = 0); 00081 ~Svg(); 00082 00095 Q_INVOKABLE QPixmap pixmap(const QString &elementID = QString()); 00096 00111 Q_INVOKABLE void paint(QPainter *painter, const QPointF &point, 00112 const QString &elementID = QString()); 00113 00128 Q_INVOKABLE void paint(QPainter *painter, int x, int y, 00129 const QString &elementID = QString()); 00130 00140 Q_INVOKABLE void paint(QPainter *painter, const QRectF &rect, 00141 const QString &elementID = QString()); 00142 00154 Q_INVOKABLE void paint(QPainter *painter, int x, int y, int width, 00155 int height, const QString &elementID = QString()); 00156 00168 QSize size() const; 00169 00183 Q_INVOKABLE void resize(qreal width, qreal height); 00184 00197 Q_INVOKABLE void resize(const QSizeF &size); 00198 00204 Q_INVOKABLE void resize(); 00205 00216 Q_INVOKABLE QSize elementSize(const QString &elementId) const; 00217 00228 Q_INVOKABLE QRectF elementRect(const QString &elementId) const; 00229 00236 Q_INVOKABLE bool hasElement(const QString &elementId) const; 00237 00248 Q_INVOKABLE QString elementAtPoint(const QPoint &point) const; 00249 00258 Q_INVOKABLE bool isValid() const; 00259 00273 void setContainsMultipleImages(bool multiple); 00274 00286 bool containsMultipleImages() const; 00287 00302 void setImagePath(const QString &svgFilePath); 00303 00313 QString imagePath() const; 00314 00331 void setUsingRenderingCache(bool useCache); 00332 00339 bool isUsingRenderingCache() const; 00340 00351 void setTheme(Plasma::Theme *theme); 00352 00360 Theme *theme() const; 00361 00362 Q_SIGNALS: 00363 void repaintNeeded(); 00364 void sizeChanged(); 00365 00366 private: 00367 SvgPrivate *const d; 00368 00369 Q_PRIVATE_SLOT(d, void themeChanged()) 00370 Q_PRIVATE_SLOT(d, void colorsChanged()) 00371 00372 friend class SvgPrivate; 00373 friend class FrameSvgPrivate; 00374 friend class FrameSvg; 00375 }; 00376 00377 } // Plasma namespace 00378 00379 #endif // multiple inclusion guard 00380
KDE 4.7 API Reference