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

Last change on this file since 365 was 365, checked in by garnier, 11 years ago

Amelioration dans le design du GUI des elementsFaisceau

File size: 2.4 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 showParameters();
54    void deleteElement();
55
56    void updateLabelAndToolTipWidget();
57    void FileInput(ifstream& ifs);
58   
59    //  GWt_draggableImage* getImage();
60    WContainerWidget* getWidget();
61    abstractElement* getAbstractElement();
62   
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   
78protected:
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);
94};
95#endif
Note: See TracBrowser for help on using the repository browser.