creaContours_lib
interfToolsMenu Class Reference

#include <interfToolsMenu.h>

Inheritance diagram for interfToolsMenu:
Collaboration diagram for interfToolsMenu:

Public Member Functions

 interfToolsMenu (wxWindow *parent, int sizex, int sizey, wxEvtHandler *evtHandler, std::string datdir="data/Icons")
 
 ~interfToolsMenu ()
 
virtual void initButtons (wxEvtHandler *evtHandler)
 
void onRigidPressed (wxCommandEvent &event)
 
void onSpreadPressed (wxCommandEvent &event)
 
void onMirrorPressed (wxCommandEvent &event)
 
void onPrintLabel (wxCommandEvent &event)
 
virtual void addButtons (std::vector< std::string > vpath, std::vector< std::string > vnom)
 
virtual wxBitmapButton * getButton (std::string imgpath, int sizex, int sizey)
 
virtual wxStaticText * getText (std::string nom, int sizex, int sizey)
 
virtual void setVectorFunction (std::vector< wxObjectEventFunction > vectf)
 
virtual void connectEvents (wxEvtHandler *evtHandler)
 
virtual void connectEvents ()
 
virtual void setButtonName (int i, const char c)
 
void onActionButtonPressed (wxCommandEvent &event)
 
virtual void setEventHandlers (std::vector< wxEvtHandler * > hand)
 

Protected Attributes

std::string datadir
 

Detailed Description

Definition at line 35 of file interfToolsMenu.h.

Constructor & Destructor Documentation

interfToolsMenu::interfToolsMenu ( wxWindow *  parent,
int  sizex,
int  sizey,
wxEvtHandler *  evtHandler,
std::string  datdir = "data/Icons" 
)

Definition at line 29 of file interfToolsMenu.cxx.

References interfMenuBar::datadir, and initButtons().

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 }

Here is the call graph for this function:

interfToolsMenu::~interfToolsMenu ( )

Definition at line 82 of file interfToolsMenu.cxx.

83 {
84 }

Member Function Documentation

virtual void interfMenuBar::addButtons ( std::vector< std::string >  vpath,
std::vector< std::string >  vnom 
)
inlinevirtualinherited

This method add a series of button in a line, it uses the method getbutton to create the button and static text to create the text, it also initialice the flexgridsizer to add the buttons and the text into the panel

Parameters
vectorpath, this parameter contains the path of the images to include in the path
vectornom, this parameter contains the names corresponding to each path of image given

Definition at line 64 of file interfMenuBar.h.

References interfMenuBar::flexsizer, interfMenuBar::getButton(), and interfMenuBar::vectbutton.

Referenced by interfDeleteMenu::initButtons(), interfEditMenu::initButtons(), interfIOMenu::initButtons(), interfImageToolsMenu::initButtons(), interfSegmentationMenu::initButtons(), initButtons(), and interfNewContourMenu::initButtons().

64  {
65 
66  int sizex = 80;
67  int sizey = 80;
68 
69  //RaC 11-09
70  //This constructor function as well but it is neccessary to change vpath.size() by 6
71  //flexsizer = new wxFlexGridSizer(2,vpath.size(),2,2);
72  flexsizer = new wxFlexGridSizer(6);
73  this->SetSizer(flexsizer, true);
74  this->SetAutoLayout( true );
75 
76  //first row of the sizer, the buttons are being added
77  for(int i = 0; i < (int)(vpath.size());i++){
78  std::string p = vpath[i];
79  wxBitmapButton* bitmapbutton = this->getButton(p, sizex, sizey);
80  flexsizer->Add(bitmapbutton,wxFIXED_MINSIZE);
81 
82  }
83  //second row of the sizer, the names are being added
84 
85  for(int i = 0; i < (int)(vnom.size()); i++){
86  //sizex = vectbutton[i]->GetSize().GetWidth();
87  std::string n = vnom[i];
88  vectbutton[i]->SetToolTip(wxString(n.c_str(),wxConvUTF8));
89  //wxStaticText* statictext = getText(n, sizex, 15);
90  //flexsizer->Add(statictext, wxEXPAND |wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTRE_HORIZONTAL|wxSHAPED);
91  }
92  this->Layout();
93  }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void interfMenuBar::connectEvents ( wxEvtHandler *  evtHandler)
inlinevirtualinherited

