creaContours_lib
interfDeleteMenu Class Reference

#include <interfDeleteMenu.h>

Inheritance diagram for interfDeleteMenu:
Collaboration diagram for interfDeleteMenu:

Public Member Functions

 interfDeleteMenu (wxWindow *parent, int sizex, int sizey, wxEvtHandler *evtHandler, std::string datdir="data/Icons")
 
 ~interfDeleteMenu ()
 
virtual void initButtons (wxEvtHandler *evtHandler)
 
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
 

Private Member Functions

void onDeleteContour (wxCommandEvent &event)
 
void onDeleteContoursActSlice (wxCommandEvent &event)
 
void onDeleteAllContours (wxCommandEvent &event)
 

Detailed Description

Definition at line 33 of file interfDeleteMenu.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file interfDeleteMenu.cxx.

References interfMenuBar::datadir, and initButtons().

29  : interfMenuBar(parent, sizex, sizey)
30 {
31  this->datadir = datdir;
32  initButtons(this);
33 }

Here is the call graph for this function:

interfDeleteMenu::~interfDeleteMenu ( )

Definition at line 59 of file interfDeleteMenu.cxx.

60 {
61 }

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 initButtons(), interfEditMenu::initButtons(), interfIOMenu::initButtons(), interfSegmentationMenu::initButtons(), interfImageToolsMenu::initButtons(), interfToolsMenu::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 initButtons(), interfEditMenu::initButtons(), interfIOMenu::initButtons(), interfSegmentationMenu::initButtons(), interfImageToolsMenu::initButtons(), interfToolsMenu::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 interfDeleteMenu::initButtons ( wxEvtHandler *  evtHandler)
virtual

Implements interfMenuBar.

Definition at line 35 of file interfDeleteMenu.cxx.

References interfMenuBar::addButtons(), interfMenuBar::connectEvents(), interfMenuBar::datadir, onDeleteAllContours(), onDeleteContour(), onDeleteContoursActSlice(), and interfMenuBar::setVectorFunction().

Referenced by interfDeleteMenu().

35  {
36 
37  std::vector<std::string> path, nom;
38  std::vector<wxObjectEventFunction> funct;
39 
40  path.push_back(datadir + "/DeleteContour.png");
41  nom.push_back("Delete the selected contour");
42  funct.push_back((wxObjectEventFunction)&interfDeleteMenu::onDeleteContour);
43 
44  path.push_back(datadir + "/DeleteAllContourSlide.png");
45  nom.push_back("Delete all contours in the current slide");
46  funct.push_back((wxObjectEventFunction)&interfDeleteMenu::onDeleteContoursActSlice);
47 
48  path.push_back(datadir + "/DeleteAll.png");
49  nom.push_back("Delete all contours in all slides");
50  funct.push_back((wxObjectEventFunction)&interfDeleteMenu::onDeleteAllContours);
51 
52  this->addButtons(path, nom);
53 
54  this->setVectorFunction(funct);
55  this->connectEvents(evtHandler);
56 
57 }

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 interfDeleteMenu::onDeleteAllContours ( wxCommandEvent &  event)
private

Definition at line 70 of file interfDeleteMenu.cxx.

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

Referenced by initButtons().

Here is the call graph for this function:

Here is the caller graph for this function:

void interfDeleteMenu::onDeleteContour ( wxCommandEvent &  event)
private

This methods are in charge of responding to the events of button click by the delete panel wxCommandEvent& the event that call the function

Definition at line 64 of file interfDeleteMenu.cxx.

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

Referenced by initButtons().

Here is the call graph for this function:

Here is the caller graph for this function:

void interfDeleteMenu::onDeleteContoursActSlice ( wxCommandEvent &  event)
private

Definition at line 67 of file interfDeleteMenu.cxx.

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

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 initButtons(), interfEditMenu::initButtons(), interfIOMenu::initButtons(), interfSegmentationMenu::initButtons(), interfImageToolsMenu::initButtons(), interfToolsMenu::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: