File indexing completed on 2024-05-12 15:56:39

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2008 Jan Hambrecht <jaham@gmx.net>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #ifndef KOCOLORBACKGROUND_H
0008 #define KOCOLORBACKGROUND_H
0009 
0010 #include "KoShapeBackground.h"
0011 #include "kritaflake_export.h"
0012 #include <Qt>
0013 #include <QSharedDataPointer>
0014 
0015 class KoColorBackgroundPrivate;
0016 class QColor;
0017 class QBrush;
0018 
0019 /// A simple solid color shape background
0020 class KRITAFLAKE_EXPORT KoColorBackground : public KoShapeBackground
0021 {
0022 public:
0023     KoColorBackground();
0024 
0025     /// Creates background from given color and style
0026     explicit KoColorBackground(const QColor &color, Qt::BrushStyle style = Qt::SolidPattern);
0027 
0028     ~KoColorBackground() override;
0029 
0030     // Work around MSVC inability to generate copy ops with QSharedDataPointer.
0031     KoColorBackground(const KoColorBackground &);
0032     KoColorBackground &operator=(const KoColorBackground &);
0033 
0034     bool compareTo(const KoShapeBackground *other) const override;
0035 
0036     /// Returns the background color
0037     QColor color() const;
0038 
0039     /// Sets the background color
0040     void setColor(const QColor &color);
0041 
0042     /// Returns the background style
0043     Qt::BrushStyle style() const;
0044 
0045     QBrush brush() const;
0046 
0047     // reimplemented from KoShapeBackground
0048     void paint(QPainter &painter, const QPainterPath &fillPath) const override;
0049 
0050 private:
0051     class Private;
0052     QSharedDataPointer<Private> d;
0053 };
0054 
0055 #endif // KOCOLORBACKGROUND_H