[453] | 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; |
---|
[455] | 17 | class GWt_sector; |
---|
[305] | 18 | |
---|
[379] | 19 | class compteur { |
---|
[272] | 20 | int n_; |
---|
| 21 | |
---|
| 22 | public : |
---|
[379] | 23 | compteur() {n_= 0;} |
---|
[272] | 24 | int incr() {return ++n_;} |
---|
[113] | 25 | }; |
---|
[48] | 26 | |
---|
[453] | 27 | class GWt_ligneFaisceau : public WContainerWidget |
---|
[48] | 28 | { |
---|
[455] | 29 | dataManager* dataManager_; |
---|
| 30 | |
---|
[272] | 31 | public : |
---|
[455] | 32 | |
---|
| 33 | GWt_ligneFaisceau(dataManager*,GWt_sector*); |
---|
| 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); |
---|
[305] | 45 | |
---|
[299] | 46 | void removeElement(GWt_abstractElement*); |
---|
[308] | 47 | |
---|
[453] | 48 | ~GWt_ligneFaisceau() {;} |
---|
[272] | 49 | |
---|
[305] | 50 | /** return the abstract element at a position |
---|
| 51 | @param : position in the beam line |
---|
| 52 | */ |
---|
| 53 | abstractElement* getAbstractElement(int i); |
---|
[401] | 54 | |
---|
[418] | 55 | /** return the numero (1.. infty) of the abstract element |
---|
[401] | 56 | @param : label of this abstractElement in the beam line |
---|
| 57 | */ |
---|
[418] | 58 | int getAbstractElementNumeroFromLabel(std::string txt); |
---|
[401] | 59 | |
---|
[308] | 60 | // void restoreElementCollectionFromDataManager(); |
---|
[272] | 61 | void clickEvent(WContainerWidget*); |
---|
| 62 | void deleteElement(WContainerWidget*); |
---|
[305] | 63 | int getBeamLineSize(); |
---|
[308] | 64 | |
---|
[305] | 65 | /** |
---|
| 66 | remove all elements from beam line |
---|
| 67 | */ |
---|
| 68 | void clear(); |
---|
| 69 | |
---|
| 70 | /** |
---|
| 71 | Return a vector contains all abstract elements in the beam line |
---|
| 72 | */ |
---|
| 73 | vector <abstractElement*> getAllAbstractElements(); |
---|
| 74 | |
---|
| 75 | void update(); |
---|
[455] | 76 | |
---|
[469] | 77 | |
---|
[455] | 78 | /** Return the sector of this beamLine */ |
---|
| 79 | inline GWt_sector* getUISector() { return UI_sector_;}; |
---|
| 80 | |
---|
[469] | 81 | void buildBeamLineWidget(); |
---|
| 82 | |
---|
[455] | 83 | private : |
---|
| 84 | void manageLineFaisceauLayout_deprecated(); |
---|
| 85 | |
---|
| 86 | GWt_dropZoneLigneFaisceau* allDropZone_; |
---|
| 87 | WHBoxLayout* ligneFaisceauLayout_; |
---|
| 88 | GWt_sector* UI_sector_; |
---|
[48] | 89 | }; |
---|
| 90 | |
---|
| 91 | #endif |
---|