]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiTabularCreate.cpp
'using namespace std' instead of 'using std::xxx'
[lyx.git] / src / frontends / qt4 / GuiTabularCreate.cpp
index bde12658bd2524b9c1bebecbacf999df4ada0900..ba167bd384ca4439c85c628e686358915af03d0c 100644 (file)
 #include <config.h>
 
 #include "GuiTabularCreate.h"
+
 #include "EmptyTable.h"
+#include "FuncRequest.h"
+
+#include "support/convert.h"
 
 #include <QCloseEvent>
 #include <QSpinBox>
 #include <QPushButton>
 
+using namespace std;
+
 namespace lyx {
 namespace frontend {
 
-/////////////////////////////////////////////////////////////////////
-//
-// GuiTabularCreateDialog
-//
-/////////////////////////////////////////////////////////////////////
-
-GuiTabularCreateDialog::GuiTabularCreateDialog(GuiTabularCreate * form)
-       : form_(form)
+GuiTabularCreate::GuiTabularCreate(GuiView & lv)
+       : GuiDialog(lv, "tabularcreate")
 {
        setupUi(this);
+       setViewTitle(_("Insert Table"));
 
        rowsSB->setValue(5);
        columnsSB->setValue(5);
 
-       connect(okPB, SIGNAL(clicked()), form_, SLOT(slotOK()));
-       connect(closePB, SIGNAL(clicked()), form_, SLOT(slotClose()));
+       connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
+       connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
 
        connect(rowsSB, SIGNAL(valueChanged(int)),
                this, SLOT(rowsChanged(int)));
        connect(columnsSB, SIGNAL(valueChanged(int)),
                this, SLOT(columnsChanged(int)));
+
+       bc().setPolicy(ButtonPolicy::IgnorantPolicy);
+       bc().setOK(okPB);
+       bc().setCancel(closePB);
 }
 
 
-void GuiTabularCreateDialog::columnsChanged(int)
+void GuiTabularCreate::columnsChanged(int)
 {
-       form_->changed();
+       changed();
 }
 
 
-void GuiTabularCreateDialog::rowsChanged(int)
+void GuiTabularCreate::rowsChanged(int)
 {
-       form_->changed();
+       changed();
 }
 
 
-/////////////////////////////////////////////////////////////////////
-//
-// GuiTabularCreate
-//
-/////////////////////////////////////////////////////////////////////
+void GuiTabularCreate::applyView()
+{
+       params_.first = rowsSB->value();
+       params_.second = columnsSB->value();
+}
 
 
-GuiTabularCreate::GuiTabularCreate(GuiDialog & parent)
-       : GuiView<GuiTabularCreateDialog>(parent, _("Insert Table"))
+bool GuiTabularCreate::initialiseParams(string const &)
 {
+       params_.first  = 5;
+       params_.second = 5;
+       return true;
 }
 
 
-void GuiTabularCreate::build_dialog()
+void GuiTabularCreate::clearParams()
 {
-       dialog_.reset(new GuiTabularCreateDialog(this));
+       params_.first  = 0;
+       params_.second = 0;
+}
+
 
-       bc().setOK(dialog_->okPB);
-       bc().setCancel(dialog_->closePB);
+void GuiTabularCreate::dispatchParams()
+{
+       string const data = convert<string>(params().first) + ' ' + convert<string>(params().second);
+       dispatch(FuncRequest(getLfun(), data));
 }
 
 
-void GuiTabularCreate::applyView()
+Dialog * createGuiTabularCreate(GuiView & lv)
 {
-       controller().params().first = dialog_->rowsSB->value();
-       controller().params().second = dialog_->columnsSB->value();
+       return new GuiTabularCreate(lv);
 }
 
+
 } // namespace frontend
 } // namespace lyx