]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiFloat.cpp
less functions
[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
15 #include "ControlFloat.h"
16 #include "FloatPlacement.h"
17
18 #include "insets/InsetFloat.h"
19
20 #include <QCloseEvent>
21 #include <QPushButton>
22
23
24 namespace lyx {
25 namespace frontend {
26
27 GuiFloatDialog::GuiFloatDialog(LyXView & lv)
28         : GuiDialog(lv, "float")
29 {
30         setController(new ControlFloat(*this));
31         setViewTitle(_("Float Settings"));
32
33         setupUi(this);
34         connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
35         connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
36         connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
37         connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
38
39         // enable span columns checkbox
40         floatFP->useWide();
41         // enable sideways checkbox
42         floatFP->useSideways();
43
44         connect(floatFP, SIGNAL(changed()), this, SLOT(change_adaptor()));
45
46         bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
47
48         bc().setCancel(closePB);
49         bc().setApply(applyPB);
50         bc().setOK(okPB);
51         bc().setRestore(restorePB);
52
53         bc().addReadOnly(floatFP);
54 }
55
56
57 ControlFloat & GuiFloatDialog::controller() const
58 {
59         return static_cast<ControlFloat &>(GuiDialog::controller());
60 }
61
62
63 void GuiFloatDialog::change_adaptor()
64 {
65         changed();
66 }
67
68
69 void GuiFloatDialog::closeEvent(QCloseEvent * e)
70 {
71         slotClose();
72         e->accept();
73 }
74
75
76 void GuiFloatDialog::update_contents()
77 {
78         floatFP->set(controller().params());
79 }
80
81
82 void GuiFloatDialog::applyView()
83 {
84         InsetFloatParams & params = controller().params();
85         params.placement = floatFP->get(params.wide, params.sideways);
86 }
87
88 } // namespace frontend
89 } // namespace lyx
90
91 #include "GuiFloat_moc.cpp"