1 | |
---|
2 | #include "GWt_snapshot.h" |
---|
3 | #include "mixedTools.h" |
---|
4 | |
---|
5 | #include <Wt/WBreak> |
---|
6 | #include <Wt/WLineEdit> |
---|
7 | #include <Wt/WDialog> |
---|
8 | #include <Wt/WPushButton> |
---|
9 | |
---|
10 | GWt_snapshot::GWt_snapshot(GWt_elementLigneFaisceau* elemLigne) : GWt_abstractElement(new elementSnapshot()) |
---|
11 | { |
---|
12 | elementLigneFaiseauContainer_ = elemLigne; |
---|
13 | initialize(); |
---|
14 | } |
---|
15 | |
---|
16 | void GWt_snapshot::initilializeDialog() |
---|
17 | { |
---|
18 | string* param = beginDialog(); |
---|
19 | new WBreak(dialog_->contents()); |
---|
20 | |
---|
21 | WPushButton *annule= new WPushButton("cancel",dialog_->contents()); |
---|
22 | annule->clicked().connect(dialog_,&Wt::WDialog::reject); |
---|
23 | WPushButton *submit= new WPushButton("OK",dialog_->contents()); |
---|
24 | submit->clicked().connect(dialog_,&Wt::WDialog::accept); |
---|
25 | dialog_->finished().connect(this, &GWt_snapshot::dialogDone); |
---|
26 | } |
---|
27 | |
---|
28 | void GWt_snapshot::dialogDone(WDialog::DialogCode code) |
---|
29 | { |
---|
30 | if (code != Wt::WDialog::Accepted) return; |
---|
31 | |
---|
32 | unsigned nbParam = abstractElement_->getNbParams(); |
---|
33 | string* envoi = new string[nbParam+1]; |
---|
34 | int compteur = -1; |
---|
35 | |
---|
36 | envoi[++compteur] = mixedTools::intToString(nbParam); |
---|
37 | envoi[++compteur] = labelEdit_->text().toUTF8(); |
---|
38 | if ( compteur != (int)nbParam ) { |
---|
39 | cerr << " GWt_snapshot::dialogDone() : pb dans le nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl; |
---|
40 | return; |
---|
41 | } |
---|
42 | |
---|
43 | abstractElement_->setParametersString(envoi); |
---|
44 | delete [] envoi; |
---|
45 | } |
---|
46 | |
---|
47 | WImage* GWt_snapshot::getImage() { |
---|
48 | return image_; |
---|
49 | } |
---|