]> Creatis software - creaContours.git/blob - lib/Interface_Icons_NDimensions/interfNewContourMenu.cxx
5b12bd3951f99ad87ca189c8a974295432fc2159
[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(evtHandler);        
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(wxCommandEventHandler(wxContourEventHandler::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(wxCommandEventHandler(wxContourEventHandler::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(wxCommandEventHandler(wxContourEventHandler::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     this->addButtons(path, nom);
43
44         this->setVectorFunction(funct); 
45         this->setEventHandlers(hand);   
46         this->connectEvents();
47
48 }
49
50
51
52 interfNewContourMenu::~interfNewContourMenu()
53 {
54 }
55
56 void interfNewContourMenu::onCreateContourBullseye(wxEvtHandler* evtHandler){
57
58
59         if(!created){
60
61                 panBull = new PanelBullEyeOptions(interfMainPanel::getInstance()->getInfoPanel(), 
62                                                                 wxSize(100,200));
63                 created = true;
64         }
65         eventHandler->createContourBullsEye(panBull);
66         interfMainPanel::getInstance()->showPanel(panBull);
67
68 }
69