Plasma
framesvg.h
Go to the documentation of this file.
00001 /* 00002 * Copyright 2008 by Aaron Seigo <aseigo@kde.org> 00003 * Copyright 2008 Marco Martin <notmart@gmail.com> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU Library General Public License as 00007 * published by the Free Software Foundation; either version 2, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details 00014 * 00015 * You should have received a copy of the GNU Library General Public 00016 * License along with this program; if not, write to the 00017 * Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef PLASMA_FRAMESVG_H 00022 #define PLASMA_FRAMESVG_H 00023 00024 #include <QtCore/QObject> 00025 #include <QtGui/QPixmap> 00026 00027 #include <plasma/plasma_export.h> 00028 00029 #include <plasma/plasma.h> 00030 #include <plasma/svg.h> 00031 00032 class QPainter; 00033 class QPoint; 00034 class QPointF; 00035 class QRect; 00036 class QRectF; 00037 class QSize; 00038 class QSizeF; 00039 class QMatrix; 00040 00041 namespace Plasma 00042 { 00043 00044 class FrameSvgPrivate; 00045 00076 class PLASMA_EXPORT FrameSvg : public Svg 00077 { 00078 Q_OBJECT 00079 00080 Q_FLAGS(EnabledBorders) 00081 Q_PROPERTY(EnabledBorders enabledBorders READ enabledBorders WRITE setEnabledBorders) 00082 00083 public: 00087 enum EnabledBorder { 00088 NoBorder = 0, 00089 TopBorder = 1, 00090 BottomBorder = 2, 00091 LeftBorder = 4, 00092 RightBorder = 8, 00093 AllBorders = TopBorder | BottomBorder | LeftBorder | RightBorder 00094 }; 00095 Q_DECLARE_FLAGS(EnabledBorders, EnabledBorder) 00096 00097 00106 explicit FrameSvg(QObject *parent = 0); 00107 ~FrameSvg(); 00108 00113 Q_INVOKABLE void setImagePath(const QString &path); 00114 00119 void setEnabledBorders(const EnabledBorders borders); 00120 00125 EnabledBorders enabledBorders() const; 00126 00131 Q_INVOKABLE void resizeFrame(const QSizeF &size); 00132 00136 Q_INVOKABLE QSizeF frameSize() const; 00137 00143 Q_INVOKABLE qreal marginSize(const Plasma::MarginEdge edge) const; 00144 00153 Q_INVOKABLE void getMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const; 00154 00158 Q_INVOKABLE QRectF contentsRect() const; 00159 00169 Q_INVOKABLE void setElementPrefix(Plasma::Location location); 00170 00187 Q_INVOKABLE void setElementPrefix(const QString & prefix); 00188 00194 Q_INVOKABLE bool hasElementPrefix(const QString & prefix) const; 00195 00204 Q_INVOKABLE bool hasElementPrefix(Plasma::Location location) const; 00205 00210 Q_INVOKABLE QString prefix(); 00211 00216 Q_INVOKABLE QRegion mask() const; 00217 00221 QPixmap alphaMask() const; 00222 00227 Q_INVOKABLE void setCacheAllRenderedFrames(bool cache); 00228 00232 Q_INVOKABLE bool cacheAllRenderedFrames() const; 00233 00239 Q_INVOKABLE void clearCache(); 00240 00248 Q_INVOKABLE QPixmap framePixmap(); 00249 00256 Q_INVOKABLE void paintFrame(QPainter *painter, const QRectF &target, 00257 const QRectF &source = QRectF()); 00258 00265 Q_INVOKABLE void paintFrame(QPainter *painter, const QPointF &pos = QPointF(0, 0)); 00266 00267 private: 00268 FrameSvgPrivate *const d; 00269 friend class Applet; 00270 00271 Q_PRIVATE_SLOT(d, void updateSizes()) 00272 Q_PRIVATE_SLOT(d, void updateNeeded()) 00273 }; 00274 00275 } // Plasma namespace 00276 00277 Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::FrameSvg::EnabledBorders) 00278 00279 #endif // multiple inclusion guard
KDE 4.6 API Reference