#include "GWt_drift.h" #include #include #include #include #include GWt_drift::GWt_drift(PspaApplication* ps,abstractElement* elem) : GWt_abstractElement(ps,elem) { string* param = element_-> getParametersString(); if ( param == NULL ) { pspa_->addConsoleMessage("GWt_Drift : empty parameter set"); } int nbparam = atoi(param[0].c_str()); if ( nbparam != element_->getNbParams() ) { pspa_->addConsoleMessage("element seems not to be a DRIFT"); } dialog_ = new WDialog("element DRIFT"); new WText("length (cm) : ",dialog_->contents()); xlengthEdit_ = new WLineEdit(param[1].c_str(), dialog_->contents()); new WBreak(dialog_->contents()); new WText("aperture (cm) : ",dialog_->contents()); apertureEdit_ = new WLineEdit(param[2].c_str(), dialog_->contents()); new WBreak(dialog_->contents()); WPushButton *submit = new WPushButton("OK",dialog_->contents()); submit->clicked().connect(dialog_, &Wt::WDialog::accept); dialog_->finished().connect(this, &GWt_drift::dialogDone); } void GWt_drift::dialogDone() { string envoi[3]; envoi[0] = string("2"); envoi[1] = xlengthEdit_->text().toUTF8(); envoi[2] = apertureEdit_->text().toUTF8(); element_->setParametersString(envoi); }