1 | |
---|
2 | #include "GWt_drift.h" |
---|
3 | #include "mixedTools.h" |
---|
4 | |
---|
5 | #include <Wt/WText> |
---|
6 | #include <Wt/WLineEdit> |
---|
7 | #include <Wt/WBreak> |
---|
8 | #include <Wt/WDialog> |
---|
9 | #include <Wt/WPushButton> |
---|
10 | |
---|
11 | GWt_drift::GWt_drift(abstractElement* elem) : GWt_abstractElement(elem) |
---|
12 | { |
---|
13 | |
---|
14 | string* param = beginDialog(); |
---|
15 | |
---|
16 | new WText("length (cm) : ",dialog_->contents()); |
---|
17 | xlengthEdit_ = new WLineEdit(param->c_str(), dialog_->contents()); |
---|
18 | new WBreak(dialog_->contents()); |
---|
19 | new WText("aperture (cm) : ",dialog_->contents()); |
---|
20 | apertureEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents()); |
---|
21 | new WBreak(dialog_->contents()); |
---|
22 | WPushButton *submit = new WPushButton("OK",dialog_->contents()); |
---|
23 | submit->clicked().connect(dialog_, &Wt::WDialog::accept); |
---|
24 | dialog_->finished().connect(this, &GWt_drift::dialogDone); |
---|
25 | } |
---|
26 | |
---|
27 | void GWt_drift::dialogDone() |
---|
28 | { |
---|
29 | unsigned nbParam = element_->getNbParams(); |
---|
30 | string* envoi = new string[nbParam+1]; |
---|
31 | int compteur = -1; |
---|
32 | envoi[++compteur] = mixedTools::intToString(nbParam); |
---|
33 | envoi[++compteur] = labelEdit_->text().toUTF8(); |
---|
34 | envoi[++compteur] = xlengthEdit_->text().toUTF8(); |
---|
35 | envoi[++compteur] = apertureEdit_->text().toUTF8(); |
---|
36 | if ( compteur != (int)nbParam ) { |
---|
37 | cerr << " GWt_drift::dialogDone() pb nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl; |
---|
38 | return; |
---|
39 | } |
---|
40 | element_->setParametersString(envoi); |
---|
41 | updateLabelWidget(); |
---|
42 | delete [] envoi; |
---|
43 | } |
---|