source: PSPA/Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_abstractElement.h @ 431

Last change on this file since 431 was 431, checked in by touze, 11 years ago

systeme periodique (mailles) + multipoles + madx

File size: 2.3 KB
Line 
1#ifndef GWTABSTRACELEMENT_SEEN
2#define GWTABSTRACELEMENT_SEEN
3
4#include "GWt_draggableImage.h"
5#include "GWt_console.h"
6
7#include "abstractElement.h"
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"
15#include "elementSnapshot.h"
16#include "elementMultipole.h"
17
18#include <Wt/WDialog>
19#include <Wt/WImage>
20#include <Wt/WString>
21#include <Wt/WPushButton>
22#include <Wt/WContainerWidget>
23
24#include <boost/variant.hpp>
25
26using namespace Wt;
27using namespace std;
28using namespace boost;
29
30class GWt_elementLigneFaisceau;
31
32// defined to ensure that the boost::variant could return something even when there is nothing
33class NullType {};
34
35class GWt_abstractElement : public WContainerWidget
36{
37 protected :
38   
39  abstractElement* abstractElement_;
40   
41  WDialog* dialog_;
42  GWt_draggableImage* dropped_;
43  WContainerWidget* wc_;
44  WText* wc_item_;
45  WLineEdit* labelEdit_;
46   
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();
63
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 
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);
93    string getParamDescription(string);
94};
95#endif
Note: See TracBrowser for help on using the repository browser.