kchart

kchartWizardSetupDataPage.cpp
1/* $Id$ */
2
3#include "kchartWizardSetupDataPage.h"
4#include "kchart_view.h"
5#include "kchartWizard.h"
6
7#include <tqradiobutton.h>
8#include <tqcheckbox.h>
9#include <tqbuttongroup.h>
10#include <tqlabel.h>
11
12namespace KChart
13{
14
15KChartWizardSetupDataPage::KChartWizardSetupDataPage( TQWidget* parent,
16 KChartPart* chart) :
17 TQWidget( parent ),
18 _chart( chart ),
19 _parent( (KChartWizard*)parent )
20{
21 TQButtonGroup* tmpTQGroupBox;
22 tmpTQGroupBox = new TQButtonGroup( this, "GroupBox_1" );
23 tmpTQGroupBox->setGeometry( 260, 10, 130, 80 );
24 tmpTQGroupBox->setFrameStyle( 49 );
25 tmpTQGroupBox->setAlignment( 1 );
26
27 datarow = new TQRadioButton( this, "RadioButton_1" );
28 datarow->setGeometry( 270, 40, 100, 20 );
29 datarow->setText( i18n("Rows") );
30 connect( datarow, TQ_SIGNAL( clicked() ),
31 this, TQ_SLOT( dataInRowsClicked() ) );
32 tmpTQGroupBox->insert( datarow );
33
34 datacol = new TQRadioButton( this, "RadioButton_2" );
35 datacol->setGeometry( 270, 60, 100, 20 );
36 datacol->setText( i18n("Columns") );
37 datacol->setChecked( true );
38 connect( datarow, TQ_SIGNAL( clicked() ),
39 this, TQ_SLOT( dataInColsClicked() ) );
40 tmpTQGroupBox->insert( datacol );
41
42 TQLabel* tmpTQLabel;
43 tmpTQLabel = new TQLabel( this, "Label_3" );
44 tmpTQLabel->setGeometry( 270, 20, 100, 20 );
45 tmpTQLabel->setText( i18n("Data is in:") );
46
47 TQButtonGroup* descrBG = new TQButtonGroup( this );
48 descrBG->hide();
49 coldescript = new TQCheckBox( this, "CheckBox_3" );
50 coldescript->setGeometry( 260, 110, 20, 30 );
51 coldescript->setChecked( true );
52 connect( coldescript, TQ_SIGNAL( toggled( bool ) ),
53 this, TQ_SLOT( firstColumnIsDescriptionToggled( bool ) ) );
54 coldescript->setText( "" );
55 descrBG->insert( coldescript );
56
57 tmpTQLabel = new TQLabel( this, "Label_4" );
58 tmpTQLabel->setGeometry( 280, 110, 100, 30 );
59 tmpTQLabel->setText( i18n("Use first row as description") );
60 tmpTQLabel->setAlignment( 1313 );
61
62 rowdescript = new TQCheckBox( this, "CheckBox_4" );
63 rowdescript->setGeometry( 260, 150, 20, 30 );
64 connect( rowdescript, TQ_SIGNAL( toggled( bool ) ),
65 this, TQ_SLOT( firstRowIsDescriptionToggled( bool ) ) );
66 rowdescript->setText( "" );
67 descrBG->insert( rowdescript );
68
69 tmpTQLabel = new TQLabel( this, "Label_5" );
70 tmpTQLabel->setGeometry( 280, 150, 100, 30 );
71 tmpTQLabel->setText( i18n("Use first column as description") );
72 tmpTQLabel->setAlignment( 1313 );
73
74 TQFrame* tmpTQFrame;
75 tmpTQFrame = new TQFrame( this, "Frame_1" );
76 tmpTQFrame->setGeometry( 10, 10, 240, 220 );
77 tmpTQFrame->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
78 tmpTQFrame->setLineWidth( 2 );
79
80 /*
81 preview = new kchartWidget( _chart, tmpTQFrame );
82 preview->show();
83 _chart->addAutoUpdate( preview );
84 preview->resize( tmpTQFrame->contentsRect().width(),
85 tmpTQFrame->contentsRect().height() );
86 */
87 //parent->resize( 400, 350 );
88}
89
90
91KChartWizardSetupDataPage::~KChartWizardSetupDataPage()
92{
93 /*
94 _chart->removeAutoUpdate( preview );
95 */
96}
97
98
99void KChartWizardSetupDataPage::dataInRowsClicked()
100{
101 _parent->emitNeedNewData( (const char*)_parent->dataArea().local8Bit(), KChartWizard::Row,
102 coldescript->isChecked(),
103 rowdescript->isChecked() );
104}
105
106void KChartWizardSetupDataPage::dataInColsClicked()
107{
108 _parent->emitNeedNewData( (const char*)_parent->dataArea().local8Bit(), KChartWizard::Col,
109 coldescript->isChecked(),
110 rowdescript->isChecked() );
111}
112
113void KChartWizardSetupDataPage::firstColumnIsDescriptionToggled( bool )
114{
115 _parent->emitNeedNewData( (const char*)_parent->dataArea().local8Bit(),
116 ( datarow->isChecked() ? KChartWizard::Row :
117 KChartWizard::Col ),
118 coldescript->isChecked(),
119 rowdescript->isChecked() );
120}
121
122void KChartWizardSetupDataPage::firstRowIsDescriptionToggled( bool )
123{
124 _parent->emitNeedNewData( (const char*)_parent->dataArea().local8Bit(),
125 ( datarow->isChecked() ? KChartWizard::Row
126 : KChartWizard::Col ),
127 coldescript->isChecked(),
128 rowdescript->isChecked() );
129}
130
131} //namespace KChart
132
133#include "kchartWizardSetupDataPage.moc"