]> Creatis software - creaContours.git/blob - lib/Interface_Icons_NDimensions/interfToolsMenu.cxx
Feature #1991 Update doxygen documentation
[creaContours.git] / lib / Interface_Icons_NDimensions / interfToolsMenu.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 #include "interfToolsMenu.h"
27 #include "interfMainPanel.h"
28
29 interfToolsMenu::interfToolsMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir)
30         : interfMenuBar(parent, sizex, sizey)
31 {
32         this->datadir = datdir;
33         //contourevent = (wxContourEventHandler*)evtHandler;
34         //infoWin               = NULL;
35
36 /*EED Borrame
37         configPanel             = NULL;
38         segmentPanel    = NULL;
39         spreadPanel             = NULL;
40         segmentPanelITK = NULL;
41         
42 //      eventHandler = evtHandler;
43 */
44
45         initButtons(this);
46 }
47
48 void interfToolsMenu::initButtons(wxEvtHandler* evtHandler) {
49
50         std::vector<std::string> path, nom;
51         std::vector<wxObjectEventFunction> funct;
52
53         path.push_back(datadir + "/Spread.png");
54         nom.push_back("The selected contour will spread through all slides");
55         funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onRigidPressed);
56
57         path.push_back(datadir + "/Spread1.png");
58         nom.push_back("Select more than one contour and find the contours between them");
59         funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onSpreadPressed);
60         
61         path.push_back(datadir + "/Mirror.png");
62         nom.push_back("Create an Axis and select a contour to mirror it accordingly");
63         funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onMirrorPressed);
64
65 //CMRU 17-08-09 ------------------------------------------------------------------
66         path.push_back(datadir + "/Letter.PNG");
67         nom.push_back("Insert a Label");
68         funct.push_back((wxObjectEventFunction)&interfToolsMenu::onPrintLabel);
69 //-------------------------------------------------------------------------------
70
71
72         path.push_back(datadir + "/FlipContours.png");
73         nom.push_back("Flop contours");
74         funct.push_back((wxObjectEventFunction) &interfToolsMenu:: onFlipPressed);
75
76         
77         this->addButtons(path, nom);    
78         this->setVectorFunction(funct);
79
80         //this->setButtonName(0, wxContour_ActionCommandsID::CHANGE_TOOL);
81
82         this->connectEvents(evtHandler);
83            
84
85 }
86
87 interfToolsMenu::~interfToolsMenu()
88 {
89 }
90
91 /**
92         **      Responds to the events of the buttons, when the same panel is responsible for it. It gets the name
93         **      of the button corresponding to the method that has to be executed,
94         **      it uses attribute eventHandler to call the methods define by the application.
95         **      see setEventHandler(wxEventHandler*)
96         **/
97 void interfToolsMenu::onRigidPressed(wxCommandEvent& event)
98 {
99         interfMainPanel::getInstance()->onRigidPressed();
100 }
101
102 void  interfToolsMenu::onSpreadPressed(wxCommandEvent& event)
103 {
104         interfMainPanel::getInstance()->onSpreadPressed();
105 }
106
107 void interfToolsMenu::onMirrorPressed(wxCommandEvent& event)
108 {
109   interfMainPanel::getInstance()->onMirrorPressed();
110 }
111
112 void interfToolsMenu::onPrintLabel(wxCommandEvent& event)
113 {
114         interfMainPanel::getInstance()->onPrintLabel();
115 }
116
117 void interfToolsMenu::onFlipPressed(wxCommandEvent& event)
118 {
119         printf("EED interfToolsMenu::onFlipLabel \n");
120         interfMainPanel::getInstance()->onFlipContours();
121 }