]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiLabel.cpp
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / GuiLabel.cpp
index d49bb745859d1d19acd3ff7345b74fa213d16c2c..8c46909f9eeed3640c0d2a7df4cbd6e989ba68a5 100644 (file)
 
 #include "GuiLabel.h"
 
-#include "support/debug.h"
+#include "FuncRequest.h"
 #include "qt_helpers.h"
 
+#include "support/debug.h"
+#include "insets/InsetCommand.h"
+
 #include <QLabel>
 #include <QPushButton>
 #include <QLineEdit>
-#include <QCloseEvent>
 
 using namespace std;
 
@@ -27,12 +29,13 @@ namespace frontend {
 
 /////////////////////////////////////////////////////////////////
 //
-// Base implementation
+// GuiLabel
 //
 /////////////////////////////////////////////////////////////////
 
 GuiLabel::GuiLabel(GuiView & lv)
-       : GuiCommand(lv, "label", qt_("Label"))
+       : GuiDialog(lv, "label", qt_("Label")),
+         params_(insetCode("label"))
 {
        setupUi(this);
 
@@ -62,13 +65,6 @@ void GuiLabel::reject()
 }
 
 
-void GuiLabel::closeEvent(QCloseEvent * e)
-{
-       slotClose();
-       e->accept();
-}
-
-
 void GuiLabel::updateContents()
 {
        docstring const contents = params_["name"];
@@ -83,16 +79,37 @@ void GuiLabel::applyView()
 }
 
 
+
+void GuiLabel::enableView(bool enable)
+{
+       keywordED->setEnabled(enable);
+}
+
+
 bool GuiLabel::isValid()
 {
        return !keywordED->text().isEmpty();
 }
 
 
+bool GuiLabel::initialiseParams(std::string const & data)
+{
+       InsetCommand::string2params("label", data, params_);
+       return true;
+}
+
+
+void GuiLabel::dispatchParams()
+{
+       std::string const lfun = InsetCommand::params2string("label", params_);
+       dispatch(FuncRequest(getLfun(), lfun));
+}
+
+
 Dialog * createGuiLabel(GuiView & lv) { return new GuiLabel(lv); }
 
 
 } // namespace frontend
 } // namespace lyx
 
-#include "GuiLabel_moc.cpp"
+#include "moc_GuiLabel.cpp"