1 | #ifndef LIGNEFAISCEAU_SEEN |
---|
2 | #define 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 | |
---|
18 | class compteur { |
---|
19 | int n_; |
---|
20 | |
---|
21 | public : |
---|
22 | compteur() {n_= 0;} |
---|
23 | int incr() {return ++n_;} |
---|
24 | }; |
---|
25 | |
---|
26 | class GWt_LigneFaisceau : public WContainerWidget |
---|
27 | { |
---|
28 | WHBoxLayout* ligneFaisceauLayout_; |
---|
29 | PspaApplication* pspa_; |
---|
30 | |
---|
31 | public : |
---|
32 | |
---|
33 | GWt_LigneFaisceau() {;} |
---|
34 | GWt_LigneFaisceau(PspaApplication*); |
---|
35 | |
---|
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 | */ |
---|
45 | GWt_abstractElement* addElement(typedElement eType, GWt_dropZoneLigneFaisceau* dropContainer); |
---|
46 | GWt_abstractElement* addElement(typedElement eType); |
---|
47 | |
---|
48 | void removeElement(GWt_abstractElement*); |
---|
49 | |
---|
50 | ~GWt_LigneFaisceau() {;} |
---|
51 | |
---|
52 | /** return the abstract element at a position |
---|
53 | @param : position in the beam line |
---|
54 | */ |
---|
55 | abstractElement* getAbstractElement(int i); |
---|
56 | |
---|
57 | /** return the index of the abstract element |
---|
58 | @param : label of this abstractElement in the beam line |
---|
59 | */ |
---|
60 | int getAbstractElementIndexFromLabel(std::string str); |
---|
61 | |
---|
62 | // void restoreElementCollectionFromDataManager(); |
---|
63 | void clickEvent(WContainerWidget*); |
---|
64 | void deleteElement(WContainerWidget*); |
---|
65 | int getBeamLineSize(); |
---|
66 | |
---|
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(); |
---|
78 | |
---|
79 | /** update the status of the given index element |
---|
80 | */ |
---|
81 | void update(int); |
---|
82 | |
---|
83 | void initializeSoftwares(); |
---|
84 | |
---|
85 | private : |
---|
86 | void manageLineFaisceauLayout(); |
---|
87 | GWt_dropZoneLigneFaisceau* allDropZone_; |
---|
88 | |
---|
89 | }; |
---|
90 | |
---|
91 | #endif |
---|