This method connect the events seted in the vector vectfunct each function must have a button to relate with, see function setVectorFunction()

Definition at line 143 of file interfMenuBar.h.

References interfMenuBar::vectbutton, and interfMenuBar::vectfunct.

143  {
144 
145  for(int i = 0; i < (int)(vectbutton.size());i++){
146  Connect(vectbutton[i]->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, vectfunct[i],NULL,evtHandler);
147  }
148  }
virtual void interfMenuBar::connectEvents ( )
inlinevirtualinherited

This method connect the events seted in the vector vectfunct each function must have a button to relate with, see function setVectorFunction()

Definition at line 154 of file interfMenuBar.h.

References interfMenuBar::vectbutton, interfMenuBar::vectfunct, and interfMenuBar::vecthand.

Referenced by interfDeleteMenu::initButtons(), interfEditMenu::initButtons(), interfIOMenu::initButtons(), interfImageToolsMenu::initButtons(), interfSegmentationMenu::initButtons(), initButtons(), and interfNewContourMenu::initButtons().

154  {
155 
156  for(int i = 0; i < (int)(vectbutton.size());i++){
157  Connect(vectbutton[i]->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, vectfunct[i],NULL,vecthand[i]);
158  }
159  }

Here is the caller graph for this function:

virtual wxBitmapButton* interfMenuBar::getButton ( std::string  imgpath,
int  sizex,
int  sizey 
)
inlinevirtualinherited

This method creates the button with the given image and returns it

Parameters
stringimgpath is the string containing the path to the image of the button being created
intx indicates the x coordinate where the button should be located
inty indicates the y coordinate where the button should be located

Definition at line 102 of file interfMenuBar.h.

References interfMenuBar::vectbutton, and interfMenuBar::vectimgpath.

Referenced by interfMenuBar::addButtons().

