File indexing completed on 2024-05-12 15:59:08

0001 /*
0002  *  SPDX-License-Identifier: GPL-3.0-or-later
0003  */
0004 
0005 #ifndef SWATCH_H
0006 #define SWATCH_H
0007 
0008 #include "ManagedColor.h"
0009 
0010 #include "kritalibkis_export.h"
0011 #include "libkis.h"
0012 
0013 class KisSwatch;
0014 
0015 /**
0016  * @brief The Swatch class is a thin wrapper around the KisSwatch class.
0017  *
0018  * A Swatch is a single color that is part of a palette, that has a name
0019  * and an id. A Swatch color can be a spot color.
0020  */
0021 class KRITALIBKIS_EXPORT Swatch
0022 {
0023 private:
0024     friend class Palette;
0025     friend class PaletteView;
0026     Swatch(const KisSwatch &kisSwatch);
0027 public:
0028     Swatch();
0029     virtual ~Swatch();
0030     Swatch(const Swatch &rhs);
0031     Swatch &operator=(const Swatch &rhs);
0032 
0033     QString name() const;
0034     void setName(const QString &name);
0035 
0036     QString id() const;
0037     void setId(const QString &id);
0038 
0039     ManagedColor *color() const;
0040     void setColor(ManagedColor *color);
0041 
0042     bool spotColor() const;
0043     void setSpotColor(bool spotColor);
0044 
0045     bool isValid() const;
0046 
0047 private:
0048     friend class Palette;
0049     KisSwatch kisSwatch() const;
0050 
0051     struct Private;
0052     Private *const d;
0053 };
0054 
0055 #endif // SWATCH_H