Warning, file /office/calligra/libs/widgets/KoColorSetWidget.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 Copyright (c) 2007 C. Boemann <cbo@boemann.dk> 0003 Copyright (c) 2007 Fredy Yanardi <fyanardi@gmail.com> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef KOCOLORSETWIDGET_H_ 0022 #define KOCOLORSETWIDGET_H_ 0023 0024 #include <QWidgetAction> 0025 #include <QFrame> 0026 0027 #include "kowidgets_export.h" 0028 0029 class KoColor; 0030 class KoColorSet; 0031 0032 /** 0033 * @short A colormanaged widget for choosing a color from a colorset 0034 * 0035 * KoColorSetWidget is a widget for choosing a color (colormanaged via pigment). It shows a color 0036 * set plus optionally a checkbox to filter away bad matching colors. 0037 */ 0038 class KOWIDGETS_EXPORT KoColorSetWidget : public QFrame 0039 { 0040 0041 Q_OBJECT 0042 0043 public: 0044 0045 /** 0046 * Constructor for the widget, where color is initially blackpoint of sRGB 0047 * 0048 * @param parent parent QWidget 0049 */ 0050 explicit KoColorSetWidget(QWidget *parent = nullptr); 0051 0052 /** 0053 * Destructor 0054 */ 0055 ~KoColorSetWidget() override; 0056 0057 /** 0058 * Sets the color set that this widget shows. 0059 * @param colorSet pointer to the color set 0060 */ 0061 void setColorSet(KoColorSet *colorSet); 0062 0063 /** 0064 * Gets the current color set 0065 * @returns current color set,, 0 if none set 0066 */ 0067 KoColorSet* colorSet(); 0068 0069 protected: 0070 void resizeEvent(QResizeEvent *event) override; ///< reimplemented from QFrame 0071 0072 Q_SIGNALS: 0073 0074 /** 0075 * Emitted every time the color changes (by calling setColor() or 0076 * by user interaction. 0077 * @param color the new color 0078 * @param final if the value is final (ie not produced by the pointer moving over around) 0079 */ 0080 void colorChanged(const KoColor &color, bool final); 0081 0082 /** 0083 * Emitted every time the size of this widget changes because of new colorset with 0084 * different number of colors is loaded. This is useful for KoColorSetAction to update 0085 * correct size of the menu showing this widget. 0086 * @param size the new size 0087 */ 0088 void widgetSizeChanged(const QSize &size); 0089 0090 private: 0091 Q_PRIVATE_SLOT(d, void colorTriggered(KoColorPatch *)) 0092 Q_PRIVATE_SLOT(d, void addRemoveColors()) 0093 0094 class KoColorSetWidgetPrivate; 0095 KoColorSetWidgetPrivate * const d; 0096 }; 0097 0098 #endif