102  {
103  vectimgpath.push_back(imgpath);
104 
105 
106  wxBitmap* bitmap = new wxBitmap(wxString(imgpath.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG);
107 
108  //wxSize(sizex,sizey)
109  wxBitmapButton* bitmapbutton = new wxBitmapButton(this, -1, *bitmap, wxDefaultPosition, wxDefaultSize,
110  wxBU_AUTODRAW, wxDefaultValidator, wxString(_T("")));
111 
112  vectbutton.push_back(bitmapbutton);
113  return bitmapbutton;
114  }

Here is the caller graph for this function:

virtual wxStaticText* interfMenuBar::getText ( std::string  nom,
int  sizex,
int  sizey 
)
inlinevirtualinherited

This method create the static text with the given string and returns it, it also push it back into the vector nom

Parameters
stringnom text wich will be added to the statictext
intsizex size of the text
intsizey size of the text

Definition at line 123 of file interfMenuBar.h.

References interfMenuBar::vectnom.

123  {
124  vectnom.push_back(nom);
125  return new wxStaticText(this, -1, wxString(nom.c_str(),wxConvUTF8), wxDefaultPosition,
126  wxSize(sizex,sizey), wxALIGN_CENTRE, wxString(nom.c_str(),wxConvUTF8));
127  }
void interfToolsMenu::initButtons ( wxEvtHandler *  evtHandler)
virtual

Implements interfMenuBar.

Definition at line 48 of file interfToolsMenu.cxx.

References interfMenuBar::addButtons(), interfMenuBar::connectEvents(), interfMenuBar::datadir, onMirrorPressed(), onPrintLabel(), onRigidPressed(), onSpreadPressed(), and interfMenuBar::setVectorFunction().

Referenced by interfToolsMenu().

48  {
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  this->addButtons(path, nom);
73  this->setVectorFunction(funct);
74 
75  //this->setButtonName(0, wxContour_ActionCommandsID::CHANGE_TOOL);
76 
77  this->connectEvents(evtHandler);
78 
79 
80 }

Here is the call graph for this function:

Here is the caller graph for this function:

void interfMenuBar::onActionButtonPressed ( wxCommandEvent &  event)
inlineinherited

Responds to the events of the buttons, when the same panel is responsible for it. It gets the name of the button corresponding to the method that has to be executed, it uses attribute eventHandler to call the methods define by the application. see setEventHandler(wxEventHandler*)

Definition at line 180 of file interfMenuBar.h.

181  {
182  if(true)//if(eventHandler!=NULL)
183  {
184  std::string theStr = std::string( ((wxButton *)event.GetEventObject())->GetName().ToAscii());
185  const char * toolCommand = theStr.c_str();
186  event.SetId( GetId() );
187  event.SetEventObject( this );
188  event.SetClientData( (void *) toolCommand);
189  //eventHandler->ProcessEvent( event );
190  }
191  }
void interfToolsMenu::onMirrorPressed ( wxCommandEvent &  event)

Definition at line 102 of file interfToolsMenu.cxx.

References interfMainPanel::getInstance(), and interfMainPanel::onMirrorPressed().

Referenced by initButtons().

103 {
105 }

Here is the call graph for this function:

Here is the caller graph for this function:

void interfToolsMenu::onPrintLabel ( wxCommandEvent &  event)

Definition at line 107 of file interfToolsMenu.cxx.

References interfMainPanel::getInstance(), and interfMainPanel::onPrintLabel().

Referenced by initButtons().

108 {
110 }

Here is the call graph for this function:

Here is the caller graph for this function:

void interfToolsMenu::onRigidPressed ( wxCommandEvent &  event)

Responds to the events of the buttons, when the same panel is responsible for it. It gets the name of the button corresponding to the method that has to be executed, it uses attribute eventHandler to call the methods define by the application. see setEventHandler(wxEventHandler*)

Definition at line 92 of file interfToolsMenu.cxx.

References interfMainPanel::getInstance(), and interfMainPanel::onRigidPressed().

Referenced by initButtons().

Here is the call graph for this function:

Here is the caller graph for this function:

void interfToolsMenu::onSpreadPressed ( wxCommandEvent &  event)

Definition at line 97 of file interfToolsMenu.cxx.

References interfMainPanel::getInstance(), and interfMainPanel::onSpreadPressed().

Referenced by initButtons().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void interfMenuBar::setButtonName ( int  i,
const char  c 
)
inlinevirtualinherited

Sets the name of the button, this is used to relate the name of the button to a specific command int i index in the array of buttons use fuction setVectorFuncion(<vect>) to set the vector first const char name of the button see wxContour_ActionCommandsID.h to view the commands

Definition at line 167 of file interfMenuBar.h.

References interfMenuBar::vectbutton.

Referenced by interfEditMenu::initButtons().

167  {
168  if(i < (int)(vectbutton.size())){
169  std::string ac = c+"";
170  vectbutton[i]->SetName(wxString(ac.c_str(),wxConvUTF8));
171  }
172  }

Here is the caller graph for this function:

virtual void interfMenuBar::setEventHandlers ( std::vector< wxEvtHandler * >  hand)
inlinevirtualinherited

Definition at line 193 of file interfMenuBar.h.

References interfMenuBar::vecthand.

Referenced by interfNewContourMenu::initButtons().

193  {
194 
195  for(int i = 0; i < (int)(hand.size());i++){
196  vecthand.push_back(hand[i]);
197  }
198  }

Here is the caller graph for this function:

virtual void interfMenuBar::setVectorFunction ( std::vector< wxObjectEventFunction >  vectf)
inlinevirtualinherited

Sets the vector funcion, this vector must contain a function for each button created they must be ordered in the same way as the vector that contains the image path and name of the button. See addButton(<vect>, <vect>)

Definition at line 133 of file interfMenuBar.h.

References interfMenuBar::vectfunct.

Referenced by interfDeleteMenu::initButtons(), interfEditMenu::initButtons(), interfIOMenu::initButtons(), interfImageToolsMenu::initButtons(), interfSegmentationMenu::initButtons(), initButtons(), and interfNewContourMenu::initButtons().

133  {
134  for(int i = 0; i < (int)(vectf.size());i++){
135  vectfunct.push_back(vectf[i]);
136  }
137  }

Here is the caller graph for this function:

Member Data Documentation


The documentation for this class was generated from the following files: