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

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

nvx element snapshot

File size: 2.3 KB
Line 
1#ifndef GWTABSTRACELEMENT_SEEN
2#define GWTABSTRACELEMENT_SEEN
3
4#include "GWt_draggableImage.h"
5#include "abstractElement.h"
6#include "GWt_console.h"
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"
14#include "elementSnapshot.h"
15
16#include <Wt/WDialog>
17#include <Wt/WImage>
18#include <Wt/WString>
19#include <Wt/WPushButton>
20#include <Wt/WContainerWidget>
21
22#include <boost/variant.hpp>
23
24using namespace Wt;
25using namespace std;
26using namespace boost;
27
28class GWt_elementLigneFaisceau;
29
30// defined to ensure that the boost::variant could return something even when there is nothing
31class NullType {};
32
33class GWt_abstractElement : public WContainerWidget
34{
35 protected :
36   
37  abstractElement* abstractElement_;
38   
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 clicked();
54  void doubleClicked();
55  void updateLabelAndToolTipWidget();
56  void FileInput(ifstream& ifs);
57 
58  //  GWt_draggableImage* getImage();
59  WContainerWidget* getWidget();
60  abstractElement* getAbstractElement();
61 
62  virtual void dialogDone(WDialog::DialogCode code) = 0;
63
64  inline WString print() {
65    return abstractElement_->print();
66  }
67 
68  virtual string getMimeType() = 0;
69  virtual string getSmallImageURL() = 0;
70  virtual string getBigImageURL() = 0;
71  virtual string getName() = 0;
72  virtual void initilializeDialog() = 0;
73 
74  void createDragImage(WContainerWidget*);
75  WImage* getImage();
76   
77 protected:
78 
79  WImage* image_;
80  GWt_elementLigneFaisceau* elementLigneFaiseauContainer_;
81   
82  // Nom, type de parametre
83  std::map<std::string, variant<int, string, bool, float, NullType> > parameterMapValue;
84  std::map<std::string, std::string > parameterMapDescription;
85 
86  inline void registerParam(string name, variant<int, string, bool, float, NullType> value, string desc) {
87    parameterMapValue[name] = value;
88    parameterMapDescription[name] = desc;
89  }
90 
91  variant<int, string, bool, float, NullType> getParamValue(string elem);
92  string getParamDescription(string elem); 
93};
94#endif
Note: See TracBrowser for help on using the repository browser.