lib Library API Documentation

MatrixDialog.cc

00001 /* This file is part of the KDE libraries
00002     Copyright (C) 1999 Ilya Baran (ibaran@mit.edu)
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
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., 59 Temple Place - Suite 330,
00017     Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #include "MatrixDialog.h"
00021 #include <qpushbutton.h>
00022 #include <qspinbox.h>
00023 #include <qlabel.h>
00024 #include <qcheckbox.h>
00025 #include <qlayout.h>
00026 #include <klocale.h>
00027 
00028 KFORMULA_NAMESPACE_BEGIN
00029 
00030 const int DEFAULT_SIZE = 3;
00031 const int MAX_SIZE = 200;
00032 
00033 MatrixDialog::MatrixDialog( QWidget *parent, int _width, int _height )
00034         : KDialogBase(parent, "Matrix Dialog", true,i18n("Add Matrix"),Ok|Cancel)
00035 {
00036     w = _width;
00037     h = _height;
00038 
00039     QLabel *rows, *columns;
00040     QWidget *page = new QWidget( this );
00041     setMainWidget(page);
00042     QGridLayout *grid = new QGridLayout(page, 4, 2, 10);
00043 
00044     rows = new QLabel(i18n("Rows:"), page);
00045     columns = new QLabel(i18n("Columns:"), page);
00046 
00047     grid->addWidget(rows, 0, 0);
00048     grid->addWidget(columns, 0, 1);
00049 
00050     QSpinBox *width, *height;
00051 
00052     height = new QSpinBox(1, MAX_SIZE, 1, page);
00053     grid->addWidget(height, 1, 0);
00054     height->setValue(h);
00055     connect(height, SIGNAL(valueChanged(int)), SLOT(setHeight(int)));
00056 
00057     width = new QSpinBox(1, MAX_SIZE, 1, page);
00058     grid->addWidget(width, 1, 1);
00059     width->setValue(w);
00060     connect(width, SIGNAL(valueChanged(int)), SLOT(setWidth(int)));
00061     height->setFocus();
00062 }
00063 
00064 void MatrixDialog::setHeight(int value)
00065 {
00066     h = value;
00067 }
00068 
00069 void MatrixDialog::setWidth(int value)
00070 {
00071     w = value;
00072 }
00073 
00074 KFORMULA_NAMESPACE_END
00075 
00076 using namespace KFormula;
00077 #include "MatrixDialog.moc"
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Mar 11 11:47:45 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003