F:/KPlato/koffice/libs/kofficeui/KoPageLayoutColumns.cpp

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002  * Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
00003  * Copyright (C) 2005 Thomas Zander <zander@kde.org>
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; version 2.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this library; see the file COPYING.LIB.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #include <KoPageLayoutColumns.h>
00021 #include <KoPageLayoutDia.h>
00022 #include <KoUnit.h>
00023 #include <KoUnitWidgets.h>
00024 
00025 #include <QLabel>
00026 #include <QLayout>
00027 #include <QHBoxLayout>
00028 
00029 KoPageLayoutColumns::KoPageLayoutColumns(QWidget *parent, const KoColumns& columns, KoUnit::Unit unit, const KoPageLayout& layout)
00030     : QWidget(parent) {
00031     setupUi(this);
00032     m_columns = columns;
00033     QHBoxLayout *lay = new QHBoxLayout(previewPane);
00034     m_preview = new KoPagePreview( previewPane, "Preview", layout );
00035     lay->addWidget(m_preview);
00036     lay = new QHBoxLayout(columnSpacingPane);
00037     m_spacing = new KoUnitDoubleSpinBox( columnSpacingPane );
00038     m_spacing->setValue(  m_columns.ptColumnSpacing );
00039     m_spacing->setUnit( unit );
00040     double dStep = KoUnit::fromUserValue( 0.2, unit );
00041     m_spacing->setMinMaxStep( 0, layout.ptWidth/2, dStep );
00042     lay->addWidget(m_spacing);
00043     labelSpacing->setBuddy( m_spacing );
00044     nColumns->setValue( m_columns.columns );
00045     m_preview->setPageColumns( m_columns );
00046 
00047     connect( nColumns, SIGNAL( valueChanged( int ) ), this, SLOT( nColChanged( int ) ) );
00048     connect( m_spacing, SIGNAL( valueChangedPt(double) ), this, SLOT( nSpaceChanged( double ) ) );
00049 }
00050 
00051 void KoPageLayoutColumns::setEnableColumns(bool on) {
00052     nColumns->setEnabled(on);
00053     m_spacing->setEnabled(on);
00054     nColChanged(on ? nColumns->value(): 1 );
00055 }
00056 
00057 void KoPageLayoutColumns::nColChanged( int columns ) {
00058     m_columns.columns = columns;
00059     m_preview->setPageColumns( m_columns );
00060     emit propertyChange(m_columns);
00061 }
00062 
00063 void KoPageLayoutColumns::nSpaceChanged( double spacing ) {
00064     m_columns.ptColumnSpacing = spacing;
00065     emit propertyChange(m_columns);
00066 }
00067 
00068 void KoPageLayoutColumns::setLayout(KoPageLayout &layout) {
00069     m_preview->setPageLayout( layout );
00070 }
00071 
00072 #include <KoPageLayoutColumns.moc>

Généré le Wed Nov 22 23:41:05 2006 pour KPlato par  doxygen 1.5.1-p1