2#include "kchartWizard.h"
3#include "kchartWizardSelectDataPage.h"
4#include "kchartWizardSelectChartTypePage.h"
5#include "kchartWizardSelectChartSubTypePage.h"
6#include "kchartWizardSetupDataPage.h"
7#include "kchartWizardLabelsLegendPage.h"
8#include "kchartWizardSetupAxesPage.h"
9#include "kchartWizardSelectDataFormatPage.h"
11#include <tqlineedit.h>
13#include <tqpushbutton.h>
16#include <kiconloader.h>
19#include "kchart_params.h"
24KChartWizard::KChartWizard ( KChartPart* _chart, TQWidget *parent,
const char* name,
25 bool modal, WFlags f ) :
26 KWizard( parent, name, modal, f ),
30 m_dataFormatPage =
new KChartWizardSelectDataFormatPage(
this, m_chart);
31 addPage( m_dataFormatPage, i18n(
"Data"));
32 setFinishEnabled(m_dataFormatPage,
true);
33 setHelpEnabled(m_dataFormatPage,
false);
36 m_chartTypePage =
new KChartWizardSelectChartTypePage(
this, m_chart );
37 addPage( m_chartTypePage, i18n(
"Select Chart Type" ) );
39 setFinishEnabled(m_chartTypePage,
true);
40 setHelpEnabled(m_chartTypePage,
false);
43 m_chartSubtypePage =
new KChartWizardSelectChartSubTypePage(
this, m_chart );
44 addPage( m_chartSubtypePage, i18n(
"Select Chart Sub-type" ) );
45 setFinishEnabled(m_chartSubtypePage,
true);
46 setHelpEnabled(m_chartSubtypePage,
false);
49 m_labelsLegendPage =
new KChartWizardLabelsLegendPage(
this, m_chart );
50 addPage( m_labelsLegendPage, i18n(
"Labels & Legend" ) );
51 setFinishEnabled(m_labelsLegendPage,
true);
52 setHelpEnabled(m_labelsLegendPage,
false);
55 m_axespage =
new KChartWizardSetupAxesPage(
this, m_chart );
56 addPage( m_axespage, i18n(
"Setup Axes" ) );
57 setFinishEnabled(m_axespage,
true);
58 setNextEnabled(m_axespage,
false);
59 setHelpEnabled(m_axespage,
false);
62 connect(
this, TQ_SIGNAL(finished()), m_dataFormatPage, TQ_SLOT(apply()));
63 connect(
this, TQ_SIGNAL(finished()), m_chartTypePage, TQ_SLOT(apply()));
64 connect(
this ,TQ_SIGNAL(finished()), m_chartSubtypePage, TQ_SLOT(apply()));
65 connect(
this, TQ_SIGNAL(finished()), m_labelsLegendPage, TQ_SLOT(apply()));
66 connect(
this, TQ_SIGNAL(finished()), m_axespage, TQ_SLOT(apply()));
68 connect( m_chartTypePage, TQ_SIGNAL( chartChange(
int ) ),
69 this, TQ_SLOT( subType(
int ) ) );
72 subType( m_chart->params()->chartType() );
73 kdDebug(35001) <<
"kchartwizard created" << endl;
77KChartWizard::~KChartWizard()
80 delete m_chartTypePage;
81 delete m_chartSubtypePage;
83 delete m_labelsLegendPage;
85 delete m_dataFormatPage;
88void KChartWizard::subType(
int _type)
90 KChartParams::ChartType type = (KChartParams::ChartType) _type;
91 if (type == KChartParams::Bar ||
92 type == KChartParams::Line ||
93 type == KChartParams::Area ||
94 type == KChartParams::HiLo ||
95 type == KChartParams::Polar) {
96 m_chartSubtypePage->chartSubType =
true;
98 m_chartSubtypePage->chartSubType =
false;
100 m_chartSubtypePage->changeSubTypeName( type );
101 if( ( type == KChartParams::Bar && m_chart->params()->threeDBars() )
102 || ( type == KChartParams::Pie && m_chart->params()->threeDPies() ) ) {
103 m_axespage->chart3d =
true;
105 m_axespage->chart3d =
false;
109 if ( m_chart->params()->axisVisible( KDChartAxisParams::AxisPosRight ) ) {
110 m_labelsLegendPage->ytitle2 =
true;
112 m_labelsLegendPage->ytitle2 =
false;
118bool KChartWizard::appropriate( TQWidget * w )
const
121 if ( w == m_chartSubtypePage )
122 return m_chartSubtypePage->chartSubType;
128void KChartWizard::next()
138void KChartWizard::accept()
144void KChartWizard::reject()
150void KChartWizard::setDataArea(
const TQString &dataArea )
152 m_dataFormatPage->setDataArea( dataArea );
156TQString KChartWizard::dataArea()
const
158 return m_dataFormatPage->dataArea();
162void KChartWizard::emitNeedNewData(
const char* area,
int rowcol,
163 bool firstRowIsLegend,
164 bool firstColIsLabel )
166 emit needNewData( area, rowcol, firstRowIsLegend, firstColIsLabel );
171#include "kchartWizard.moc"