1 | #ifndef GWt_ligneFaisceau_SEEN |
---|
2 | #define GWt_ligneFaisceau_SEEN |
---|
3 | |
---|
4 | #include "dataManager.h" |
---|
5 | #include "nomdElements.h" |
---|
6 | #include "GWt_pspaApplication.h" |
---|
7 | #include "GWt_abstractElement.h" |
---|
8 | |
---|
9 | #include <Wt/WApplication> |
---|
10 | #include <Wt/WPushButton> |
---|
11 | #include <Wt/WHBoxLayout> |
---|
12 | #include <Wt/WContainerWidget> |
---|
13 | |
---|
14 | using namespace Wt; |
---|
15 | |
---|
16 | class GWt_dropZoneLigneFaisceau; |
---|
17 | class GWt_sector; |
---|
18 | |
---|
19 | class compteur { |
---|
20 | int n_; |
---|
21 | |
---|
22 | public : |
---|
23 | compteur() {n_= 0;} |
---|
24 | int incr() {return ++n_;} |
---|
25 | }; |
---|
26 | |
---|
27 | class GWt_ligneFaisceau : public WContainerWidget |
---|
28 | { |
---|
29 | dataManager* dataManager_; |
---|
30 | |
---|
31 | public : |
---|
32 | |
---|
33 | GWt_ligneFaisceau(dataManager*,GWt_sector*); |
---|
34 | |
---|
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 | */ |
---|
44 | GWt_abstractElement* addElement(nomdElements::typedElement eType, GWt_dropZoneLigneFaisceau* dropContainer); |
---|
45 | |
---|
46 | void removeElement(GWt_abstractElement*); |
---|
47 | |
---|
48 | ~GWt_ligneFaisceau() {;} |
---|
49 | |
---|
50 | /** return the abstract element at a position |
---|
51 | @param : position in the beam line |
---|
52 | */ |
---|
53 | abstractElement* getAbstractElement(int i); |
---|
54 | |
---|
55 | /** return the numero (1.. infty) of the abstract element |
---|
56 | @param : label of this abstractElement in the beam line |
---|
57 | */ |
---|
58 | int getAbstractElementNumeroFromLabel(std::string txt); |
---|
59 | |
---|
60 | // void restoreElementCollectionFromDataManager(); |
---|
61 | void clickEvent(WContainerWidget*); |
---|
62 | void deleteElement(WContainerWidget*); |
---|
63 | int getBeamLineSize(); |
---|
64 | |
---|
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(); |
---|
76 | |
---|
77 | |
---|
78 | /** Return the sector of this beamLine */ |
---|
79 | inline GWt_sector* getUISector() { return UI_sector_;}; |
---|
80 | |
---|
81 | void buildBeamLineWidget(); |
---|
82 | |
---|
83 | private : |
---|
84 | void manageLineFaisceauLayout_deprecated(); |
---|
85 | |
---|
86 | GWt_dropZoneLigneFaisceau* allDropZone_; |
---|
87 | WHBoxLayout* ligneFaisceauLayout_; |
---|
88 | GWt_sector* UI_sector_; |
---|
89 | }; |
---|
90 | |
---|
91 | #endif |
---|