]> Creatis software - creaContours.git/blob - lib/Interface_Icons_NDimensions/interfEditMenu.cxx
75aec01935ae46aa78a5cd3ae624565baf91672f
[creaContours.git] / lib / Interface_Icons_NDimensions / interfEditMenu.cxx
1 #include "interfEditMenu.h"
2
3
4 interfEditMenu::interfEditMenu(wxWindow * parent, int sizex, int sizey,wxEvtHandler* evtHandler, std::string datdir)
5         : interfMenuBar(parent, sizex, sizey)
6 {
7         this->datadir = datdir;
8         eventHandler = evtHandler;
9         initButtons(this);
10 }
11
12 void interfEditMenu::initButtons(wxEvtHandler* evtHandler) {
13
14         std::vector<std::string> path, nom;
15         std::vector<wxObjectEventFunction> funct;
16
17         path.push_back(datadir + "/copy.png");
18         nom.push_back("Copy the selected contour");
19         funct.push_back((wxObjectEventFunction) &interfMenuBar:: onActionButtonPressed);
20
21         path.push_back(datadir + "/paste.png");
22         nom.push_back("Paste the copied contour");
23         funct.push_back((wxObjectEventFunction) &interfMenuBar:: onActionButtonPressed);
24
25         path.push_back(datadir + "/undo.png");
26         nom.push_back("Undo");
27         funct.push_back((wxObjectEventFunction) &interfEditMenu:: onUndo);
28
29         path.push_back(datadir + "/redo.png");
30         nom.push_back("Redo");
31         funct.push_back((wxObjectEventFunction) &interfEditMenu:: onRedo);
32
33     this->addButtons(path, nom);
34         this->setVectorFunction(funct);
35
36         this->setButtonName(0, wxContour_ActionCommandsID::COPY_TOOL);
37         this->setButtonName(1, wxContour_ActionCommandsID::PASTE_TOOL);
38         this->setButtonName(2, '-');
39         this->setButtonName(3, '-');
40
41         this->connectEvents(evtHandler);
42
43 }
44
45 void interfEditMenu::onUndo(wxCommandEvent& event){
46         ((wxContourEventHandler*)this->eventHandler)->onUNDO();
47 }
48 void interfEditMenu::onRedo(wxCommandEvent& event){
49         ((wxContourEventHandler*)this->eventHandler)->onREDO();
50 }
51
52 interfEditMenu::~interfEditMenu()
53 {
54 }
55