]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiTabularCreate.cpp
Merge QController into individual dialogs. Also various cleanup
[lyx.git] / src / frontends / qt4 / GuiTabularCreate.cpp
1 /**
2  * \file GuiTabularCreate.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 "GuiTabularCreate.h"
14 #include "Qt2BC.h"
15 #include "EmptyTable.h"
16
17 #include <QCloseEvent>
18 #include <QSpinBox>
19 #include <QPushButton>
20
21 namespace lyx {
22 namespace frontend {
23
24 /////////////////////////////////////////////////////////////////////
25 //
26 // GuiTabularCreateDialog
27 //
28 /////////////////////////////////////////////////////////////////////
29
30 GuiTabularCreateDialog::GuiTabularCreateDialog(GuiTabularCreate * form)
31         : form_(form)
32 {
33         setupUi(this);
34
35         rowsSB->setValue(5);
36         columnsSB->setValue(5);
37
38         connect(okPB, SIGNAL(clicked()), form_, SLOT(slotOK()));
39         connect(closePB, SIGNAL(clicked()), form_, SLOT(slotClose()));
40
41         connect(rowsSB, SIGNAL(valueChanged(int)),
42                 this, SLOT(rowsChanged(int)));
43         connect(columnsSB, SIGNAL(valueChanged(int)),
44                 this, SLOT(columnsChanged(int)));
45 }
46
47
48 void GuiTabularCreateDialog::columnsChanged(int)
49 {
50         form_->changed();
51 }
52
53
54 void GuiTabularCreateDialog::rowsChanged(int)
55 {
56         form_->changed();
57 }
58
59
60 /////////////////////////////////////////////////////////////////////
61 //
62 // GuiTabularCreate
63 //
64 /////////////////////////////////////////////////////////////////////
65
66
67 GuiTabularCreate::GuiTabularCreate(Dialog & parent)
68         : GuiView<GuiTabularCreateDialog>(parent, _("Insert Table"))
69 {
70 }
71
72
73 void GuiTabularCreate::build_dialog()
74 {
75         dialog_.reset(new GuiTabularCreateDialog(this));
76
77         bcview().setOK(dialog_->okPB);
78         bcview().setCancel(dialog_->closePB);
79 }
80
81
82 void GuiTabularCreate::apply()
83 {
84         controller().params().first = dialog_->rowsSB->value();
85         controller().params().second = dialog_->columnsSB->value();
86 }
87
88 } // namespace frontend
89 } // namespace lyx
90
91 #include "GuiTabularCreate_moc.cpp"