]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiFloat.cpp
Factorize out the way window titles are handled.
[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 "FloatPlacement.h"
16 #include "FuncRequest.h"
17
18 #include "insets/InsetFloat.h"
19
20 #include <QCloseEvent>
21 #include <QPushButton>
22
23 using namespace std;
24
25 namespace lyx {
26 namespace frontend {
27
28 GuiFloat::GuiFloat(GuiView & lv)
29         : GuiDialog(lv, "float", qt_("Float Settings"))
30 {
31         setupUi(this);
32         
33         connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
34         connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
35         connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
36         connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
37
38         // enable span columns checkbox
39         floatFP->useWide();
40         // enable sideways checkbox
41         floatFP->useSideways();
42
43         connect(floatFP, SIGNAL(changed()), this, SLOT(change_adaptor()));
44
45         bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
46
47         bc().setCancel(closePB);
48         bc().setApply(applyPB);
49         bc().setOK(okPB);
50         bc().setRestore(restorePB);
51
52         bc().addReadOnly(floatFP);
53 }
54
55
56 void GuiFloat::change_adaptor()
57 {
58         changed();
59 }
60
61
62 void GuiFloat::closeEvent(QCloseEvent * e)
63 {
64         slotClose();
65         e->accept();
66 }
67
68
69 void GuiFloat::updateContents()
70 {
71         floatFP->set(params_);
72 }
73
74
75 void GuiFloat::applyView()
76 {
77         params_.placement = floatFP->get(params_.wide, params_.sideways);
78 }
79
80
81 bool GuiFloat::initialiseParams(string const & data)
82 {
83         InsetFloatMailer::string2params(data, params_);
84         return true;
85 }
86
87
88 void GuiFloat::clearParams()
89 {
90         params_ = InsetFloatParams();
91 }
92
93
94 void GuiFloat::dispatchParams()
95 {
96         dispatch(FuncRequest(getLfun(), InsetFloatMailer::params2string(params_)));
97 }
98
99
100 Dialog * createGuiFloat(GuiView & lv) { return new GuiFloat(lv); }
101
102
103 } // namespace frontend
104 } // namespace lyx
105
106 #include "GuiFloat_moc.cpp"