libplasma
panelsvg.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_PANELSVG_H
00022 #define PLASMA_PANELSVG_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 PanelSvgPrivate;
00045
00046 class PLASMA_EXPORT PanelSvg : public Svg
00047 {
00048 Q_OBJECT
00049 public:
00053 enum EnabledBorder { NoBorder = 0,
00054 TopBorder = 1,
00055 BottomBorder = 2,
00056 LeftBorder = 4,
00057 RightBorder = 8,
00058 AllBorders = TopBorder | BottomBorder |
00059 LeftBorder | RightBorder
00060 };
00061 Q_DECLARE_FLAGS(EnabledBorders, EnabledBorder)
00062
00063
00072 explicit PanelSvg(QObject* parent = 0);
00073 ~PanelSvg();
00074
00079 void setImagePath(const QString& path);
00080
00085 void setEnabledBorders(const EnabledBorders borders);
00086
00091 EnabledBorders enabledBorders() const;
00092
00097 void resizePanel(const QSizeF& size);
00098
00102 QSizeF panelSize() const;
00103
00109 qreal marginSize(const Plasma::MarginEdge edge) const;
00110
00119 void getMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const;
00120
00127 void setElementPrefix(Plasma::Location location);
00128
00142 void setElementPrefix(const QString & prefix);
00143
00149 bool hasElementPrefix(const QString & prefix) const;
00150
00159 bool hasElementPrefix(Plasma::Location location) const;
00160
00165 QString prefix();
00166
00171 QBitmap mask() const;
00172
00177 void setCacheAllRenderedPanels(bool cache);
00178
00182 bool cacheAllRenderedPanels() const;
00183
00189 void clearCache();
00190
00196 Q_INVOKABLE void paintPanel(QPainter* painter, const QRectF& rect, const QPointF& pos = QPointF(0, 0));
00197
00198 private:
00199 PanelSvgPrivate * const d;
00200
00201 Q_PRIVATE_SLOT(d, void updateSizes())
00202 Q_PRIVATE_SLOT(d, void updateNeeded())
00203 };
00204
00205 }
00206
00207 Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::PanelSvg::EnabledBorders)
00208
00209 #endif // multiple inclusion guard