[48] | 1 | #ifndef LIGNEFAISCEAU_SEEN |
---|
| 2 | #define LIGNEFAISCEAU_SEEN |
---|
| 3 | |
---|
| 4 | #include "dataManager.h" |
---|
[113] | 5 | #include "nomdElements.h" |
---|
[48] | 6 | #include "GWt_pspaApplication.h" |
---|
[169] | 7 | #include "GWt_abstractElement.h" |
---|
[48] | 8 | |
---|
| 9 | #include <Wt/WApplication> |
---|
| 10 | #include <Wt/WPushButton> |
---|
| 11 | #include <Wt/WHBoxLayout> |
---|
| 12 | #include <Wt/WContainerWidget> |
---|
| 13 | |
---|
[113] | 14 | using namespace Wt; |
---|
[48] | 15 | |
---|
[305] | 16 | class GWt_dropZoneLigneFaisceau; |
---|
| 17 | |
---|
[379] | 18 | class compteur { |
---|
[272] | 19 | int n_; |
---|
| 20 | |
---|
| 21 | public : |
---|
[379] | 22 | compteur() {n_= 0;} |
---|
[272] | 23 | int incr() {return ++n_;} |
---|
[113] | 24 | }; |
---|
[48] | 25 | |
---|
| 26 | class GWt_LigneFaisceau : public WContainerWidget |
---|
| 27 | { |
---|
[272] | 28 | WHBoxLayout* ligneFaisceauLayout_; |
---|
| 29 | PspaApplication* pspa_; |
---|
| 30 | |
---|
| 31 | public : |
---|
| 32 | |
---|
| 33 | GWt_LigneFaisceau() {;} |
---|
| 34 | GWt_LigneFaisceau(PspaApplication*); |
---|
| 35 | |
---|
[273] | 36 | /** |
---|
| 37 | |
---|
| 38 | Add an element at a position inside the beam line. |
---|
| 39 | @param eType : type of element |
---|
| 40 | @param dropContainer : origin of the drop event |
---|
| 41 | - |
---|
| 42 | Special case, when first element is created, we add a drop zone at the end and beginning of the drop zone |
---|
| 43 | and we center everything |
---|
| 44 | */ |
---|
[418] | 45 | GWt_abstractElement* addElement(nomdElements::typedElement eType, GWt_dropZoneLigneFaisceau* dropContainer); |
---|
| 46 | GWt_abstractElement* addElement(nomdElements::typedElement eType); |
---|
[305] | 47 | |
---|
[299] | 48 | void removeElement(GWt_abstractElement*); |
---|
[308] | 49 | |
---|
[379] | 50 | ~GWt_LigneFaisceau() {;} |
---|
[272] | 51 | |
---|
[305] | 52 | /** return the abstract element at a position |
---|
| 53 | @param : position in the beam line |
---|
| 54 | */ |
---|
| 55 | abstractElement* getAbstractElement(int i); |
---|
[401] | 56 | |
---|
[418] | 57 | /** return the numero (1.. infty) of the abstract element |
---|
[401] | 58 | @param : label of this abstractElement in the beam line |
---|
| 59 | */ |
---|
[418] | 60 | int getAbstractElementNumeroFromLabel(std::string txt); |
---|
[401] | 61 | |
---|
[308] | 62 | // void restoreElementCollectionFromDataManager(); |
---|
[272] | 63 | void clickEvent(WContainerWidget*); |
---|
| 64 | void deleteElement(WContainerWidget*); |
---|
[305] | 65 | int getBeamLineSize(); |
---|
[308] | 66 | |
---|
[305] | 67 | /** |
---|
| 68 | remove all elements from beam line |
---|
| 69 | */ |
---|
| 70 | void clear(); |
---|
| 71 | |
---|
| 72 | /** |
---|
| 73 | Return a vector contains all abstract elements in the beam line |
---|
| 74 | */ |
---|
| 75 | vector <abstractElement*> getAllAbstractElements(); |
---|
| 76 | |
---|
| 77 | void update(); |
---|
[308] | 78 | |
---|
[359] | 79 | /** update the status of the given index element |
---|
| 80 | */ |
---|
| 81 | void update(int); |
---|
| 82 | |
---|
[401] | 83 | void initializeSoftwares(); |
---|
| 84 | |
---|
[284] | 85 | private : |
---|
| 86 | void manageLineFaisceauLayout(); |
---|
[305] | 87 | GWt_dropZoneLigneFaisceau* allDropZone_; |
---|
[272] | 88 | |
---|
[48] | 89 | }; |
---|
| 90 | |
---|
| 91 | #endif |
---|