]> Creatis software - creaContours.git/blob - lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx
42d97ba3822036ad0b2c91eebc167689a04edf08
[creaContours.git] / lib / Interface_Icons_NDimensions / interfNewContourMenu.cxx
1 #include "interfNewContourMenu.h"
2
3
4 interfNewContourMenu::interfNewContourMenu(wxWindow * parent, int sizex, int sizey, wxEvtHandler* evtHandler, std::string datdir)
5         : interfMenuBar(parent, sizex, sizey)
6 {
7         this->datadir = datdir;
8         //eventHandler = (wxContourEventHandler*)evtHandler;
9
10         panBull = NULL;
11         created = false;
12
13         initButtons(this);      
14 }
15
16 void interfNewContourMenu::initButtons(wxEvtHandler* evtHandler) {
17
18         std::vector<std::string> path, nom;
19         std::vector<wxObjectEventFunction> funct;
20         std::vector<wxEvtHandler*> hand;
21         
22         path.push_back(datadir + "/Spline.png");
23         nom.push_back("Create a contour using splines");        
24         funct.push_back((wxObjectEventFunction)&interfNewContourMenu::onCreateContourSpline);
25         hand.push_back(evtHandler);
26
27         path.push_back(datadir+"/Rectangle.png");
28         nom.push_back("Create a contour using the basic shape of a rectangle");
29         funct.push_back((wxObjectEventFunction)&interfNewContourMenu::onCreateContourRectangle);
30         hand.push_back(evtHandler);
31
32         path.push_back(datadir + "/Circle.png");
33         nom.push_back("Create a contour using the basic shape of a Circle");
34         funct.push_back((wxObjectEventFunction)&interfNewContourMenu::onCreateContourCircle);
35         hand.push_back(evtHandler);
36
37         path.push_back(datadir + "/bullseye.png");
38         nom.push_back("Create a contour using the bulls eye");
39         funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourBullseye);
40         hand.push_back(this);
41
42         path.push_back(datadir + "/Line.png");
43         nom.push_back("Create a Line");
44         funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourLine);
45         hand.push_back(this);
46 /*
47         path.push_back(datadir + "/Line.png");
48         nom.push_back("Create Points");
49         funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourPoints);
50         hand.push_back(this);
51 */      
52     this->addButtons(path, nom);
53
54         this->setVectorFunction(funct); 
55         this->setEventHandlers(hand);   
56         this->connectEvents();
57
58 }
59
60
61
62 interfNewContourMenu::~interfNewContourMenu()
63 {
64 }
65
66 void interfNewContourMenu::onCreateContourBullseye(wxCommandEvent& event){
67
68
69         if(!created){
70
71                 panBull = new PanelBullEyeOptions(interfMainPanel::getInstance()->getInfoPanel(), 
72                                                                 wxSize(100,200));
73                 created = true;
74         }
75         interfMainPanel::getInstance()->onCreateContoursBullEye(panBull);
76         //eventHandler->createContourBullsEye(panBull);
77         interfMainPanel::getInstance()->showPanel(panBull);
78
79 }
80
81 void interfNewContourMenu::onCreateContourSpline( wxCommandEvent& event ){
82         interfMainPanel::getInstance()->onCreateContourSpline();
83 }
84 void interfNewContourMenu::onCreateContourRectangle( wxCommandEvent& event ){
85         interfMainPanel::getInstance()->onCreateContourRectangle();
86 }
87 void interfNewContourMenu::onCreateContourCircle( wxCommandEvent& event ){
88         interfMainPanel::getInstance()->onCreateContourCircle();
89 }
90 void interfNewContourMenu::onCreateContourLine( wxCommandEvent& event ){
91         interfMainPanel::getInstance()->onCreateContourLine();
92 }
93 /*
94 void interfNewContourMenu::onCreateContourPoints( wxCommandEvent& event ){
95         interfMainPanel::getInstance()->onCreateContourLine();
96 }
97 */
98