Changeset View
Changeset View
Standalone View
Standalone View
libs/widgets/kis_palette_view.h
Context not available. | |||||
21 | #define __KIS_PALETTE_VIEW_H | 21 | #define __KIS_PALETTE_VIEW_H | ||
---|---|---|---|---|---|
22 | 22 | | |||
23 | #include <QScopedPointer> | 23 | #include <QScopedPointer> | ||
24 | 24 | #include <QTableView> | |||
25 | #include <QColorDialog> | 25 | #include <QColorDialog> | ||
26 | #include <QPushButton> | 26 | #include <QPushButton> | ||
27 | #include <QPixmap> | 27 | #include <QPixmap> | ||
28 | #include <QIcon> | 28 | #include <QIcon> | ||
29 | 29 | | |||
30 | #include <KoTableView.h> | | |||
31 | #include <KoColorSet.h> | 30 | #include <KoColorSet.h> | ||
32 | #include "kritawidgets_export.h" | 31 | #include "kritawidgets_export.h" | ||
33 | 32 | | |||
34 | class KisPaletteModel; | 33 | class KisPaletteModel; | ||
35 | class QWheelEvent; | 34 | class QWheelEvent; | ||
35 | class KoColorDisplayRendererInterface; | ||||
36 | 36 | | |||
37 | 37 | class KRITAWIDGETS_EXPORT KisPaletteView : public QTableView | |||
38 | class KRITAWIDGETS_EXPORT KisPaletteView : public KoTableView | | |||
39 | { | 38 | { | ||
40 | Q_OBJECT | 39 | Q_OBJECT | ||
40 | private: | ||||
41 | static int MININUM_ROW_HEIGHT; | ||||
41 | public: | 42 | public: | ||
42 | KisPaletteView(QWidget *parent = 0); | 43 | explicit KisPaletteView(QWidget *parent = Q_NULLPTR); | ||
43 | ~KisPaletteView() override; | 44 | ~KisPaletteView() override; | ||
44 | 45 | | |||
45 | void setPaletteModel(KisPaletteModel *model); | 46 | void setPaletteModel(KisPaletteModel *model); | ||
46 | KisPaletteModel* paletteModel() const; | 47 | KisPaletteModel* paletteModel() const; | ||
47 | 48 | | |||
48 | /** | 49 | public: | ||
49 | * @brief updateRows | | |||
50 | * update the rows so they have the proper columnspanning. | | |||
51 | */ | | |||
52 | void updateRows(); | | |||
53 | 50 | | |||
54 | /** | 51 | /** | ||
55 | * @brief setAllowModification | 52 | * @brief setAllowModification | ||
Context not available. | |||||
58 | */ | 55 | */ | ||
59 | void setAllowModification(bool allow); | 56 | void setAllowModification(bool allow); | ||
60 | 57 | | |||
58 | void setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer); | ||||
59 | | ||||
61 | /** | 60 | /** | ||
62 | * @brief setCrossedKeyword | 61 | * @brief setCrossedKeyword | ||
63 | * this apparently allows you to set keywords that can cross out colors. | 62 | * this apparently allows you to set keywords that can cross out colors. | ||
Context not available. | |||||
65 | * @param value | 64 | * @param value | ||
66 | */ | 65 | */ | ||
67 | void setCrossedKeyword(const QString &value); | 66 | void setCrossedKeyword(const QString &value); | ||
67 | void removeSelectedEntry(); | ||||
68 | /** | ||||
69 | * @brief selectClosestColor | ||||
70 | * select a color that's closest to parameter color | ||||
71 | * @param color | ||||
72 | */ | ||||
73 | void selectClosestColor(const KoColor &color); | ||||
68 | 74 | | |||
69 | public Q_SLOTS: | | |||
70 | void paletteModelChanged(); | | |||
71 | /** | 75 | /** | ||
72 | * add an entry with a dialog window. | 76 | * add an entry with a dialog window. | ||
77 | * @warning deprecated. | ||||
78 | * kept for compatibility with @ref PaletteView in @ref libkis | ||||
73 | */ | 79 | */ | ||
74 | bool addEntryWithDialog(KoColor color); | 80 | bool addEntryWithDialog(KoColor color); | ||
75 | /** | | |||
76 | * @brief addGroupWithDialog | | |||
77 | * summons a little dialog to name the new group. | | |||
78 | */ | | |||
79 | bool addGroupWithDialog(); | | |||
80 | /** | 81 | /** | ||
81 | * remove entry with a dialog window.(Necessary for groups. | 82 | * remove entry with a dialog window.(Necessary for groups. | ||
83 | * @warning deprecated. | ||||
84 | * kept for compatibility with @ref PaletteView in @ref libkis | ||||
82 | */ | 85 | */ | ||
83 | bool removeEntryWithDialog(QModelIndex index); | 86 | bool removeEntryWithDialog(QModelIndex index); | ||
84 | /** | 87 | /** | ||
85 | * This tries to select the closest color in the palette. | 88 | * add entry with a dialog window. | ||
86 | * This doesn't update the foreground color, just the visual selection. | 89 | * @warning deprecated. | ||
90 | * kept for compatibility with @ref PaletteView in @ref libkis | ||||
87 | */ | 91 | */ | ||
88 | void trySelectClosestColor(KoColor color); | 92 | bool addGroupWithDialog(); | ||
93 | | ||||
89 | Q_SIGNALS: | 94 | Q_SIGNALS: | ||
95 | void sigIndexSelected(const QModelIndex &index); | ||||
96 | void sigColorSelected(const KoColor &); | ||||
97 | | ||||
98 | public Q_SLOTS: | ||||
90 | /** | 99 | /** | ||
91 | * @brief entrySelected | 100 | * This tries to select the closest color in the palette. | ||
92 | * signals when an entry is selected. | 101 | * This doesn't update the foreground color, just the visual selection. | ||
93 | * @param entry the selected entry. | | |||
94 | */ | 102 | */ | ||
95 | void entrySelected(KoColorSetEntry entry); | 103 | void slotFGColorChanged(const KoColor &); | ||
96 | void entrySelectedBackGround(KoColorSetEntry entry); | 104 | | ||
97 | void indexEntrySelected(QModelIndex index); | 105 | private Q_SLOTS: | ||
98 | protected: | 106 | void slotHorizontalHeaderResized(int, int, int newSize); | ||
99 | void mouseReleaseEvent(QMouseEvent *event) override; | 107 | void slotAdditionalGuiUpdate(); | ||
100 | void wheelEvent(QWheelEvent *event) override; | 108 | void slotCurrentSelectionChanged(const QModelIndex &newCurrent); | ||
109 | | ||||
110 | private: | ||||
111 | void resizeRows(int newSize); | ||||
101 | 112 | | |||
102 | private: | 113 | private: | ||
103 | struct Private; | 114 | struct Private; | ||
104 | const QScopedPointer<Private> m_d; | 115 | const QScopedPointer<Private> m_d; | ||
105 | private Q_SLOTS: | | |||
106 | /** | | |||
107 | * @brief entrySelection | | |||
108 | * the function that will emit entrySelected when the entry changes. | | |||
109 | */ | | |||
110 | void entrySelection(bool foreground = true); | | |||
111 | /** | | |||
112 | * @brief modifyEntry | | |||
113 | * function for changing the entry at the given index. | | |||
114 | * if modification isn't allow(@see setAllowModification), this does nothing. | | |||
115 | */ | | |||
116 | void modifyEntry(QModelIndex index); | | |||
117 | }; | 116 | }; | ||
118 | 117 | | |||
119 | #endif /* __KIS_PALETTE_VIEW_H */ | 118 | #endif /* __KIS_PALETTE_VIEW_H */ | ||
Context not available. |