[437] | 1 | #ifndef GWt_LIGNEFAISCEAU_SEEN |
---|
| 2 | #define GWt_LIGNEFAISCEAU_SEEN |
---|
[48] | 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 | PspaApplication* pspa_; |
---|
| 29 | |
---|
| 30 | public : |
---|
| 31 | |
---|
| 32 | GWt_LigneFaisceau() {;} |
---|
| 33 | GWt_LigneFaisceau(PspaApplication*); |
---|
| 34 | |
---|
[273] | 35 | /** |
---|
| 36 | |
---|
| 37 | Add an element at a position inside the beam line. |
---|
| 38 | @param eType : type of element |
---|
| 39 | @param dropContainer : origin of the drop event |
---|
| 40 | - |
---|
| 41 | Special case, when first element is created, we add a drop zone at the end and beginning of the drop zone |
---|
| 42 | and we center everything |
---|
| 43 | */ |
---|
[418] | 44 | GWt_abstractElement* addElement(nomdElements::typedElement eType, GWt_dropZoneLigneFaisceau* dropContainer); |
---|
| 45 | GWt_abstractElement* addElement(nomdElements::typedElement eType); |
---|
[305] | 46 | |
---|
[299] | 47 | void removeElement(GWt_abstractElement*); |
---|
[308] | 48 | |
---|
[379] | 49 | ~GWt_LigneFaisceau() {;} |
---|
[272] | 50 | |
---|
[305] | 51 | /** return the abstract element at a position |
---|
| 52 | @param : position in the beam line |
---|
| 53 | */ |
---|
| 54 | abstractElement* getAbstractElement(int i); |
---|
[401] | 55 | |
---|
[418] | 56 | /** return the numero (1.. infty) of the abstract element |
---|
[401] | 57 | @param : label of this abstractElement in the beam line |
---|
| 58 | */ |
---|
[418] | 59 | int getAbstractElementNumeroFromLabel(std::string txt); |
---|
[401] | 60 | |
---|
[308] | 61 | // void restoreElementCollectionFromDataManager(); |
---|
[272] | 62 | void clickEvent(WContainerWidget*); |
---|
| 63 | void deleteElement(WContainerWidget*); |
---|
[305] | 64 | int getBeamLineSize(); |
---|
[308] | 65 | |
---|
[305] | 66 | /** |
---|
| 67 | remove all elements from beam line |
---|
| 68 | */ |
---|
| 69 | void clear(); |
---|
| 70 | |
---|
| 71 | /** |
---|
| 72 | Return a vector contains all abstract elements in the beam line |
---|
| 73 | */ |
---|
| 74 | vector <abstractElement*> getAllAbstractElements(); |
---|
| 75 | |
---|
| 76 | void update(); |
---|
[308] | 77 | |
---|
[359] | 78 | /** update the status of the given index element |
---|
| 79 | */ |
---|
| 80 | void update(int); |
---|
| 81 | |
---|
[401] | 82 | void initializeSoftwares(); |
---|
| 83 | |
---|
[284] | 84 | private : |
---|
| 85 | void manageLineFaisceauLayout(); |
---|
[305] | 86 | GWt_dropZoneLigneFaisceau* allDropZone_; |
---|
[449] | 87 | WHBoxLayout* ligneFaisceauLayout_; |
---|
[48] | 88 | }; |
---|
| 89 | |
---|
| 90 | #endif |
---|