]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QTabularCreate.cpp
* src/frontends/qt4/ui/TextLayoutUi.ui:
[lyx.git] / src / frontends / qt4 / QTabularCreate.cpp
1 /**
2  * \file QTabularCreate.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "QTabularCreate.h"
14 #include "Qt2BC.h"
15 #include "EmptyTable.h"
16
17 #include "controllers/ControlTabularCreate.h"
18
19 #include <QSpinBox>
20 #include <QPushButton>
21
22 namespace lyx {
23 namespace frontend {
24
25 /////////////////////////////////////////////////////////////////////
26 //
27 // QTabularCreateDialog
28 //
29 /////////////////////////////////////////////////////////////////////
30
31 QTabularCreateDialog::QTabularCreateDialog(QTabularCreate * form)
32         : form_(form)
33 {
34         setupUi(this);
35
36         rowsSB->setValue(5);
37         columnsSB->setValue(5);
38
39         connect(okPB, SIGNAL(clicked()),
40                 form_, SLOT(slotOK()));
41         connect(closePB, SIGNAL(clicked()),
42                 form_, SLOT(slotClose()));
43     connect(rowsSB, SIGNAL(valueChanged(int)),
44                 this, SLOT( rowsChanged(int)));
45     connect(columnsSB, SIGNAL(valueChanged(int)),
46                 this, SLOT(columnsChanged(int)));
47 }
48
49
50 void QTabularCreateDialog::columnsChanged(int)
51 {
52         form_->changed();
53 }
54
55
56 void QTabularCreateDialog::rowsChanged(int)
57 {
58         form_->changed();
59 }
60
61
62 /////////////////////////////////////////////////////////////////////
63 //
64 // QTabularCreate
65 //
66 /////////////////////////////////////////////////////////////////////
67
68 typedef QController<ControlTabularCreate, QView<QTabularCreateDialog> >
69         TabularCreateBase;
70
71
72 QTabularCreate::QTabularCreate(Dialog & parent)
73         : TabularCreateBase(parent, _("Insert Table"))
74 {
75 }
76
77
78 void QTabularCreate::build_dialog()
79 {
80         dialog_.reset(new QTabularCreateDialog(this));
81
82         bcview().setOK(dialog_->okPB);
83         bcview().setCancel(dialog_->closePB);
84 }
85
86
87 void QTabularCreate::apply()
88 {
89         controller().params().first = dialog_->rowsSB->value();
90         controller().params().second = dialog_->columnsSB->value();
91 }
92
93 } // namespace frontend
94 } // namespace lyx
95
96 #include "QTabularCreate_moc.cpp"