summaryrefslogtreecommitdiffstats
path: root/kchart/kchartDataConfigPage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kchart/kchartDataConfigPage.cpp')
-rw-r--r--kchart/kchartDataConfigPage.cpp149
1 files changed, 149 insertions, 0 deletions
diff --git a/kchart/kchartDataConfigPage.cpp b/kchart/kchartDataConfigPage.cpp
new file mode 100644
index 000000000..3a3968e40
--- /dev/null
+++ b/kchart/kchartDataConfigPage.cpp
@@ -0,0 +1,149 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001,2002,2003,2004 Laurent Montel <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include "kchartDataConfigPage.h"
+
+#include "kchartDataConfigPage.moc"
+
+#include <tdeapplication.h>
+#include <tdelocale.h>
+#include <kcolorbutton.h>
+#include <kdebug.h>
+
+#include <tqhbox.h>
+#include <tqlayout.h>
+#include <tqlabel.h>
+#include <tqlineedit.h>
+#include <tqlistbox.h>
+#include <tqbuttongroup.h>
+#include <tqvbuttongroup.h>
+#include <tqpushbutton.h>
+#include <tqradiobutton.h>
+#include <tqcheckbox.h>
+#include <tqpainter.h>
+#include <tqwhatsthis.h>
+
+#include <tdefontdialog.h>
+
+// For IRIX
+namespace std {}
+
+using namespace std;
+
+#include "kchart_params.h"
+#include "kchart_part.h"
+
+namespace KChart
+{
+
+KChartDataConfigPage::KChartDataConfigPage( KChartParams* params,
+ TQWidget* parent,
+ KDChartTableData *dat)
+ : TQWidget( parent ), m_params( params ), data(dat),
+ m_firstRowAsLabel(0), m_firstColAsLabel(0)
+{
+ TQGridLayout *grid1 = new TQGridLayout(this, 4, 1, KDialog::marginHint(),
+ KDialog::spacingHint());
+
+ // The Data Area
+ if ( !m_params->part()->canChangeValue() ) {
+ TQButtonGroup *gb1 = new TQVButtonGroup( i18n( "Data Area" ), this );
+
+ // ================================================================
+ // This code is copied from kchartWizardSelectDataFormatPage.cpp
+ TQHBox *hbox = new TQHBox( gb1 );
+ (void) new TQLabel( i18n("Area: "), hbox);
+ m_dataArea = new TQLineEdit( hbox );
+
+ // The row/column as label checkboxes.
+ m_firstRowAsLabel = new TQCheckBox( i18n( "First row as label" ), gb1);
+ m_firstColAsLabel = new TQCheckBox( i18n( "First column as label" ), gb1);
+
+ grid1->addWidget(gb1, 0, 0);
+ }
+
+ // The Data Format button group
+ TQButtonGroup *gb = new TQVButtonGroup( i18n( "Data Format" ), this );
+
+ m_rowMajor = new TQRadioButton( i18n( "Data in rows" ), gb );
+ m_rowMajor->resize( m_rowMajor->sizeHint() );
+
+ m_colMajor = new TQRadioButton( i18n( "Data in columns" ), gb );
+ m_colMajor->resize( m_colMajor->sizeHint() );
+
+ grid1->addWidget(gb, 2, 0);
+
+ TQWhatsThis::add(this, i18n("This configuration page can be used to swap the interpretation of rows and columns."));
+ TQWhatsThis::add(m_rowMajor, i18n("By default one row is considered to be a data set and each column holds the individual values of the data series. This sets the data in rows on your chart."));
+
+ TQWhatsThis::add(m_colMajor, i18n("Here you can choose to have each column hold one data set. Note that the values are not really swapped but only their interpretation."));
+ m_colMajor->resize( m_colMajor->sizeHint() );
+ grid1->addWidget(gb, 1, 0);
+ grid1->setColStretch(3, 0);
+
+ grid1->activate();
+}
+
+
+void KChartDataConfigPage::init()
+{
+ if (m_params->dataDirection() == KChartParams::DataRows)
+ m_rowMajor->setChecked(true);
+ else
+ m_colMajor->setChecked(true);
+
+ if ( !m_params->part()->canChangeValue() ) {
+ m_firstRowAsLabel->setChecked( m_params->firstRowAsLabel() );
+ m_firstColAsLabel->setChecked( m_params->firstColAsLabel() );
+
+ m_dataArea->setText( m_params->dataArea() );
+ }
+}
+
+
+void KChartDataConfigPage::defaults()
+{
+ m_colMajor->setChecked( true );
+
+ if ( !m_params->part()->canChangeValue() ) {
+ m_firstRowAsLabel->setChecked( false );
+ m_firstColAsLabel->setChecked( false );
+
+ m_dataArea->setText( "" );
+ }
+}
+
+
+void KChartDataConfigPage::apply()
+{
+ if (m_rowMajor->isChecked())
+ m_params->setDataDirection( KChartParams::DataRows );
+ else
+ m_params->setDataDirection( KChartParams::DataColumns );
+
+ if ( !m_params->part()->canChangeValue() ) {
+ m_params->setFirstRowAsLabel( m_firstRowAsLabel->isChecked() );
+ m_params->setFirstColAsLabel( m_firstColAsLabel->isChecked() );
+
+ m_params->setDataArea( m_dataArea->text() );
+ }
+}
+
+
+} //KChart namespace