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