Krita

PaletteView.h
1 /*
2  * SPDX-FileCopyrightText: 2017 Wolthera van Hövell tot Westerflier <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 
7 #ifndef LIBKIS_PALETTE_VIEW_H
8 #define LIBKIS_PALETTE_VIEW_H
9 
10 #include <QObject>
11 #include <QScopedPointer>
12 #include "kritalibkis_export.h"
13 #include "libkis.h"
14 #include "Palette.h"
15 #include "ManagedColor.h"
16 #include "KoColorSet.h"
17 #include <kis_palette_view.h>
18 #include <KisPaletteModel.h>
19 
20 #include <Swatch.h>
21 
22 class KisSwatch;
23 
24 /**
25  * @class PaletteView
26  * @brief The PaletteView class is a wrapper around a MVC method for handling
27  * palettes. This class shows a nice widget that can drag and drop, edit colors in a colorset
28  * and will handle adding and removing entries if you'd like it to.
29  */
30 
31 class KRITALIBKIS_EXPORT PaletteView : public QWidget
32 {
33  Q_OBJECT
34 public:
35  PaletteView(QWidget *parent = 0);
36  ~PaletteView();
37 public Q_SLOTS:
38  /**
39  * @brief setPalette
40  * Set a new palette.
41  * @param palette
42  */
43  void setPalette(Palette *palette);
44  /**
45  * @brief addEntryWithDialog
46  * This gives a simple dialog for adding colors, with options like
47  * adding name, id, and to which group the color should be added.
48  * @param color the default color to add
49  * @return whether it was successful.
50  */
51  bool addEntryWithDialog(ManagedColor *color);
52  /**
53  * @brief addGroupWithDialog
54  * gives a little dialog to ask for the desired groupname.
55  * @return whether this was successful.
56  */
57  bool addGroupWithDialog();
58  /**
59  * @brief removeSelectedEntryWithDialog
60  * removes the selected entry. If it is a group, it pop up a dialog
61  * asking whether the colors should also be removed.
62  * @return whether this was successful
63  */
64  bool removeSelectedEntryWithDialog();
65  /**
66  * @brief trySelectClosestColor
67  * tries to select the closest color to the one given.
68  * It does not force a change on the active color.
69  * @param color the color to compare to.
70  */
71  void trySelectClosestColor(ManagedColor *color);
72 Q_SIGNALS:
73  /**
74  * @brief entrySelectedForeGround
75  * fires when a swatch is selected with leftclick.
76  * @param entry
77  */
78  void entrySelectedForeGround(Swatch entry);
79  /**
80  * @brief entrySelectedBackGround
81  * fires when a swatch is selected with rightclick.
82  * @param entry
83  */
84  void entrySelectedBackGround(Swatch entry);
85 
86 private Q_SLOTS:
87 
88  void fgSelected(KisSwatch swatch);
89  void bgSelected(KisSwatch swatch);
90 
91 private:
92 
93 
94 
95  struct Private;
97 };
98 
99 #endif // LIBKIS_PALETTE_VIEW_H
Q_SLOTSQ_SLOTS
void setPalette(const QPalette &)
The Palette class Palette is a resource object that stores organised color data.
Definition: Palette.h:45
The Swatch class is a thin wrapper around the KisSwatch class.
Definition: Swatch.h:21
The ManagedColor class is a class to handle colors that are color managed.
Definition: ManagedColor.h:45
Q_SIGNALSQ_SIGNALS
The PaletteView class is a wrapper around a MVC method for handling palettes. This class shows a nice...
Definition: PaletteView.h:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Sep 29 2023 04:08:11 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.