1 /*
2  *  Copyright (c) 2005 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef _KIS_MULTI_BOOL_FILTER_WIDGET_H_
20 #define _KIS_MULTI_BOOL_FILTER_WIDGET_H_
21 
22 #include <vector>
23 
24 #include <QCheckBox>
25 #include <QVector>
26 
27 #include "kritaui_export.h"
28 #include <kis_config_widget.h>
29 
30 class KisPropertiesConfiguration;
31 
32 struct KisBoolWidgetParam {
33     KRITAUI_EXPORT KisBoolWidgetParam(bool ninitvalue, const QString & label, const QString & name);
34     bool initvalue;
35     QString label;
36     QString name;
37 
38 };
39 
40 typedef std::vector<KisBoolWidgetParam> vKisBoolWidgetParam;
41 
42 class KRITAUI_EXPORT KisMultiBoolFilterWidget : public KisConfigWidget
43 {
44     Q_OBJECT
45 
46 public:
47 
48     KisMultiBoolFilterWidget(const QString & filterid, QWidget * parent,  const QString & caption, vKisBoolWidgetParam iwparam);
49 
50     void setConfiguration(const KisPropertiesConfigurationSP cfg) override;
51 
52     KisPropertiesConfigurationSP configuration() const override;
53 
54 public:
55 
nbValues()56     inline qint32 nbValues() const {
57         return m_boolWidgets.count();
58     }
59 
valueAt(qint32 i)60     inline bool valueAt(qint32 i) const {
61         return m_boolWidgets[i]->isChecked();
62     }
63 
64 private:
65 
66     QVector<QCheckBox*> m_boolWidgets;
67     QString m_filterid;
68 };
69 
70 #endif
71