Plasma

framesvg.h
1 /*
2  SPDX-FileCopyrightText: 2008 Aaron Seigo <[email protected]>
3  SPDX-FileCopyrightText: 2008 Marco Martin <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef PLASMA_FRAMESVG_H
9 #define PLASMA_FRAMESVG_H
10 
11 #include <QObject>
12 #include <QPixmap>
13 
14 #include <plasma/plasma_export.h>
15 
16 #include <plasma/plasma.h>
17 #include <plasma/svg.h>
18 
19 class QPainter;
20 class QPoint;
21 class QPointF;
22 class QRect;
23 class QRectF;
24 class QSize;
25 class QSizeF;
26 class QMatrix;
27 
28 namespace Plasma
29 {
30 
31 class FrameSvgPrivate;
32 
63 class PLASMA_EXPORT FrameSvg : public Svg
64 {
65  Q_OBJECT
66 
67  Q_PROPERTY(EnabledBorders enabledBorders READ enabledBorders WRITE setEnabledBorders)
68 
69 public:
74  NoBorder = 0,
75  TopBorder = 1,
76  BottomBorder = 2,
77  LeftBorder = 4,
78  RightBorder = 8,
79  AllBorders = TopBorder | BottomBorder | LeftBorder | RightBorder
80  };
81  Q_DECLARE_FLAGS(EnabledBorders, EnabledBorder)
82  Q_FLAG(EnabledBorders)
83 
84 
93  explicit FrameSvg(QObject *parent = nullptr);
94  ~FrameSvg() override;
95 
100  Q_INVOKABLE void setImagePath(const QString &path) override;
101 
106  void setEnabledBorders(const EnabledBorders borders);
107 
112  EnabledBorders enabledBorders() const;
113 
118  Q_INVOKABLE void resizeFrame(const QSizeF &size);
119 
123  Q_INVOKABLE QSizeF frameSize() const;
124 
132  Q_INVOKABLE qreal marginSize(const Plasma::Types::MarginEdge edge) const;
133 
144  Q_INVOKABLE void getMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const;
145 
152  Q_INVOKABLE qreal fixedMarginSize(const Plasma::Types::MarginEdge edge) const;
153 
163  Q_INVOKABLE void getFixedMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const;
164 
171  Q_INVOKABLE qreal insetSize(const Plasma::Types::MarginEdge edge) const;
172 
182  Q_INVOKABLE void getInset(qreal &left, qreal &top, qreal &right, qreal &bottom) const;
183 
187  Q_INVOKABLE QRectF contentsRect() const;
188 
198  Q_INVOKABLE void setElementPrefix(Plasma::Types::Location location);
199 
216  Q_INVOKABLE void setElementPrefix(const QString &prefix);
217 
223  Q_INVOKABLE bool hasElementPrefix(const QString &prefix) const;
224 
233  Q_INVOKABLE bool hasElementPrefix(Plasma::Types::Location location) const;
234 
240  Q_INVOKABLE QString prefix();
241 
246  Q_INVOKABLE QRegion mask() const;
247 
251  QPixmap alphaMask() const;
252 
257  Q_INVOKABLE void setCacheAllRenderedFrames(bool cache);
258 
262  Q_INVOKABLE bool cacheAllRenderedFrames() const;
263 
269  Q_INVOKABLE void clearCache();
270 
278  Q_INVOKABLE QPixmap framePixmap();
279 
286  Q_INVOKABLE void paintFrame(QPainter *painter, const QRectF &target,
287  const QRectF &source = QRectF());
288 
295  Q_INVOKABLE void paintFrame(QPainter *painter, const QPointF &pos = QPointF(0, 0));
296 
301  QString actualPrefix() const;
302 
308  bool isRepaintBlocked() const;
309 
318  void setRepaintBlocked(bool blocked);
319 
320 private:
321  FrameSvgPrivate *const d;
322  friend class FrameData;
323 
324  //Q_PRIVATE_SLOT(d, void updateSizes())
325 };
326 
327 Q_DECLARE_OPERATORS_FOR_FLAGS(FrameSvg::EnabledBorders)
328 
329 } // Plasma namespace
330 
331 #endif // multiple inclusion guard
Provides an SVG with borders.
Definition: framesvg.h:63
Namespace for everything in libplasma.
Definition: datamodel.cpp:14
EnabledBorder
These flags represents what borders should be drawn.
Definition: framesvg.h:73
Location
The Location enumeration describes where on screen an element, such as an Applet or its managing cont...
Definition: plasma.h:153
A theme aware image-centric SVG class.
Definition: svg.h:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 22:46:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.