MatrixDialog.cpp
1/* This file is part of the KDE libraries
2 Copyright (C) 1999 Ilya Baran (ibaran@mit.edu)
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include "MatrixDialog.h"
21#include <tqpushbutton.h>
22#include <tqspinbox.h>
23#include <tqlabel.h>
24#include <tqcheckbox.h>
25#include <tqlayout.h>
26#include <tdelocale.h>
27
28KFORMULA_NAMESPACE_BEGIN
29
30const int DEFAULT_SIZE = 3;
31const int MAX_SIZE = 200;
32
33MatrixDialog::MatrixDialog( TQWidget *parent, int _width, int _height )
34 : KDialogBase(parent, "Matrix Dialog", true,i18n("Add Matrix"),Ok|Cancel)
35{
36 w = _width;
37 h = _height;
38
39 TQLabel *rows, *columns;
40 TQWidget *page = new TQWidget( this );
41 setMainWidget(page);
42 TQGridLayout *grid = new TQGridLayout(page, 4, 2, 10);
43
44 rows = new TQLabel(i18n("Rows:"), page);
45 columns = new TQLabel(i18n("Columns:"), page);
46
47 grid->addWidget(rows, 0, 0);
48 grid->addWidget(columns, 0, 1);
49
50 TQSpinBox *width, *height;
51
52 height = new TQSpinBox(1, MAX_SIZE, 1, page);
53 grid->addWidget(height, 1, 0);
54 height->setValue(h);
55 connect(height, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(setHeight(int)));
56
57 width = new TQSpinBox(1, MAX_SIZE, 1, page);
58 grid->addWidget(width, 1, 1);
59 width->setValue(w);
60 connect(width, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(setWidth(int)));
61 height->setFocus();
62}
63
64void MatrixDialog::setHeight(int value)
65{
66 h = value;
67}
68
69void MatrixDialog::setWidth(int value)
70{
71 w = value;
72}
73
74KFORMULA_NAMESPACE_END
75
76using namespace KFormula;
77#include "MatrixDialog.moc"