#include <interfNewContourMenu.h>
Public Member Functions | |
interfNewContourMenu (wxWindow *parent, int sizex, int sizey, wxEvtHandler *evtHandler, std::string datadir="data/Icons") | |
~interfNewContourMenu () | |
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 | onCreateContourBullseye (wxCommandEvent &event) |
void | onCreateContourSpline (wxCommandEvent &event) |
void | onCreateContourRectangle (wxCommandEvent &event) |
void | onCreateContourCircle (wxCommandEvent &event) |
void | onCreateContourLine (wxCommandEvent &event) |
void | onCreateContourPoints (wxCommandEvent &event) |
void | onCreateContourPolygon (wxCommandEvent &event) |
Private Attributes | |
wxPanel * | panBull |
bool | created |
Definition at line 11 of file interfNewContourMenu.h.
interfNewContourMenu::interfNewContourMenu | ( | wxWindow * | parent, | |
int | sizex, | |||
int | sizey, | |||
wxEvtHandler * | evtHandler, | |||
std::string | datadir = "data/Icons" | |||
) |
Definition at line 4 of file interfNewContourMenu.cxx.
References created, interfMenuBar::datadir, initButtons(), and panBull.
00005 : interfMenuBar(parent, sizex, sizey) 00006 { 00007 this->datadir = datdir; 00008 //eventHandler = (wxContourEventHandler*)evtHandler; 00009 00010 panBull = NULL; 00011 created = false; 00012 00013 initButtons(this); 00014 }
interfNewContourMenu::~interfNewContourMenu | ( | ) |
virtual void interfMenuBar::addButtons | ( | std::vector< std::string > | vpath, | |
std::vector< std::string > | vnom | |||
) | [inline, virtual, inherited] |
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
vector | path, this parameter contains the path of the images to include in the path | |
vector | nom, this parameter contains the names corresponding to each path of image given |
Definition at line 39 of file interfMenuBar.h.
References interfMenuBar::flexsizer, interfMenuBar::getButton(), and interfMenuBar::vectbutton.
Referenced by interfToolsMenu::initButtons(), interfSegmentationMenu::initButtons(), initButtons(), interfIOMenu::initButtons(), interfImageToolsMenu::initButtons(), interfEditMenu::initButtons(), and interfDeleteMenu::initButtons().
00039 { 00040 00041 int sizex = 80; 00042 int sizey = 80; 00043 00044 //RaC 11-09 00045 //This constructor function as well but it is neccessary to change vpath.size() by 6 00046 //flexsizer = new wxFlexGridSizer(2,vpath.size(),2,2); 00047 flexsizer = new wxFlexGridSizer(6); 00048 this->SetSizer(flexsizer, true); 00049 this->SetAutoLayout( true ); 00050 00051 //first row of the sizer, the buttons are being added 00052 for(int i = 0; i < (int)(vpath.size());i++){ 00053 std::string p = vpath[i]; 00054 wxBitmapButton* bitmapbutton = this->getButton(p, sizex, sizey); 00055 flexsizer->Add(bitmapbutton,wxFIXED_MINSIZE); 00056 00057 } 00058 //second row of the sizer, the names are being added 00059 00060 for(int i = 0; i < (int)(vnom.size()); i++){ 00061 //sizex = vectbutton[i]->GetSize().GetWidth(); 00062 std::string n = vnom[i]; 00063 vectbutton[i]->SetToolTip(wxString(n.c_str(),wxConvUTF8)); 00064 //wxStaticText* statictext = getText(n, sizex, 15); 00065 //flexsizer->Add(statictext, wxEXPAND |wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTRE_HORIZONTAL|wxSHAPED); 00066 } 00067 this->Layout(); 00068 }
virtual void interfMenuBar::connectEvents | ( | ) | [inline, virtual, inherited] |
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 129 of file interfMenuBar.h.
References interfMenuBar::vectbutton, interfMenuBar::vectfunct, and interfMenuBar::vecthand.
Referenced by interfToolsMenu::initButtons(), interfSegmentationMenu::initButtons(), initButtons(), interfIOMenu::initButtons(), interfImageToolsMenu::initButtons(), interfEditMenu::initButtons(), and interfDeleteMenu::initButtons().
00129 { 00130 00131 for(int i = 0; i < (int)(vectbutton.size());i++){ 00132 Connect(vectbutton[i]->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, vectfunct[i],NULL,vecthand[i]); 00133 } 00134 }
virtual void interfMenuBar::connectEvents | ( | wxEvtHandler * | evtHandler | ) | [inline, virtual, inherited] |
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 118 of file interfMenuBar.h.
References interfMenuBar::vectbutton, and interfMenuBar::vectfunct.
00118 { 00119 00120 for(int i = 0; i < (int)(vectbutton.size());i++){ 00121 Connect(vectbutton[i]->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, vectfunct[i],NULL,evtHandler); 00122 } 00123 }
virtual wxBitmapButton* interfMenuBar::getButton | ( | std::string | imgpath, | |
int | sizex, | |||
int | sizey | |||
) | [inline, virtual, inherited] |
This method creates the button with the given image and returns it
string | imgpath is the string containing the path to the image of the button being created | |
int | x indicates the x coordinate where the button should be located | |
int | y indicates the y coordinate where the button should be located |
Definition at line 77 of file interfMenuBar.h.
References interfMenuBar::vectbutton, and interfMenuBar::vectimgpath.
Referenced by interfMenuBar::addButtons().
00077 { 00078 vectimgpath.push_back(imgpath); 00079 00080 00081 wxBitmap* bitmap = new wxBitmap(wxString(imgpath.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG); 00082 00083 //wxSize(sizex,sizey) 00084 wxBitmapButton* bitmapbutton = new wxBitmapButton(this, -1, *bitmap, wxDefaultPosition, wxDefaultSize, 00085 wxBU_AUTODRAW, wxDefaultValidator, wxString(_T(""))); 00086 00087 vectbutton.push_back(bitmapbutton); 00088 return bitmapbutton; 00089 }
virtual wxStaticText* interfMenuBar::getText | ( | std::string | nom, | |
int | sizex, | |||
int | sizey | |||
) | [inline, virtual, inherited] |
This method create the static text with the given string and returns it, it also push it back into the vector nom
string | nom text wich will be added to the statictext | |
int | sizex size of the text | |
int | sizey size of the text |
Definition at line 98 of file interfMenuBar.h.
References interfMenuBar::vectnom.
00098 { 00099 vectnom.push_back(nom); 00100 return new wxStaticText(this, -1, wxString(nom.c_str(),wxConvUTF8), wxDefaultPosition, 00101 wxSize(sizex,sizey), wxALIGN_CENTRE, wxString(nom.c_str(),wxConvUTF8)); 00102 }
void interfNewContourMenu::initButtons | ( | wxEvtHandler * | evtHandler | ) | [virtual] |
Implements interfMenuBar.
Definition at line 16 of file interfNewContourMenu.cxx.
References interfMenuBar::addButtons(), interfMenuBar::connectEvents(), interfMenuBar::datadir, onCreateContourBullseye(), onCreateContourCircle(), onCreateContourLine(), onCreateContourPoints(), onCreateContourPolygon(), onCreateContourRectangle(), onCreateContourSpline(), interfMenuBar::setEventHandlers(), and interfMenuBar::setVectorFunction().
Referenced by interfNewContourMenu().
00016 { 00017 00018 std::vector<std::string> path, nom; 00019 std::vector<wxObjectEventFunction> funct; 00020 std::vector<wxEvtHandler*> hand; 00021 00022 path.push_back(datadir + "/Spline.png"); 00023 nom.push_back("Create a contour using splines"); 00024 funct.push_back((wxObjectEventFunction)&interfNewContourMenu::onCreateContourSpline); 00025 hand.push_back(evtHandler); 00026 00027 path.push_back(datadir+"/Rectangle.png"); 00028 nom.push_back("Create a contour using the basic shape of a rectangle"); 00029 funct.push_back((wxObjectEventFunction)&interfNewContourMenu::onCreateContourRectangle); 00030 hand.push_back(evtHandler); 00031 00032 path.push_back(datadir + "/Circle.png"); 00033 nom.push_back("Create a contour using the basic shape of a Circle"); 00034 funct.push_back((wxObjectEventFunction)&interfNewContourMenu::onCreateContourCircle); 00035 hand.push_back(evtHandler); 00036 00037 path.push_back(datadir + "/bullseye.png"); 00038 nom.push_back("Create a contour using the bulls eye"); 00039 funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourBullseye); 00040 hand.push_back(this); 00041 00042 path.push_back(datadir + "/Line.png"); 00043 nom.push_back("Create a Line"); 00044 funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourLine); 00045 hand.push_back(this); 00046 00047 // RaC 09-09 --------------------- 00048 path.push_back(datadir + "/Points.png"); 00049 nom.push_back("Create Points"); 00050 funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourPoints); 00051 hand.push_back(this); 00052 // RaC 09-09 --------------------- 00053 00054 // RaC 10-09 --------------------- 00055 path.push_back(datadir + "/Polygon.png"); 00056 nom.push_back("Create Polygon"); 00057 funct.push_back((wxObjectEventFunction) &interfNewContourMenu::onCreateContourPolygon); 00058 hand.push_back(this); 00059 // RaC 10-09 --------------------- 00060 00061 this->addButtons(path, nom); 00062 00063 this->setVectorFunction(funct); 00064 this->setEventHandlers(hand); 00065 this->connectEvents(); 00066 00067 }
void interfMenuBar::onActionButtonPressed | ( | wxCommandEvent & | event | ) | [inline, inherited] |
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*)
Reimplemented in interfIOMenu.
Definition at line 155 of file interfMenuBar.h.
00156 { 00157 if(true)//if(eventHandler!=NULL) 00158 { 00159 std::string theStr = std::string( ((wxButton *)event.GetEventObject())->GetName().ToAscii()); 00160 const char * toolCommand = theStr.c_str(); 00161 event.SetId( GetId() ); 00162 event.SetEventObject( this ); 00163 event.SetClientData( (void *) toolCommand); 00164 //eventHandler->ProcessEvent( event ); 00165 } 00166 }
void interfNewContourMenu::onCreateContourBullseye | ( | wxCommandEvent & | event | ) | [private] |
This method is in charge of capturing the event when the button is clicked
Definition at line 75 of file interfNewContourMenu.cxx.
References created, interfMainPanel::getInstance(), interfMainPanel::onCreateContoursBullEye(), panBull, and interfMainPanel::showPanel().
Referenced by initButtons().
00075 { 00076 00077 00078 if(!created){ 00079 00080 panBull = new PanelBullEyeOptions(interfMainPanel::getInstance()->getInfoPanel(), 00081 wxSize(100,200)); 00082 created = true; 00083 } 00084 interfMainPanel::getInstance()->onCreateContoursBullEye(panBull); 00085 //eventHandler->createContourBullsEye(panBull); 00086 interfMainPanel::getInstance()->showPanel(panBull); 00087 00088 }
void interfNewContourMenu::onCreateContourCircle | ( | wxCommandEvent & | event | ) | [private] |
This method is in charge of capturing the event when the button is clicked
Definition at line 96 of file interfNewContourMenu.cxx.
References interfMainPanel::getInstance(), and interfMainPanel::onCreateContourCircle().
Referenced by initButtons().
00096 { 00097 interfMainPanel::getInstance()->onCreateContourCircle(); 00098 }
void interfNewContourMenu::onCreateContourLine | ( | wxCommandEvent & | event | ) | [private] |
This method is in charge of capturing the event when the button is clicked
Definition at line 99 of file interfNewContourMenu.cxx.
References interfMainPanel::getInstance(), and interfMainPanel::onCreateContourLine().
Referenced by initButtons().
00099 { 00100 interfMainPanel::getInstance()->onCreateContourLine(); 00101 }
void interfNewContourMenu::onCreateContourPoints | ( | wxCommandEvent & | event | ) | [private] |
This method is in charge of capturing the event when the button is clicked
Definition at line 104 of file interfNewContourMenu.cxx.
References interfMainPanel::getInstance(), and interfMainPanel::onCreateContourPoints().
Referenced by initButtons().
00104 { 00105 interfMainPanel::getInstance()->onCreateContourPoints(); 00106 }
void interfNewContourMenu::onCreateContourPolygon | ( | wxCommandEvent & | event | ) | [private] |
This method is in charge of capturing the event when the button is clicked RaC - Creates a new Polygon contour
Definition at line 110 of file interfNewContourMenu.cxx.
References interfMainPanel::getInstance(), and interfMainPanel::onCreateContourPolygon().
Referenced by initButtons().
00110 { 00111 interfMainPanel::getInstance()->onCreateContourPolygon(); 00112 }
void interfNewContourMenu::onCreateContourRectangle | ( | wxCommandEvent & | event | ) | [private] |
This method is in charge of capturing the event when the button is clicked
Definition at line 93 of file interfNewContourMenu.cxx.
References interfMainPanel::getInstance(), and interfMainPanel::onCreateContourRectangle().
Referenced by initButtons().
00093 { 00094 interfMainPanel::getInstance()->onCreateContourRectangle(); 00095 }
void interfNewContourMenu::onCreateContourSpline | ( | wxCommandEvent & | event | ) | [private] |
This method is in charge of capturing the event when the button is clicked
Definition at line 90 of file interfNewContourMenu.cxx.
References interfMainPanel::getInstance(), and interfMainPanel::onCreateContourSpline().
Referenced by initButtons().
00090 { 00091 interfMainPanel::getInstance()->onCreateContourSpline(); 00092 }
virtual void interfMenuBar::setButtonName | ( | int | i, | |
const char | c | |||
) | [inline, virtual, inherited] |
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 142 of file interfMenuBar.h.
References interfMenuBar::vectbutton.
Referenced by interfEditMenu::initButtons().
00142 { 00143 if(i < (int)(vectbutton.size())){ 00144 std::string ac = c+""; 00145 vectbutton[i]->SetName(wxString(ac.c_str(),wxConvUTF8)); 00146 } 00147 }
virtual void interfMenuBar::setEventHandlers | ( | std::vector< wxEvtHandler * > | hand | ) | [inline, virtual, inherited] |
Definition at line 168 of file interfMenuBar.h.
References interfMenuBar::vecthand.
Referenced by initButtons().
00168 { 00169 00170 for(int i = 0; i < (int)(hand.size());i++){ 00171 vecthand.push_back(hand[i]); 00172 } 00173 }
virtual void interfMenuBar::setVectorFunction | ( | std::vector< wxObjectEventFunction > | vectf | ) | [inline, virtual, inherited] |
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 108 of file interfMenuBar.h.
References interfMenuBar::vectfunct.
Referenced by interfToolsMenu::initButtons(), interfSegmentationMenu::initButtons(), initButtons(), interfIOMenu::initButtons(), interfImageToolsMenu::initButtons(), interfEditMenu::initButtons(), and interfDeleteMenu::initButtons().
00108 { 00109 for(int i = 0; i < (int)(vectf.size());i++){ 00110 vectfunct.push_back(vectf[i]); 00111 } 00112 }
bool interfNewContourMenu::created [private] |
Definition at line 26 of file interfNewContourMenu.h.
Referenced by interfNewContourMenu(), and onCreateContourBullseye().
std::string interfMenuBar::datadir [protected, inherited] |
Definition at line 187 of file interfMenuBar.h.
Referenced by interfToolsMenu::initButtons(), interfSegmentationMenu::initButtons(), initButtons(), interfIOMenu::initButtons(), interfImageToolsMenu::initButtons(), interfEditMenu::initButtons(), interfDeleteMenu::initButtons(), interfDeleteMenu::interfDeleteMenu(), interfEditMenu::interfEditMenu(), interfImageToolsMenu::interfImageToolsMenu(), interfIOMenu::interfIOMenu(), interfNewContourMenu(), interfSegmentationMenu::interfSegmentationMenu(), and interfToolsMenu::interfToolsMenu().
wxPanel* interfNewContourMenu::panBull [private] |
Definition at line 25 of file interfNewContourMenu.h.
Referenced by interfNewContourMenu(), and onCreateContourBullseye().