[83] | 1 | #ifndef GWTABSTRACELEMENT_SEEN |
---|
| 2 | #define GWTABSTRACELEMENT_SEEN |
---|
| 3 | |
---|
[239] | 4 | #include "GWt_draggableImage.h" |
---|
[83] | 5 | #include "abstractElement.h" |
---|
[243] | 6 | #include "GWt_console.h" |
---|
[305] | 7 | #include "elementDrift.h" |
---|
| 8 | #include "elementRfgun.h" |
---|
| 9 | #include "elementCell.h" |
---|
| 10 | #include "elementSoleno.h" |
---|
| 11 | #include "elementBend.h" |
---|
| 12 | #include "elementBeam.h" |
---|
| 13 | #include "elementFit.h" |
---|
[343] | 14 | #include "elementSnapshot.h" |
---|
[83] | 15 | |
---|
| 16 | #include <Wt/WDialog> |
---|
[260] | 17 | #include <Wt/WImage> |
---|
[287] | 18 | #include <Wt/WString> |
---|
[83] | 19 | #include <Wt/WPushButton> |
---|
[126] | 20 | #include <Wt/WContainerWidget> |
---|
[83] | 21 | |
---|
[320] | 22 | #include <boost/variant.hpp> |
---|
| 23 | |
---|
[83] | 24 | using namespace Wt; |
---|
| 25 | using namespace std; |
---|
[320] | 26 | using namespace boost; |
---|
[83] | 27 | |
---|
[266] | 28 | class GWt_elementLigneFaisceau; |
---|
| 29 | |
---|
[320] | 30 | // defined to ensure that the boost::variant could return something even when there is nothing |
---|
| 31 | class NullType {}; |
---|
| 32 | |
---|
[83] | 33 | class GWt_abstractElement : public WContainerWidget |
---|
| 34 | { |
---|
[365] | 35 | protected : |
---|
[266] | 36 | |
---|
[365] | 37 | abstractElement* abstractElement_; |
---|
[272] | 38 | |
---|
[365] | 39 | WDialog* dialog_; |
---|
| 40 | GWt_draggableImage* dropped_; |
---|
| 41 | WContainerWidget* wc_; |
---|
| 42 | WText* wc_item_; |
---|
| 43 | WLineEdit* labelEdit_; |
---|
| 44 | |
---|
| 45 | GWt_abstractElement() {;} |
---|
| 46 | string* beginDialog(); |
---|
| 47 | |
---|
| 48 | public : |
---|
| 49 | |
---|
| 50 | GWt_abstractElement(abstractElement*); |
---|
| 51 | |
---|
| 52 | void initialize(); |
---|
| 53 | void showParameters(); |
---|
| 54 | void deleteElement(); |
---|
[328] | 55 | |
---|
[365] | 56 | void updateLabelAndToolTipWidget(); |
---|
| 57 | void FileInput(ifstream& ifs); |
---|
[272] | 58 | |
---|
[365] | 59 | // GWt_draggableImage* getImage(); |
---|
| 60 | WContainerWidget* getWidget(); |
---|
| 61 | abstractElement* getAbstractElement(); |
---|
[308] | 62 | |
---|
[365] | 63 | virtual void dialogDone(WDialog::DialogCode code) = 0; |
---|
| 64 | |
---|
| 65 | inline WString print() { |
---|
| 66 | return abstractElement_->print(); |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | virtual string getMimeType() = 0; |
---|
| 70 | virtual string getSmallImageURL() = 0; |
---|
| 71 | virtual string getBigImageURL() = 0; |
---|
| 72 | virtual string getName() = 0; |
---|
| 73 | virtual void initilializeDialog() = 0; |
---|
| 74 | |
---|
| 75 | void createDragImage(WContainerWidget*); |
---|
| 76 | WImage* getImage(); |
---|
| 77 | |
---|
| 78 | protected: |
---|
| 79 | |
---|
| 80 | WImage* image_; |
---|
| 81 | GWt_elementLigneFaisceau* elementLigneFaiseauContainer_; |
---|
| 82 | |
---|
| 83 | // Nom, type de parametre |
---|
| 84 | std::map<std::string, variant<int, string, bool, float, NullType> > parameterMapValue; |
---|
| 85 | std::map<std::string, std::string > parameterMapDescription; |
---|
| 86 | |
---|
| 87 | inline void registerParam(string name, variant<int, string, bool, float, NullType> value, string desc) { |
---|
| 88 | parameterMapValue[name] = value; |
---|
| 89 | parameterMapDescription[name] = desc; |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | variant<int, string, bool, float, NullType> getParamValue(string elem); |
---|
| 93 | string getParamDescription(string elem); |
---|
[83] | 94 | }; |
---|
| 95 | #endif |
---|