You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
121 lines
4.1 KiB
121 lines
4.1 KiB
15 years ago
|
/* This file is part of the KDE project
|
||
|
Copyright (C) 2002 Montel Laurent <lmontel@mandrakesoft.com>
|
||
|
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 "kchartPageLayout.h"
|
||
|
#include "kchartPageLayout.moc"
|
||
|
#include "kchart_params.h"
|
||
|
#include <knumvalidator.h>
|
||
14 years ago
|
#include <tqlineedit.h>
|
||
13 years ago
|
#include <tqlayout.h>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
14 years ago
|
#include <tqlabel.h>
|
||
|
#include <tqgroupbox.h>
|
||
15 years ago
|
|
||
|
namespace KChart
|
||
|
{
|
||
|
|
||
13 years ago
|
KChartPageLayout::KChartPageLayout( KChartParams* _params, TQWidget* parent, const char* name )
|
||
|
: KDialogBase( parent, name, TRUE,i18n("Page Layout"),KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::User1 | KDialogBase::Apply , KDialogBase::Ok,true )
|
||
15 years ago
|
{
|
||
|
params=_params;
|
||
|
#if 0
|
||
14 years ago
|
TQWidget *page = new TQWidget( this );
|
||
15 years ago
|
#else
|
||
14 years ago
|
TQGroupBox* page = new TQGroupBox( 2, Qt::Horizontal, i18n("Margins"),
|
||
15 years ago
|
this );
|
||
|
#endif
|
||
|
setMainWidget(page);
|
||
|
|
||
|
// FIXME: The following code is strange, since it is written to
|
||
13 years ago
|
// use a grid layout with a standard TQWidget. However, with the
|
||
14 years ago
|
// TQGroupBox, it looks better, and since it actually works, there
|
||
15 years ago
|
// is no immediate need for rewriting. In the sake of clarity, it
|
||
13 years ago
|
// should be done though, and we should use the layout
|
||
15 years ago
|
// capabilities of the groupbox instead..
|
||
|
|
||
|
setButtonText( KDialogBase::User1, i18n("&Reset") );
|
||
|
|
||
14 years ago
|
TQGridLayout *grid = new TQGridLayout(page, 4, 2, KDialog::marginHint(), KDialog::spacingHint());
|
||
15 years ago
|
|
||
14 years ago
|
TQLabel *lab=new TQLabel(i18n("Left:"),page);
|
||
15 years ago
|
grid->addWidget(lab,0,0);
|
||
|
|
||
14 years ago
|
leftBorder=new TQLineEdit(page);
|
||
15 years ago
|
leftBorder->setValidator( new KIntValidator( 0,9999,leftBorder ) );
|
||
|
grid->addWidget(leftBorder,1,0);
|
||
|
|
||
14 years ago
|
lab=new TQLabel(i18n("Right:"),page);
|
||
15 years ago
|
grid->addWidget(lab,0,1);
|
||
|
|
||
14 years ago
|
rightBorder=new TQLineEdit(page);
|
||
15 years ago
|
rightBorder->setValidator( new KIntValidator( 0,9999,rightBorder ) );
|
||
|
grid->addWidget(rightBorder,1,1);
|
||
|
|
||
14 years ago
|
lab=new TQLabel(i18n("Top:"),page);
|
||
15 years ago
|
grid->addWidget(lab,2,0);
|
||
|
|
||
14 years ago
|
topBorder=new TQLineEdit(page);
|
||
15 years ago
|
topBorder->setValidator( new KIntValidator( 0,9999,topBorder ) );
|
||
|
grid->addWidget(topBorder,3,0);
|
||
|
|
||
14 years ago
|
lab=new TQLabel(i18n("Bottom:"),page);
|
||
15 years ago
|
grid->addWidget(lab,2,1);
|
||
|
|
||
14 years ago
|
bottomBorder=new TQLineEdit(page);
|
||
15 years ago
|
bottomBorder->setValidator( new KIntValidator( 0,9999,bottomBorder ) );
|
||
|
grid->addWidget(bottomBorder,3,1);
|
||
|
|
||
|
init();
|
||
14 years ago
|
connect( this, TQT_SIGNAL( okClicked() ), this, TQT_SLOT( slotOk() ) );
|
||
|
connect( this, TQT_SIGNAL( applyClicked() ), this, TQT_SLOT( slotApply() ) );
|
||
|
connect( this, TQT_SIGNAL( user1Clicked() ), this ,TQT_SLOT( slotReset() ));
|
||
15 years ago
|
|
||
|
}
|
||
|
|
||
|
void KChartPageLayout::init()
|
||
|
{
|
||
|
oldGlobalLeadingRight = params->globalLeadingRight();
|
||
|
oldGlobalLeadingLeft = params->globalLeadingLeft();
|
||
|
oldGlobalLeadingTop = params->globalLeadingTop();
|
||
|
oldGlobalLeadingBottom = params->globalLeadingBottom();
|
||
|
slotReset();
|
||
|
}
|
||
|
|
||
|
void KChartPageLayout::slotOk()
|
||
|
{
|
||
|
slotApply();
|
||
|
accept();
|
||
|
}
|
||
|
|
||
|
void KChartPageLayout::slotApply()
|
||
|
{
|
||
|
params->setGlobalLeading( leftBorder->text().toInt(),topBorder->text().toInt() , rightBorder->text().toInt(), bottomBorder->text().toInt() );
|
||
|
emit dataChanged();
|
||
|
}
|
||
|
|
||
|
void KChartPageLayout::slotReset()
|
||
|
{
|
||
14 years ago
|
rightBorder->setText(TQString::number(oldGlobalLeadingRight));
|
||
|
leftBorder->setText(TQString::number(oldGlobalLeadingLeft));
|
||
|
topBorder->setText(TQString::number(oldGlobalLeadingTop));
|
||
|
bottomBorder->setText(TQString::number(oldGlobalLeadingBottom));
|
||
15 years ago
|
}
|
||
|
|
||
|
} //KChart namespace
|