]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiFloat.cpp
rename a few view functions from foo() to fooView()
[lyx.git] / src / frontends / qt4 / GuiFloat.cpp
1 /**
2  * \file GuiFloat.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "GuiFloat.h"
14 #include "FloatPlacement.h"
15
16 #include "insets/InsetFloat.h"
17
18 #include <QCloseEvent>
19 #include <QPushButton>
20
21 namespace lyx {
22 namespace frontend {
23
24 GuiFloatDialog::GuiFloatDialog(GuiFloat * form)
25         : form_(form)
26 {
27         setupUi(this);
28         connect(restorePB, SIGNAL(clicked()),
29                 form, SLOT(slotRestore()));
30         connect(okPB, SIGNAL(clicked()),
31                 form, SLOT(slotOK()));
32         connect(applyPB, SIGNAL(clicked()),
33                 form, SLOT(slotApply()));
34         connect(closePB, SIGNAL(clicked()),
35                 form, SLOT(slotClose()));
36
37         // enable span columns checkbox
38         floatFP->useWide();
39
40         // enable sideways checkbox
41         floatFP->useSideways();
42
43         connect(floatFP, SIGNAL(changed()),
44                 this, SLOT(change_adaptor()));
45 }
46
47
48 void GuiFloatDialog::change_adaptor()
49 {
50         form_->changed();
51 }
52
53
54 void GuiFloatDialog::closeEvent(QCloseEvent * e)
55 {
56         form_->slotWMHide();
57         e->accept();
58 }
59
60
61 GuiFloat::GuiFloat(GuiDialog & parent)
62         :  GuiView<GuiFloatDialog>(parent, _("Float Settings"))
63 {
64 }
65
66
67 void GuiFloat::build_dialog()
68 {
69         dialog_.reset(new GuiFloatDialog(this));
70
71         bc().setCancel(dialog_->closePB);
72         bc().setApply(dialog_->applyPB);
73         bc().setOK(dialog_->okPB);
74         bc().setRestore(dialog_->restorePB);
75
76         bc().addReadOnly(dialog_->floatFP);
77 }
78
79
80 void GuiFloat::update_contents()
81 {
82         dialog_->floatFP->set(controller().params());
83 }
84
85
86 void GuiFloat::applyView()
87 {
88         InsetFloatParams & params = controller().params();
89
90         params.placement = dialog_->floatFP->get(params.wide, params.sideways);
91 }
92
93 } // namespace frontend
94 } // namespace lyx
95
96 #include "GuiFloat_moc.cpp"