X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FInterface_Icons_NDimensions%2FinterfMenuBar.h;h=d3b054e5c13aea7218f3cbe4bead8e382dc3a009;hb=9c3e9dac7175adc08659330ec8b10233b467bd2d;hp=53b11f726cfed685c5337130f2b4e6e51162de82;hpb=89db06fc8f04c54d2cee1b07a5abe3ac7ee6cf65;p=creaContours.git diff --git a/lib/Interface_Icons_NDimensions/interfMenuBar.h b/lib/Interface_Icons_NDimensions/interfMenuBar.h index 53b11f7..d3b054e 100644 --- a/lib/Interface_Icons_NDimensions/interfMenuBar.h +++ b/lib/Interface_Icons_NDimensions/interfMenuBar.h @@ -1,6 +1,32 @@ +/*# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sant�) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ */ + #ifndef __interfMENUBARH__ #define __interfMENUBARH__ +#include #include #include #include @@ -10,7 +36,7 @@ #include //#include "interfMainPanel.h" -#include "wxContourEventHandler.h" +//#include "wxContourEventHandler.h" class interfMenuBar : @@ -40,12 +66,15 @@ public: int sizex = 80; int sizey = 80; - flexsizer = new wxFlexGridSizer(2,vpath.size(),2,2); + //RaC 11-09 + //This constructor function as well but it is neccessary to change vpath.size() by 6 + //flexsizer = new wxFlexGridSizer(2,vpath.size(),2,2); + flexsizer = new wxFlexGridSizer(5); this->SetSizer(flexsizer, true); this->SetAutoLayout( true ); - //first row of the sizer, the buttons are being added - for(int i = 0; i < vpath.size();i++){ + for(int i = 0; i < (int)(vpath.size());i++) + { std::string p = vpath[i]; wxBitmapButton* bitmapbutton = this->getButton(p, sizex, sizey); flexsizer->Add(bitmapbutton,wxFIXED_MINSIZE); @@ -53,13 +82,11 @@ public: } //second row of the sizer, the names are being added - for(int i = 0; i < vnom.size(); i++){ + for(int i = 0; i < (int)(vnom.size()); i++) + { //sizex = vectbutton[i]->GetSize().GetWidth(); - //const std::string n = vnom[i]; - wxString newstring1(vnom[i].c_str() , wxConvUTF8); - //vectbutton[i]->SetToolTip(wxString(n)); - vectbutton[i]->SetToolTip(newstring1); - + std::string n = vnom[i]; + vectbutton[i]->SetToolTip(wxString(n.c_str(),wxConvUTF8)); //wxStaticText* statictext = getText(n, sizex, 15); //flexsizer->Add(statictext, wxEXPAND |wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTRE_HORIZONTAL|wxSHAPED); } @@ -73,16 +100,14 @@ public: ** @param int y indicates the y coordinate where the button should be located **/ - virtual wxBitmapButton* getButton(std::string imgpath, int sizex, int sizey){ - vectimgpath.push_back(imgpath); - - wxString newstring1( imgpath.c_str() , wxConvUTF8); - //wxBitmap* bitmap = new wxBitmap(imgpath, wxBITMAP_TYPE_PNG); - wxBitmap* bitmap = new wxBitmap(newstring1, wxBITMAP_TYPE_PNG); - + virtual wxBitmapButton* getButton(std::string imgpath, int sizex, int sizey) + { + vectimgpath.push_back(imgpath); + wxBitmap* bitmap = new wxBitmap(wxString(imgpath.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG); + //wxSize(sizex,sizey) wxBitmapButton* bitmapbutton = new wxBitmapButton(this, -1, *bitmap, wxDefaultPosition, wxDefaultSize, - wxBU_AUTODRAW, wxDefaultValidator, _T("")); + wxBU_AUTODRAW, wxDefaultValidator, wxString(_T(""))); vectbutton.push_back(bitmapbutton); return bitmapbutton; @@ -95,20 +120,21 @@ public: ** @param int sizex size of the text ** @param int sizey size of the text **/ - virtual wxStaticText* getText(std::string nom, int sizex, int sizey){ + virtual wxStaticText* getText(std::string nom, int sizex, int sizey) + { vectnom.push_back(nom); - wxString newstring1(nom.c_str() , wxConvUTF8); - return new wxStaticText(this, -1, newstring1 /*wxString(nom)*/, wxDefaultPosition, - //wxSize(sizex,sizey), wxALIGN_CENTRE, wxString(nom)); - wxSize(sizex,sizey), wxALIGN_CENTRE, newstring1); + return new wxStaticText(this, -1, wxString(nom.c_str(),wxConvUTF8), wxDefaultPosition, + wxSize(sizex,sizey), wxALIGN_CENTRE, wxString(nom.c_str(),wxConvUTF8)); } /** ** 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(, ) **/ - virtual void setVectorFunction(std::vector vectf){ - for(int i = 0; i < vectf.size();i++){ + virtual void setVectorFunction(std::vector vectf) + { + for(int i = 0; i < (int)(vectf.size());i++) + { vectfunct.push_back(vectf[i]); } } @@ -119,7 +145,7 @@ public: **/ virtual void connectEvents(wxEvtHandler* evtHandler){ - for(int i = 0; i < vectbutton.size();i++){ + for(int i = 0; i < (int)(vectbutton.size());i++){ Connect(vectbutton[i]->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, vectfunct[i],NULL,evtHandler); } } @@ -130,7 +156,7 @@ public: **/ virtual void connectEvents(){ - for(int i = 0; i < vectbutton.size();i++){ + for(int i = 0; i < (int)(vectbutton.size());i++){ Connect(vectbutton[i]->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, vectfunct[i],NULL,vecthand[i]); } } @@ -142,8 +168,9 @@ public: ** @params const char name of the button see wxContour_ActionCommandsID.h to view the commands **/ virtual void setButtonName(int i, const char c){ - if(i < vectbutton.size()){ - vectbutton[i]->SetName(c); + if(i < (int)(vectbutton.size())){ + std::string ac = c+""; + vectbutton[i]->SetName(wxString(ac.c_str(),wxConvUTF8)); } } @@ -155,20 +182,20 @@ public: **/ void onActionButtonPressed( wxCommandEvent& event ) { - if(eventHandler!=NULL) + if(true)//if(eventHandler!=NULL) { std::string theStr = std::string( ((wxButton *)event.GetEventObject())->GetName().ToAscii()); const char * toolCommand = theStr.c_str(); event.SetId( GetId() ); event.SetEventObject( this ); event.SetClientData( (void *) toolCommand); - eventHandler->ProcessEvent( event ); + //eventHandler->ProcessEvent( event ); } } virtual void setEventHandlers(std::vector hand){ - for(int i = 0; i < hand.size();i++){ + for(int i = 0; i < (int)(hand.size());i++){ vecthand.push_back(hand[i]); } } @@ -184,7 +211,7 @@ private: wxFlexGridSizer* flexsizer; protected: - wxEvtHandler* eventHandler; + //wxEvtHandler* eventHandler; std::string datadir;