source: PSPA/Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_drift.cc @ 294

Last change on this file since 294 was 294, checked in by garnier, 11 years ago

prepare to "erase element on double click"

File size: 1.7 KB
Line 
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
11GWt_drift::GWt_drift(abstractElement* elem, GWt_elementLigneFaisceau* elemLigne)
12:GWt_abstractElement(elem)
13{
14    elementLigneFaiseauContainer_ = elemLigne;
15    string* param = beginDialog();
16   
17    new WText("length (cm) : ",dialog_->contents());
18    xlengthEdit_ = new WLineEdit(param->c_str(), dialog_->contents());
19    new WBreak(dialog_->contents());
20    new WText("aperture (cm) : ",dialog_->contents());
21    apertureEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
22    new WBreak(dialog_->contents());
23    WPushButton *submit = new WPushButton("OK",dialog_->contents());
24    submit->clicked().connect(dialog_, &Wt::WDialog::accept);
25    dialog_->finished().connect(this, &GWt_drift::dialogDone);
26   
27    initialize();
28}
29
30void GWt_drift::dialogDone()
31{
32    unsigned nbParam = abstractElement_->getNbParams();
33    string* envoi = new string[nbParam+1];
34    int compteur = -1;
35    envoi[++compteur] = mixedTools::intToString(nbParam);
36    envoi[++compteur] = labelEdit_->text().toUTF8();
37    envoi[++compteur] = xlengthEdit_->text().toUTF8();
38    envoi[++compteur] = apertureEdit_->text().toUTF8();
39    if ( compteur !=  (int)nbParam ) {
40        cerr << " GWt_drift::dialogDone() pb nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl;
41        return;
42    }
43    abstractElement_->setParametersString(envoi);
44    updateLabelWidget();
45    delete [] envoi;
46}
47
48
49WImage* GWt_drift::getImage() {
50    return image_;
51}
52
53
54WString GWt_drift::print(){
55    return WString(abstractElement_->print());
56}
Note: See TracBrowser for help on using the repository browser.