1#include "kchartWizardLabelsLegendPage.h"
2#include "kchart_view.h"
3#include "kchart_part.h"
5#include <tqbuttongroup.h>
7#include <tqradiobutton.h>
10#include <tdefontdialog.h>
12#include <tqpushbutton.h>
15#include "kchart_params.h"
20KChartWizardLabelsLegendPage::KChartWizardLabelsLegendPage( TQWidget* parent, KChartPart* chart ) :
29 leftparams = _chart->params()->axisParams( KDChartAxisParams::AxisPosLeft );
31 bottomparams = _chart->params()->axisParams( KDChartAxisParams::AxisPosBottom );
37 TQGridLayout *grid1 =
new TQGridLayout(
this,2,2,KDialog::marginHint(), KDialog::spacingHint());
39 TQGroupBox* tmpTQGroupBox;
40 tmpTQGroupBox =
new TQGroupBox(
this,
"GroupBox_1" );
41 tmpTQGroupBox->setFrameStyle( 49 );
43 TQGridLayout *grid2 =
new TQGridLayout(tmpTQGroupBox,4,4,KDialog::marginHint(), KDialog::spacingHint());
45 TQLabel* titleLA =
new TQLabel( i18n(
"Title:" ),tmpTQGroupBox );
46 grid2->addWidget(titleLA,0,0);
48 _titleED =
new TQLineEdit( tmpTQGroupBox );
49 grid2->addWidget(_titleED,0,1);
50 _titleED->setText( _chart->params()->header1Text() );
52 titlefont =
new TQPushButton( tmpTQGroupBox );
53 grid2->addWidget(titlefont,0,2);
54 titlefont->setText(i18n(
"Font..."));
56 titlecolor=
new KColorButton(tmpTQGroupBox);
57 grid2->addWidget(titlecolor,0,3);
58 title_color=_chart->params()->headerFooterColor( KDChartParams::HdFtPosHeader );
59 titlecolor->setColor( title_color );
62 TQLabel* xlabelLA =
new TQLabel( i18n(
"X-title:" ), tmpTQGroupBox );
64 grid2->addWidget(xlabelLA,1,0);
66 _xlabelED =
new TQLineEdit( tmpTQGroupBox );
68 _xlabelED->setText(_chart->params()->axisTitle( KDChartAxisParams::AxisPosBottom));
69 grid2->addWidget(_xlabelED,1,1);
71 xtitlefont =
new TQPushButton( tmpTQGroupBox );
72 xtitlefont->setText(i18n(
"Font..."));
74 grid2->addWidget(xtitlefont,1,2);
76 xtitlecolor=
new KColorButton(tmpTQGroupBox);
79 xtitlecolor->setColor( x_color );
81 grid2->addWidget(xtitlecolor,1,3);
84 TQLabel* ylabelLA =
new TQLabel( i18n(
"Y-title:" ), tmpTQGroupBox );
86 grid2->addWidget(ylabelLA,2,0);
88 _ylabelED =
new TQLineEdit( tmpTQGroupBox );
90 _ylabelED->setText(_chart->params()->axisTitle( KDChartAxisParams::AxisPosLeft));
91 grid2->addWidget(_ylabelED,2,1);
94 ytitlefont =
new TQPushButton( tmpTQGroupBox);
95 ytitlefont->setText(i18n(
"Font..."));
97 grid2->addWidget(ytitlefont,2,2);
99 ytitlecolor=
new KColorButton(tmpTQGroupBox);
103 ytitlecolor->setColor( y_color );
104 grid2->addWidget(ytitlecolor,2,3);
108 TQLabel* ylabelLA2 =
new TQLabel( i18n(
"Y-title 2:" ), tmpTQGroupBox );
109 ylabelLA2->setEnabled(
false);
110 grid2->addWidget(ylabelLA2,3,0);
112 _ylabel2ED =
new TQLineEdit( tmpTQGroupBox );
113 _ylabel2ED->setEnabled(
false);
116 grid2->addWidget(_ylabel2ED,3,1);
118 ytitle2font =
new TQPushButton( tmpTQGroupBox);
119 ytitle2font->setText(i18n(
"Font..."));
120 ytitle2font->setEnabled(
false);
121 grid2->addWidget(ytitle2font,3,2);
123 ytitle2color=
new KColorButton(tmpTQGroupBox);
124 ytitle2color->setEnabled(
false);
127 ytitle2color->setColor( y_color2 );
128 grid2->addWidget(ytitle2color,3,3);
136 TQLabel* lab =
new TQLabel( i18n(
"Legend title:" ), tmpTQGroupBox );
137 grid2->addWidget(lab,3,0);
139 _legendTitleText =
new TQLineEdit( tmpTQGroupBox );
140 grid2->addWidget(_legendTitleText,3,1);
141 _legendTitleText->setText( _chart->params()->legendTitleText() );
144 legendTitleFont =
new TQPushButton( tmpTQGroupBox );
145 legendTitleFont->setText(i18n(
"Font..."));
146 _legendTitleFont=_chart->params()->legendTitleFont();
147 grid2->addWidget(legendTitleFont,3,2);
149 legendTitleColor=
new KColorButton(tmpTQGroupBox);
150 _legendTitleColor=_chart->params()->legendTitleTextColor();
151 legendTitleColor->setColor( _legendTitleColor );
152 grid2->addWidget(legendTitleColor,3,3);
155 lab =
new TQLabel( i18n(
"Legend text:" ), tmpTQGroupBox );
156 grid2->addWidget(lab,4,0);
158 legendTextFont =
new TQPushButton( tmpTQGroupBox );
159 _legendTextFont=_chart->params()->legendFont();
160 legendTextFont->setText(i18n(
"Font..."));
161 grid2->addWidget(legendTextFont,4,2);
163 legendTextColor=
new KColorButton(tmpTQGroupBox);
164 _legendTextColor=_chart->params()->legendTextColor();
165 legendTextColor->setColor( _legendTextColor );
166 grid2->addWidget(legendTextColor,4,3);
168 title=_chart->params()->header1Font();
169 grid1->addWidget(tmpTQGroupBox,0,0);
171 connect(xtitlefont,TQ_SIGNAL(clicked()),
this,TQ_SLOT(changeXLabelFont()));
172 connect(ytitlefont,TQ_SIGNAL(clicked()),
this,TQ_SLOT(changeYLabelFont()));
174 connect(ytitle2font,TQ_SIGNAL(clicked()),
this,TQ_SLOT(changeY2LabelFont()));
176 connect(titlefont,TQ_SIGNAL(clicked()),
this,TQ_SLOT(changeTitleFont()));
177 connect(legendTitleFont,TQ_SIGNAL(clicked()),
this,TQ_SLOT(changeLegendTitleFont()));
179 connect(legendTextFont,TQ_SIGNAL(clicked()),
this,TQ_SLOT(changeLegendTextFont()));
181 connect(xtitlecolor,TQ_SIGNAL(changed(
const TQColor & )),
182 this,TQ_SLOT(changeXLabelColor(
const TQColor &)));
183 connect(ytitlecolor,TQ_SIGNAL(changed(
const TQColor & )),
184 this,TQ_SLOT(changeYLabelColor(
const TQColor &)));
185 connect(titlecolor,TQ_SIGNAL(changed(
const TQColor & )),
186 this,TQ_SLOT(changeTitleColor(
const TQColor &)));
188 connect(ytitle2color,TQ_SIGNAL(changed(
const TQColor & )),
189 this,TQ_SLOT(changeYTitle2Color(
const TQColor &)));
191 connect(legendTitleColor,TQ_SIGNAL(changed(
const TQColor & )),
192 this,TQ_SLOT(changeLegendTitleColor(
const TQColor &)));
194 connect(legendTextColor,TQ_SIGNAL(changed(
const TQColor & )),
195 this,TQ_SLOT(changeLegendTextColor(
const TQColor &)));
200KChartWizardLabelsLegendPage::~KChartWizardLabelsLegendPage()
205void KChartWizardLabelsLegendPage::changeLegendTextFont()
207 if (TDEFontDialog::getFont( _legendTextFont,
false,
this ) == TQDialog::Rejected )
211void KChartWizardLabelsLegendPage::changeLegendTitleFont()
213 if (TDEFontDialog::getFont( _legendTitleFont,
false,
this ) == TQDialog::Rejected )
217void KChartWizardLabelsLegendPage::changeXLabelFont()
219 if (TDEFontDialog::getFont( xlabel,
false,
this ) == TQDialog::Rejected )
223void KChartWizardLabelsLegendPage::changeYLabelFont()
225 if (TDEFontDialog::getFont( ylabel ,
false,
this ) == TQDialog::Rejected )
230void KChartWizardLabelsLegendPage::changeY2LabelFont()
232 if (TDEFontDialog::getFont( ylabel2,
false,
this ) == TQDialog::Rejected )
237void KChartWizardLabelsLegendPage::changeTitleFont()
239 if (TDEFontDialog::getFont( title ,
false,
this ) == TQDialog::Rejected )
244void KChartWizardLabelsLegendPage::changeLegendTextColor(
const TQColor &_color)
246 _legendTextColor=_color;
249void KChartWizardLabelsLegendPage::changeXLabelColor(
const TQColor &_color)
254void KChartWizardLabelsLegendPage::changeYLabelColor(
const TQColor &_color)
259void KChartWizardLabelsLegendPage::changeTitleColor(
const TQColor &_color)
265void KChartWizardLabelsLegendPage::changeYTitle2Color(
const TQColor &_color)
271void KChartWizardLabelsLegendPage::changeLegendTitleColor(
const TQColor &_color)
273 _legendTitleColor=_color;
276void KChartWizardLabelsLegendPage::paintEvent( TQPaintEvent * )
280 _ylabel2ED->setEnabled(
true);
281 ytitle2color->setEnabled(
true);
284 _ylabel2ED->setEnabled(
false);
285 ytitle2color->setEnabled(
false);
290void KChartWizardLabelsLegendPage::apply( )
292 _chart->params()->setHeader1Text( _titleED->text() );
304 _chart->params()->setHeaderFooterColor( KDChartParams::HdFtPosHeader, title_color );
305 _chart->params()->setHeaderFooterFont( KDChartParams::HdFtPosHeader, title,
true, title.pointSize()*4 );
306 _chart->params()->setAxisTitle( KDChartAxisParams::AxisPosBottom, _xlabelED->text() );
307 _chart->params()->setAxisTitle( KDChartAxisParams::AxisPosLeft, _ylabelED->text() );
309 _chart->params()->setLegendTitleText(_legendTitleText->text());
310 _chart->params()->setLegendTitleTextColor(_legendTitleColor);
311 _chart->params()->setLegendTitleFont( _legendTitleFont,
false);
312 _chart->params()->setLegendTitleFontRelSize( _legendTitleFont.pointSize()*4 );
313 _chart->params()->setLegendTextColor(_legendTextColor);
314 _chart->params()->setLegendFont( _legendTextFont,
false);
315 _chart->params()->setLegendFontRelSize( _legendTextFont.pointSize()*4 );
318 leftparams = _chart->params()->axisParams( KDChartAxisParams::AxisPosLeft );
320 bottomparams = _chart->params()->axisParams( KDChartAxisParams::AxisPosBottom );
321 if( x_color.isValid() )
323 if( y_color.isValid() )
334 _chart->params()->setAxisParams( KDChartAxisParams::AxisPosBottom, bottomparams );
335 _chart->params()->setAxisParams( KDChartAxisParams::AxisPosLeft, leftparams );
340#include "kchartWizardLabelsLegendPage.moc"
access the chart axis parameters.
void setAxisLineColor(TQColor axisLineColor)
Specifies the axis line colour.
void setAxisLabelsFont(TQFont axisLabelsFont, bool useFontSize)
Specifies the axis labels font.
TQFont axisLabelsFont() const
Returns the axis labels font.
void setAxisLabelsFontRelSize(int axisLabelsFontRelSize)
Specifies the axis labels relative font size.
TQColor axisLineColor() const
Returns the axis line colour.