3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
15 #include "FuncRequest.h"
16 #include "qt_helpers.h"
18 #include "support/debug.h"
19 #include "insets/InsetCommand.h"
22 #include <QPushButton>
30 /////////////////////////////////////////////////////////////////
34 /////////////////////////////////////////////////////////////////
36 GuiLabel::GuiLabel(GuiView & lv)
37 : GuiDialog(lv, "label", qt_("Label")),
38 params_(insetCode("label"))
42 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
43 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
44 connect(keywordED, SIGNAL(textChanged(const QString &)),
45 this, SLOT(change_adaptor()));
47 setFocusProxy(keywordED);
49 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
51 bc().setCancel(closePB);
52 bc().addReadOnly(keywordED);
56 void GuiLabel::change_adaptor()
62 void GuiLabel::reject()
68 void GuiLabel::updateContents()
70 docstring const contents = params_["name"];
71 keywordED->setText(toqstr(contents));
72 bc().setValid(!contents.empty());
76 void GuiLabel::applyView()
78 params_["name"] = qstring_to_ucs4(keywordED->text());
82 bool GuiLabel::isValid()
84 return !keywordED->text().isEmpty();
88 bool GuiLabel::initialiseParams(std::string const & data)
90 InsetCommand::string2params("label", data, params_);
95 void GuiLabel::dispatchParams()
97 std::string const lfun = InsetCommand::params2string("label", params_);
98 dispatch(FuncRequest(getLfun(), lfun));
102 Dialog * createGuiLabel(GuiView & lv) { return new GuiLabel(lv); }
105 } // namespace frontend
108 #include "GuiLabel_moc.cpp"