]> Creatis software - creaContours.git/blob - lib/Interface_Icons_NDimensions/interfToolsMenu.cxx
069bb244fd93b81e6da2fcb423efa3435c77b5ef
[creaContours.git] / lib / Interface_Icons_NDimensions / interfToolsMenu.cxx
1 #include "interfToolsMenu.h"
2 #include "interfMainPanel.h"
3
4 interfToolsMenu::interfToolsMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir)
5         : interfMenuBar(parent, sizex, sizey)
6 {
7         this->datadir = datdir;
8         //contourevent = (wxContourEventHandler*)evtHandler;
9         //infoWin = NULL;
10         configPanel = NULL;
11         segmentPanel = NULL;
12         spreadPanel = NULL;
13         segmentPanelITK = NULL;
14         
15 //      eventHandler = evtHandler;
16
17         initButtons(this);
18 }
19
20 void interfToolsMenu::initButtons(wxEvtHandler* evtHandler) {
21
22         std::vector<std::string> path, nom;
23         std::vector<wxObjectEventFunction> funct;
24
25         path.push_back(datadir + "/Spread.png");
26         nom.push_back("The selected contour will spread through all slides");
27         funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onRigidPressed);
28
29         path.push_back(datadir + "/Spread1.png");
30         nom.push_back("Select more than one contour and find the contours between them");
31         funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onSpreadPressed);
32         
33         path.push_back(datadir + "/pignon.png");
34         nom.push_back("Configuration of the window");
35         funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onConfigurationPressed);
36
37         path.push_back(datadir + "/info.png");
38         nom.push_back("Information of the contours in the scene");
39         funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onInformationPressed);
40         
41         path.push_back(datadir + "/Help.png");
42         nom.push_back("Show help page with information about the tools");
43         funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onHelpPressed);
44
45         this->addButtons(path, nom);    
46         this->setVectorFunction(funct);
47
48         //this->setButtonName(0, wxContour_ActionCommandsID::CHANGE_TOOL);
49
50         this->connectEvents(evtHandler);
51            
52
53 }
54
55 interfToolsMenu::~interfToolsMenu()
56 {
57 }
58
59 /**
60         **      Responds to the events of the buttons, when the same panel is responsible for it. It gets the name
61         **      of the button corresponding to the method that has to be executed,
62         **      it uses attribute eventHandler to call the methods define by the application.
63         **      see setEventHandler(wxEventHandler*)
64         **/
65 void interfToolsMenu::onRigidPressed(wxCommandEvent& event){
66         interfMainPanel::getInstance()->onRigidPressed();
67 }
68
69 void  interfToolsMenu::onSpreadPressed(wxCommandEvent& event){
70
71         interfMainPanel::getInstance()->onSpreadPressed();
72
73         
74 }
75
76
77 void  interfToolsMenu::onInformationPressed(wxCommandEvent& event){
78
79         interfMainPanel::getInstance()->onInformationPressed();
80
81         
82 }
83
84 void  interfToolsMenu::onConfigurationPressed(wxCommandEvent& event){
85
86         interfMainPanel::getInstance()->onConfigurationPressed();
87
88 }
89
90 void interfToolsMenu::onHelpPressed(wxCommandEvent& event){
91
92   wxLaunchDefaultBrowser(_T("http://www.creatis.insa-lyon.fr/creatools/node/25"), 0);
93
94 }
95