Plasma
framesvg.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
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 friend class Applet;
00081
00082 public:
00086 enum EnabledBorder {
00087 NoBorder = 0,
00088 TopBorder = 1,
00089 BottomBorder = 2,
00090 LeftBorder = 4,
00091 RightBorder = 8,
00092 AllBorders = TopBorder | BottomBorder | LeftBorder | RightBorder
00093 };
00094 Q_DECLARE_FLAGS(EnabledBorders, EnabledBorder)
00095
00096
00105 explicit FrameSvg(QObject *parent = 0);
00106 ~FrameSvg();
00107
00112 Q_INVOKABLE void setImagePath(const QString &path);
00113
00118 Q_INVOKABLE void setEnabledBorders(const EnabledBorders borders);
00119
00124 Q_INVOKABLE EnabledBorders enabledBorders() const;
00125
00130 Q_INVOKABLE void resizeFrame(const QSizeF &size);
00131
00135 Q_INVOKABLE QSizeF frameSize() const;
00136
00142 Q_INVOKABLE qreal marginSize(const Plasma::MarginEdge edge) const;
00143
00152 Q_INVOKABLE void getMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const;
00153
00157 Q_INVOKABLE QRectF contentsRect() const;
00158
00165 Q_INVOKABLE void setElementPrefix(Plasma::Location location);
00166
00180 Q_INVOKABLE void setElementPrefix(const QString & prefix);
00181
00187 Q_INVOKABLE bool hasElementPrefix(const QString & prefix) const;
00188
00197 Q_INVOKABLE bool hasElementPrefix(Plasma::Location location) const;
00198
00203 Q_INVOKABLE QString prefix();
00204
00209 Q_INVOKABLE QRegion mask() const;
00210
00214 QPixmap alphaMask() const;
00215
00220 Q_INVOKABLE void setCacheAllRenderedFrames(bool cache);
00221
00225 Q_INVOKABLE bool cacheAllRenderedFrames() const;
00226
00232 Q_INVOKABLE void clearCache();
00233
00241 Q_INVOKABLE QPixmap framePixmap();
00242
00249 Q_INVOKABLE void paintFrame(QPainter *painter, const QRectF &target,
00250 const QRectF &source = QRectF());
00251
00258 Q_INVOKABLE void paintFrame(QPainter *painter, const QPointF &pos = QPointF(0, 0));
00259
00260 private:
00261 FrameSvgPrivate *const d;
00262
00263 Q_PRIVATE_SLOT(d, void updateSizes())
00264 Q_PRIVATE_SLOT(d, void updateNeeded())
00265 Q_PRIVATE_SLOT(d, void scheduledCacheUpdate())
00266 };
00267
00268 }
00269
00270 Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::FrameSvg::EnabledBorders)
00271
00272 #endif // multiple inclusion guard