Warning, file /office/calligra/libs/widgets/KoEditColorSetDialog.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 Fredy Yanardi <fyanardi@gmail.com>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef KOEDITCOLORSET_H
0021 #define KOEDITCOLORSET_H
0022 
0023 #include <ui_KoEditColorSet.h>
0024 
0025 #include <KoDialog.h>
0026 
0027 #include "kowidgets_export.h"
0028 
0029 class QGridLayout;
0030 class QScrollArea;
0031 class KoColorPatch;
0032 class KoColorSet;
0033 
0034 class KoEditColorSetWidget : public QWidget
0035 {
0036     Q_OBJECT
0037 public:
0038     KoEditColorSetWidget(const QList<KoColorSet *> &palettes, const QString &activePalette, QWidget *parent = 0);
0039     ~KoEditColorSetWidget() override;
0040 
0041     /**
0042      * Return the active color set. The caller takes ownership of that color set.
0043      */
0044     KoColorSet *activeColorSet();
0045 
0046 private Q_SLOTS:
0047     void setActiveColorSet(int index);
0048     void setTextLabel(KoColorPatch *patch);
0049     void addColor();
0050     void removeColor();
0051     void open();
0052     void save();
0053 
0054 private:
0055     Ui::KoEditColorSet widget;
0056     QList<KoColorSet *> m_colorSets;
0057     QGridLayout *m_gridLayout;
0058     QScrollArea *m_scrollArea;
0059     KoColorSet *m_activeColorSet;
0060     KoColorPatch *m_activePatch;
0061     uint m_initialColorSetCount;
0062     bool m_activeColorSetRequested;
0063 };
0064 
0065 /**
0066  * A dialog for editing palettes/color sets in an application. Example use of this dialog is in text color toolbar,
0067  * the toolbar brings a set of colors from one palette, and a button brings this dialog for editing palettes.
0068  * This dialog is able to:
0069  * - Set active palette from a combobox
0070  * - Add/remove color from a palette
0071  * - Open new palette from a gimp palette file (.gpl)
0072  * - Save changes to the file
0073  * @see KoColorSetWidget
0074  */
0075 class KOWIDGETS_EXPORT KoEditColorSetDialog : public KoDialog
0076 {
0077     Q_OBJECT
0078 
0079 public:
0080     /**
0081      * Constructs a KoEditColorSetDialog.
0082      * @param palettes all available palettes that are going to be edited.
0083      * @param activePalette name of the palette which will be activated after this dialog is shown.
0084      * @param parent the parent widget
0085      */
0086     KoEditColorSetDialog(const QList<KoColorSet *> &palettes, const QString &activePalette, QWidget *parent = nullptr);
0087 
0088     /**
0089      * Returns the last active color set.
0090      * The caller takes ownership of that color set.
0091      * @return the last active KoColorSet in the dialog before the user press OK
0092      */
0093     KoColorSet *activeColorSet();
0094 
0095     /**
0096      * Destructor
0097      */
0098     ~KoEditColorSetDialog() override;
0099 
0100 private:
0101     KoEditColorSetWidget *ui;
0102 };
0103 
0104 #endif
0105