Warning, file /office/calligra/libs/flake/KoShapeStroke.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the KDE project 0002 * 0003 * Copyright (C) 2006-2007 Thomas Zander <zander@kde.org> 0004 * Copyright (C) 2006-2008 Jan Hambrecht <jaham@gmx.net> 0005 * Copyright (C) 2007,2009 Thorsten Zachmann <zachmann@kde.org> 0006 * Copyright (C) 2012 Inge Wallin <inge@lysator.liu.se> 0007 * 0008 * This library is free software; you can redistribute it and/or 0009 * modify it under the terms of the GNU Library General Public 0010 * License as published by the Free Software Foundation; either 0011 * version 2 of the License, or (at your option) any later version. 0012 * 0013 * This library is distributed in the hope that it will be useful, 0014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0016 * Library General Public License for more details. 0017 * 0018 * You should have received a copy of the GNU Library General Public License 0019 * along with this library; see the file COPYING.LIB. If not, write to 0020 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0021 * Boston, MA 02110-1301, USA. 0022 */ 0023 0024 #ifndef KOSHAPESTROKE_H 0025 #define KOSHAPESTROKE_H 0026 0027 #include "KoInsets.h" 0028 #include "KoShapeStrokeModel.h" 0029 0030 #include "flake_export.h" 0031 0032 #include <QMetaType> 0033 #include <QColor> 0034 0035 0036 class KoShape; 0037 class QPainter; 0038 class QBrush; 0039 class KoViewConverter; 0040 0041 /** 0042 * A border for shapes that draws a single line around the object. 0043 */ 0044 class FLAKE_EXPORT KoShapeStroke : public KoShapeStrokeModel 0045 { 0046 public: 0047 /// Constructor for a thin line in black 0048 KoShapeStroke(); 0049 0050 /// Copy constructor 0051 KoShapeStroke(const KoShapeStroke &other); 0052 0053 /** 0054 * Constructor for a Stroke 0055 * @param lineWidth the width, in pt 0056 * @param color the color we draw the outline in. 0057 */ 0058 explicit KoShapeStroke(qreal lineWidth, const QColor &color = Qt::black); 0059 ~KoShapeStroke() override; 0060 0061 /// Assignment operator 0062 KoShapeStroke& operator = (const KoShapeStroke &rhs); 0063 0064 /// Sets the lines cap style 0065 void setCapStyle(Qt::PenCapStyle style); 0066 /// Returns the lines cap style 0067 Qt::PenCapStyle capStyle() const; 0068 /// Sets the lines join style 0069 void setJoinStyle(Qt::PenJoinStyle style); 0070 /// Returns the lines join style 0071 Qt::PenJoinStyle joinStyle() const; 0072 /// Sets the line width 0073 void setLineWidth(qreal lineWidth); 0074 /// Returns the line width 0075 qreal lineWidth() const; 0076 /// Sets the miter limit 0077 void setMiterLimit(qreal miterLimit); 0078 /// Returns the miter limit 0079 qreal miterLimit() const; 0080 /// Sets the line style 0081 void setLineStyle(Qt::PenStyle style, const QVector<qreal> &dashes); 0082 /// Returns the line style 0083 Qt::PenStyle lineStyle() const; 0084 /// Returns the line dashes 0085 QVector<qreal> lineDashes() const; 0086 /// Sets the dash offset 0087 void setDashOffset(qreal dashOffset); 0088 /// Returns the dash offset 0089 qreal dashOffset() const; 0090 0091 /// Returns the color 0092 QColor color() const; 0093 /// Sets the color 0094 void setColor(const QColor &color); 0095 0096 /// Sets the strokes brush used to fill strokes of this border 0097 void setLineBrush(const QBrush & brush); 0098 /// Returns the strokes brush 0099 QBrush lineBrush() const; 0100 0101 // pure virtuals from KoShapeStrokeModel implemented here. 0102 void fillStyle(KoGenStyle &style, KoShapeSavingContext &context) const override; 0103 void strokeInsets(const KoShape *shape, KoInsets &insets) const override; 0104 bool hasTransparency() const override; 0105 void paint(KoShape *shape, QPainter &painter, const KoViewConverter &converter) override; 0106 void paint(KoShape *shape, QPainter &painter, const KoViewConverter &converter, const QColor &color) override; 0107 0108 private: 0109 class Private; 0110 Private * const d; 0111 }; 0112 0113 Q_DECLARE_METATYPE( KoShapeStroke ) 0114 0115 #endif // KOSHAPESTROKE_H