summaryrefslogtreecommitdiffstats
path: root/chalk/ui/kis_multi_bool_filter_widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'chalk/ui/kis_multi_bool_filter_widget.cpp')
-rw-r--r--chalk/ui/kis_multi_bool_filter_widget.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/chalk/ui/kis_multi_bool_filter_widget.cpp b/chalk/ui/kis_multi_bool_filter_widget.cpp
new file mode 100644
index 000000000..e02695049
--- /dev/null
+++ b/chalk/ui/kis_multi_bool_filter_widget.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2005 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_multi_bool_filter_widget.h"
+
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqcheckbox.h>
+
+#include <tdelocale.h>
+
+KisBoolWidgetParam::KisBoolWidgetParam( bool ninitvalue, TQString nlabel, TQString nname) :
+ initvalue(ninitvalue),
+ label(nlabel),
+ name(nname)
+{
+
+}
+
+KisMultiBoolFilterWidget::KisMultiBoolFilterWidget(TQWidget * parent, const char * name, const char * caption, vKisBoolWidgetParam iwparam) :
+ KisFilterConfigWidget( parent, name )
+{
+ TQ_INT32 m_nbboolWidgets = iwparam.size();
+
+ this->setCaption(caption);
+
+ TQVBoxLayout *widgetLayout = new TQVBoxLayout(this, m_nbboolWidgets + 1);
+
+ m_boolWidgets = new TQCheckBox*[ m_nbboolWidgets ];
+
+ for( TQ_INT32 i = 0; i < m_nbboolWidgets; ++i)
+ {
+ m_boolWidgets[i] = new TQCheckBox( this, iwparam[i].name.ascii());
+ m_boolWidgets[i]->setChecked( iwparam[i].initvalue );
+ m_boolWidgets[i]->setText( iwparam[i].label );
+ connect(m_boolWidgets[i], TQT_SIGNAL(toggled( bool ) ), TQT_SIGNAL(sigPleaseUpdatePreview()));
+ widgetLayout->add( m_boolWidgets[i]);
+ }
+// TQSpacerItem * sp = new TQSpacerItem(1, 1);
+ widgetLayout->addStretch();
+}
+
+
+void KisMultiBoolFilterWidget::setConfiguration(KisFilterConfiguration * config)
+{
+
+ for (int i = 0; i < m_nbboolWidgets; ++i) {
+ double val = config->getBool(m_boolWidgets[i]->name());
+ m_boolWidgets[i]->setChecked(val);
+ }
+}
+
+#include "kis_multi_bool_filter_widget.moc"