From b2ac7f59e78e33f8e11065cffa2f2072aa9a9ee5 Mon Sep 17 00:00:00 2001 From: Diego Caceres Date: Tue, 6 Jan 2015 15:25:00 +0100 Subject: [PATCH] commit --- .../bbcreaMaracasVisuPanelButtonContainer.cxx | 14 +- .../bbcreaMaracasVisuPanelButtonContainer.h | 2 + .../model/containerSettings.cxx | 120 ++++++++++++++++- .../model/containerSettings.h | 24 ++++ .../model/listGroupFactory.cxx | 97 ++++++++++++++ .../model/listGroupFactory.h | 123 ++++++++++++++++++ .../model/structBCSettings.h | 4 + .../creaButtonContainer/model/system.h | 30 ++++- .../view/buttonContainerPanel.cxx | 31 ++++- .../view/buttonContainerPanel.h | 15 ++- .../creaButtonContainer/view/listGroup.cxx | 70 ++++++++++ .../creaButtonContainer/view/listGroup.h | 122 +++++++++++++++++ .../creaButtonContainer/view/listWx.cxx | 62 +++++++++ .../widgets/creaButtonContainer/view/listWx.h | 78 +++++++++++ .../buttonContainerSettings.cxx | 72 ++++++++++ .../buttonContainerSettings.h | 27 ++++ .../creaPanelButtonContainer.cxx | 6 +- .../creaPanelButtonContainer.h | 2 +- .../structBCPSettings.h | 6 + 19 files changed, 888 insertions(+), 17 deletions(-) create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/listGroupFactory.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/listGroupFactory.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listGroup.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listGroup.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.h diff --git a/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.cxx b/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.cxx index fc31b69..76119b7 100644 --- a/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.cxx +++ b/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.cxx @@ -42,8 +42,18 @@ PanelButtonContainer::Process( ) { ButtonContainerSettings* settings = new ButtonContainerSettings( ); printf("EED PanelButtonContainer::Process %d\n", bbGetInputIn( ).size() ); - settings->AddButtons( bbGetInputIn( ) ); - PBContainer* panel = new PBContainer( myPanel, settings ); + + if(bbGetInputType()== "1") + { + settings->AddItems(bbGetInputIn()); + + } + else { + settings->AddButtons(bbGetInputIn( )); + } + + + PBContainer* panel = new PBContainer( myPanel, settings, bbGetInputType() ); wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL ); sizer->Add( panel, 1, wxEXPAND, 0 ); this->myPanel->SetSizer(sizer); diff --git a/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.h b/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.h index bbf30e6..3d59055 100644 --- a/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.h +++ b/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.h @@ -51,6 +51,7 @@ class bbcreaMaracasVisu_EXPORT PanelButtonContainer //===== BBTK_DECLARE_INPUT(Title,std::string); BBTK_DECLARE_INPUT(In,BCStructVectorType); + BBTK_DECLARE_INPUT(Type,std::string); BBTK_PROCESS(Process); void Process(); BBTK_CREATE_WIDGET(CreateWidget); @@ -70,6 +71,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(PanelButtonContainer,bbtk::WxBlackBox); BBTK_INPUT(PanelButtonContainer,Title,"Title prepended to the text",std::string,""); BBTK_INPUT(PanelButtonContainer,In,"ButtonContainerSettings List",BCStructVectorType,""); + BBTK_INPUT(PanelButtonContainer,Type,"Type container",std::string,""); BBTK_END_DESCRIBE_BLACK_BOX(PanelButtonContainer); //===== diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx index d3f4269..6779dd3 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx @@ -60,7 +60,7 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- void - ContainerSettings::SetButtonGroupContainer( ButtonGroupMap bgContainer ) + ContainerSettings::SetButtonGroupContainer(ButtonGroupMap bgContainer) { this->m_ButtonGroupContainer = bgContainer; } @@ -71,12 +71,32 @@ namespace creaButtonContainer this->m_GroupNameList = gNameList; } + // ---------------------------------------------------------------------------------- + + ListGroupMap + ContainerSettings::GetListGroupContainer( ) + { + return ( this->m_ListGroupContainer ); + } + + void + ContainerSettings::SetListGroupContainer( ListGroupMap lstContainer ) + { + this->m_ListGroupContainer = lstContainer; + } + + // ---------------------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- void ContainerSettings::AddButton( const StringType & groupName, const StringType &buttonName, const wxBitmap &icon, const StringType &buttonDescription, FunctionEventType event ) { + std::cout<< std::endl<<"MLER CLASS : ContainerSettings" << std::endl; + std::cout<< std::endl<<"MLER ContainerSettings // AddButton "<m_ButtonGroupContainer[ groupName ].push_back( pair ); return; }//fi @@ -150,6 +172,102 @@ namespace creaButtonContainer << "exception: " << e.what( ) << std::endl; }//hctac } + + void + ContainerSettings::AddItems(BCStructVectorType infoList) + { + try + { + for( BCStructVectorType::iterator it = infoList.begin( ); it + != infoList.end( ); ++it ) + { + this->AddItem(*it); + }//rof + }//yrt + catch ( const std::exception& e ) + { + std::cerr + << "ContainerSettings::AddButtons( BCStructVectorType infoList ) " + << "exception: " << e.what( ) << std::endl; + }//hctac + } + //----------------------------------------------------------------------------------- + void + ContainerSettings::AddItem(const StringType & groupName) + { + + //Es importante hacer un test, recibiendo como parametro la info de un item. + + + wxListItem* item; + item->SetId(1); + item->SetText(wxT("monica")); + + creaButtonContainer::view::ListWx l; + l.setItems(item); + + + try + { + for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); + it!= this->m_GroupNameList.end( ); ++it ) + { + if(( *it ).compare( groupName ) == 0 ) + { + this->m_ListGroupContainer[ groupName ].push_back(l); + return; + } + } + this->m_GroupNameList.push_back( groupName ); + this->m_ListGroupContainer[ groupName ].push_back( l ); + } + catch ( const std::exception& e ) + { + std::cerr + << "ContainerSettings::AddButton( const std::string & groupName," + << "const std::string buttonName, const std::string iconpath," + << "const std::string buttonDescription, FunctionEventType event ) exception: " + << e.what( ) << std::endl; + }//hctac + } + + + void + ContainerSettings::AddItem( BCSettingsStruct* info ) + { + wxListItem* item; + + wxString myString((info->buttonName).c_str(),wxConvUTF8); + item->SetText(myString); + + creaButtonContainer::view::ListWx l; + l.setItems(item); + + try + { + for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it + != this->m_GroupNameList.end( ); ++it ) + { + if ( ( *it ).compare( info->groupName ) == 0 ) + { + this->m_ListGroupContainer[ info->groupName ].push_back( l ); + return; + }//fi + }//rof + this->m_GroupNameList.push_back( info->groupName ); + this->m_ListGroupContainer[ info->groupName ].push_back( l ); + } + catch (const std::exception& e) + { + std::cerr + << "void ContainerSettings::AddItem( BCSettingsStruct* info ) " + << "exception: " << e.what( ) << std::endl; + } + + } + + + // ---------------------------------------------------------------------------------- }//ecapseman }//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h index cb5a4f5..d00db70 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h @@ -35,6 +35,7 @@ #include #include +#include #include "structBCSettings.h" #include "system.h" @@ -42,6 +43,8 @@ /*! @namespace * @brief Contains the creaButtonContainer library included in creaMaracasVisu. */ + + namespace creaButtonContainer { /*! @namespace @@ -112,6 +115,13 @@ namespace creaButtonContainer void SetGroupNameList( KeyMapList gNameList ); + ListGroupMap + GetListGroupContainer( ); + + void + SetListGroupContainer( ListGroupMap lstContainer ); + + // ---------------------------------------------------------------------------------- /*! * @fn ContainerSettings::AddButton( const std::string & groupName, const std::string buttonName, @@ -147,10 +157,24 @@ namespace creaButtonContainer */ void AddButtons( BCStructVectorType infoList ); + + // ---------------------------------------------------------------------------------- + void + AddItem(const StringType & groupName); + + void + AddItem( BCSettingsStruct* info ); + + void + AddItems( BCStructVectorType infoList ); + + // ---------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------- private: ButtonGroupMap m_ButtonGroupContainer; //! GetListGroupContainer( ); + for( ListGroupMap::iterator it = map.begin( ); it != map.end( ); ++it ) + { + wxString groupNameAux( ( *it ).first.c_str( ), wxConvUTF8 );//nombre grupo + wxStaticText* wxGroupName = new wxStaticText( parent, -1, groupNameAux, wxDefaultPosition, wxDefaultSize, 0, _T("GroupText") ); + ListGroup* group = new ListGroup( wxGroupName, this->GetList( parent, ( *it ).second ) ); + //ListGroup* group; + groupView.push_back( group ); + }//rof + }//yrt + catch ( const std::exception& e ) + { + std::cerr + << "ListGroupFactory::CreateListGroupContainer( wxWindow* parent, ListModel* settings )" + << " exception: " << e.what( ) << std::endl; + }//chtac + return ( groupView ); + } + + + // ---------------------------------------------------------------------------------- + ListGroupFactory::ListContainer ListGroupFactory::GetList( wxWindow* parent, tlist lst ) + { + ListContainer cList; + + try + { + /*List list = new List(parent,items); + + cList.push_back(list); + //return ( buttonList ); // JPR*/ + }//yrt + catch ( const std::exception& e ) + { + std::cerr + << "ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel )" + << "exception: " << e.what( ) << std::endl; + }//chtac + + return ( cList ); // JPR + } + // ---------------------------------------------------------------------------------- + }//ecapseman +}//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/listGroupFactory.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/listGroupFactory.h new file mode 100644 index 0000000..7e137bd --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/listGroupFactory.h @@ -0,0 +1,123 @@ +/*# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ */ + +/*! + * @file buttonGroupFactory.h + * @brief Contains ButtonGroupFactory class + * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * @date 2011-06-02 + */ + +#ifndef LISTGROUPFACTORY_H +#define LISTGROUPFACTORY_H + +#include +#include + +#include "listWx.h" +#include "system.h" +#include "listGroup.h" +#include "containerSettings.h" + +/*! @namespace + * @brief Contains the creaButtonContainer library included in creaMaracasVisu. + */ +namespace creaButtonContainer +{ + /*! @namespace + * @brief Contains the implementation of the model in creaButtonContainer library. + * @see MVC Software Architecture + */ + namespace model + { + /*! @class ButtonGroupFactory buttonGroupFactory.h "buttonGroupFactory.h" + * @brief This class contains the ButtonGroup factory. + * @details This class creates a container of group of buttons. + * @see Factory Pattern + */ + class ListGroupFactory + { + public: + + typedef creaButtonContainer::view::ListWx List; + + typedef creaButtonContainer::view::ListGroup ListGroup; + // ---------------------------------------------------------------------------------- + /*! @typedef creaButtonContainer::model::ContainerSettings ButtonGroupModel; + * @brief Defines the ButtonGroupModel type. + */ + typedef creaButtonContainer::model::ContainerSettings ListModel; + // ---------------------------------------------------------------------------------- + /*! @typedef std::list< ButtonGroup* > ButtonGroupContainer; + * @brief Defines the ButtonGroupContainer type. + */ + typedef std::list< ListGroup* > ListGroupContainer; + // ---------------------------------------------------------------------------------- + /*! @typedef std::map< long, Button* > ButtonContainer; + * @brief Defines the ButtonContainer type. + */ + typedef std::list ListContainer; + + // ---------------------------------------------------------------------------------- + //end of typedef definition + public: + /*! @fn ListGroupFactory::ListGroupFactory( ); + * @brief This is the default constructor. + */ + ListGroupFactory( ); + // ------------------------------------------------------------------------------- + /*! @fn virtual ButtonGroupFactory::~ButtonGroupFactory( ); + * @brief This is the destructor. + */ + virtual + ~ListGroupFactory( ); + + /*! @fn ButtonGroupContainer ListGroupFactory::CreateListContainer( wxWindow* parent, ButtonGroupModel* settings ); + * @brief This method creates the ButtonGroupContainer. + * @param parent the wxWindow* parent to be attached. + * @param settings The Container settings. + * @exception std::bad_alloc + * @return ButtonGroupContainer The wx button group container. + */ + ListGroupContainer + CreateListGroupContainer( wxWindow* parent, + ListModel* settings ); + private: + + + /*! @fn ButtonContainer ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel ); + * @brief This method creates a wx button container for a group. + * @param parent the wxWindow* parent to be attached. + * @param buttonModel The button list with its own information. + * @exception std::bad_alloc + * @return ButtonContainer The wx button container. + */ + ListGroupContainer + GetList( wxWindow* parent, ListWx lst ); + }; + }//ecapseman +}//ecapseman + +#endif // CARTOBUTTONFACTORY_H diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/structBCSettings.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/structBCSettings.h index 80cda32..de3a304 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/structBCSettings.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/structBCSettings.h @@ -57,6 +57,10 @@ namespace creaButtonContainer BitmapType icon; //! + StringType itemsList; }; } //ecapseman } //ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h index ab863ea..9481b66 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h @@ -39,13 +39,27 @@ #include #include #include "functor.h" -#include "wx/bitmap.h" +#include +#include + /*! @namespace * @brief Contains the creaButtonContainer library included in creaMaracasVisu. */ + +/*namespace creaButtonContainer +{ + namespace view + { + typedef std::list< ListWx* > ListLst; + typedef std::map< StringType, ListLst > ListGroupMap; // ex: grupo A,lista A,lista B + } + + +}*/ namespace creaButtonContainer { + using namespace view; // ---------------------------------------------------------------------------------- /*! @typedef std::string* StringType; * @brief Defines the StringType type. @@ -97,7 +111,19 @@ namespace creaButtonContainer * @brief Defines the ButtonGroupMap type. */ typedef std::map< StringType, ButtonList > ButtonGroupMap; + + + + //typedef wxListItem* Item; //lista objeto + //typedef std::list< Item > ItemsList; //lista de los objetos lista + //typedef std::list Lista; + //typedef std::map< StringType, ItemsList > ListGroupMap; // ex: grupo A,items lista A (la lista de ese grupo) + + + typedef std::list< ListWx > ListLst; + typedef std::map< StringType, ListLst > ListGroupMap; // ex: grupo A,lista A,lista B + + // ---------------------------------------------------------------------------------- } - #endif /* SYSTEM_H_ */ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.cxx index a66eb51..aaeae8c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.cxx @@ -42,12 +42,15 @@ namespace creaButtonContainer END_EVENT_TABLE() // ---------------------------------------------------------------------------------- - ButtonContainerPanel::ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings ) + ButtonContainerPanel::ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings, std::string type ) : wxScrolledWindow(parent,-1, wxDefaultPosition,wxDefaultSize, wxTAB_TRAVERSAL | wxVSCROLL | wxHSCROLL | wxFULL_REPAINT_ON_RESIZE, _T("creaButtonContainer") ) { + + std::cout<< std::endl << " MLER buttonContainerPanel.cxx / ButtonContainerPanel() " << std::endl; + ButtonGroupFactory factory; this->SetGroupContainer( factory.CreateButtonGroupContainer( this, settings ) ); - this->PanelInit( ); + this->PanelInit(type ); this->m_ButtonCController = new BCController( this ); this->m_ButtonCController->AddEvents( ); this->SetEventHandler( this->m_ButtonCController ); @@ -65,19 +68,33 @@ namespace creaButtonContainer } // ---------------------------------------------------------------------------------- - void ButtonContainerPanel::PanelInit( ) + void ButtonContainerPanel::PanelInit( std::string type ) { try { // EED 20/01/2012 flag 01 this->m_Sizer = new Sizer( 0, 1, 0, 0 ); - for( ButtonGroupList::iterator it = this->m_ButtonGroupList.begin( ); it != this->m_ButtonGroupList.end( ); ++it ) + + if(type == "1") { - GroupManager* manager = new GroupManager( this, *it ); - this->m_GroupManagerList[ manager->GetButtonID( ) ] = manager; - this->m_Sizer->Add( manager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); + for( ButtonGroupList::iterator it = this->m_ButtonGroupList.begin( ); it != this->m_ButtonGroupList.end( ); ++it ) + { + GroupManager* manager = new GroupManager( this, *it ); + this->m_GroupManagerList[ manager->GetButtonID( ) ] = manager; + this->m_Sizer->Add( manager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); + } } + else + { + for( ButtonGroupList::iterator it = this->m_ButtonGroupList.begin( ); it != this->m_ButtonGroupList.end( ); ++it ) + { + GroupManager* manager = new GroupManager( this, *it ); + this->m_GroupManagerList[ manager->GetButtonID( ) ] = manager; + this->m_Sizer->Add( manager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); + } + } + this->SetSizer( this->m_Sizer ); this->Layout( ); this->FitSizer( ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h index 2a7349b..988fbc2 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h @@ -46,6 +46,8 @@ #include "buttonGroupFactory.h" #include "containerSettings.h" #include "buttonContainerController.h" +#include "listGroup.h" +#include "listGroupFactory.h" /*! @namespace * @brief Contains the creaButtonContainer library included in creaMaracasVisu. @@ -130,6 +132,13 @@ namespace creaButtonContainer */ typedef creaButtonContainer::controller::ButtonContainerController BCController; + + typedef creaButtonContainer::view::ListGroup ListGroup; + + typedef std::list< ListGroup* > ListGroupList; + + typedef creaButtonContainer::model::ListGroupFactory ListGroupFactory; + // ---------------------------------------------------------------------------------- //end of typedef definition public: @@ -138,7 +147,7 @@ namespace creaButtonContainer * @param parent wxWindow pointer to parent. * @param settings ButtonGroupSettings Pointer to button container settings. */ - ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings ); + ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings, std::string type ); // ---------------------------------------------------------------------------------- /*! @fn ~ButtonContainerPanel( ); * @brief This is the destructor. @@ -158,7 +167,7 @@ namespace creaButtonContainer * @exception std::bad_alloc */ void - PanelInit( ); + PanelInit( std::string type); // ---------------------------------------------------------------------------------- /*! @fn FitSizer( ); * This method fits and organizes the sizer. @@ -173,6 +182,8 @@ namespace creaButtonContainer ButtonGroupList m_ButtonGroupList; //!m_GroupName = groupName; + this->m_List = list; + } + + // ---------------------------------------------------------------------------------- + ListGroup::~ListGroup( ) + { + } + + // ---------------------------------------------------------------------------------- + ListGroup::ListContainer + ListGroup::GetListContainer( ) + { + return ( this->m_List ); + } + + // ---------------------------------------------------------------------------------- + wxStaticText* + ListGroup::GetGroupName( ) + { + return ( this->m_GroupName ); + } + + // ---------------------------------------------------------------------------------- + + + // ---------------------------------------------------------------------------------- + }//ecapseman +}//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listGroup.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listGroup.h new file mode 100644 index 0000000..209d09c --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listGroup.h @@ -0,0 +1,122 @@ +/*# --------------------------------------------------------------------- +# +# 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. +# ------------------------------------------------------------------------ */ + +/*! + * @file buttonGroup.h + * @brief This contains the ButtonGroup class. + * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * @date 2011-06-02 + */ + +#ifndef LISTGROUP_H +#define LISTGROUP_H + +//Library Definition +#include + +#include +#include +#include + +#include "listWx.h" + +/*! @namespace + * @brief Contains the creaButtonContainer library included in creaMaracasVisu. + */ +namespace creaButtonContainer +{ + /*! @namespace + * @brief Contains the implementation of the view in creaButtonContainer library. + * @see MVC Software Architecture + */ + namespace view + { + /*! @class ButtonGroup buttonGroup.h "buttonGroup.h" + * @brief This class contains the group of buttons. + */ + class ListGroup + { + public: + //Typedef definition + // ---------------------------------------------------------------------------------- + /*! @typedef creaButtonContainer::view::Button Button; + * @brief Defines the Button type. + */ + typedef creaButtonContainer::view::ListWx List; + // ---------------------------------------------------------------------------------- + /*! @typedef std::map< long, Button* > ButtonContainer; + * @brief Defines the ButtonContainer type. + */ + typedef std::list< ListWx* > ListContainer; + // ---------------------------------------------------------------------------------- + + + public: + // ---------------------------------------------------------------------------------- + /*! @fn ButtonGroup( wxStaticText* groupName, ButtonContainer buttons ); + * @brief This is the parameterized constructor. + * @param groupName wxStatigText* with the name of the group. + * @param buttons A container with buttons. + */ + ListGroup( wxStaticText* groupName, ListContainer lists ); + // ---------------------------------------------------------------------------------- + /*! @fn ~ButtonGroup( ); + * @brief This is the destructor. + */ + virtual + ~ListGroup( ); + + // ---------------------------------------------------------------------------------- + /*! @fn GetButtonContainer( ); + * @brief This method returns the button container. + * @exception std::bad_alloc + * @return ButtonContainer. + */ + ListContainer + GetListContainer( ); + // ---------------------------------------------------------------------------------- + /*! @fn GetButtonIdContainer( ); + * @brief This method returns a list of button IDs. + * @exception std::bad_alloc + * @return + */ + // IdListContainer + // GetListIdContainer( ); + // ---------------------------------------------------------------------------------- + /*! @fn GetGroupName( ); + * @brief This method returns the name of the group. + * @return + */ + wxStaticText* + GetGroupName( ); + // ---------------------------------------------------------------------------------- + private: + wxStaticText* m_GroupName; //!m_items = items; + lstCtrl->InsertItem(0,(*items.front()).GetText()); + } + + //------------------------------------------------------- + + tList::~tList( ) + { + } + + //------------------------------------------------------- + + ItemsList getItems() const + { + return m_items; + } + + void setItems(ItemsList items) + { + m_items = items; + } + + + + } + +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.h new file mode 100644 index 0000000..472875c --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.h @@ -0,0 +1,78 @@ +/*# --------------------------------------------------------------------- +# +# 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 LISTWX_H_ +#define LISTWX_H_ + +#include +#include +#include + +#include + +#include "system.h" + +/*! @namespace + * @brief Contains the creaButtonContainer library included in creaMaracasVisu. + */ +namespace creaButtonContainer +{ + /*! @namespace + * @brief Contains the implementation of the view in creaButtonContainer library. + * @see MVC Software Architecture + */ + namespace view + { + class ListWx : wxListCtrl + { + public : + + typedef wxListItem* Item; + typedef std::list< Item > ItemsList; //lista de los objetos lista + + public : + + ListWx(); + ListWx( wxWindow* parent, ItemsList items ); + + virtual + ~ListWx(); + + ItemsList const + getItems (); + + void + setItems(Item i); + + private : + + ItemsList m_items; + + }; + } +} + +#endif /* LISTWX_H_ */ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx index f8cd8f3..2ca8d8d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx @@ -62,9 +62,14 @@ namespace creaPanelButtonContainer { try { + std::cout<<"MLER ButtonContainerSettings // GetPanelButton "<m_GroupNameList.begin( ); it != this->m_GroupNameList.end( ); ++it ) { + + std::cout<< std::endl<<"MLER ButtonContainerSettings // GetPanelButton :: it "<< *it<m_ButtonGroupContainer[ ( *it ) ]; for( ButtonList::iterator it1 = list.begin( ); it1 != list.end( ); ++it1 ) { @@ -90,11 +95,17 @@ namespace creaPanelButtonContainer ButtonGroupSettings* settings = NULL; try { + std::cout<< std::endl<<"MLER CLASS : ButtonContainerSettings" << std::endl; + std::cout<< std::endl<<"MLER ButtonContainerSettings // GetButtonGroupSettings "<m_GroupNameList.begin( ); it != this->m_GroupNameList.end( ); ++it ) { ButtonList list = this->m_ButtonGroupContainer[ ( *it ) ]; + + std::cout<<"MLER ButtonContainerSettings // GetButtonGroupSettings :: it "<< *it<AddButton( ( *it ), ( *it1 )->first->first, ( *it1 )->first->second, ( *it1 )->second->first, functor ); @@ -131,6 +142,8 @@ namespace creaPanelButtonContainer { try { + std::cout<< std::endl<<"MLER ButtonContainerSettings // AddButton"<panel == NULL) + { + std::cerr + << "ButtonContainerSettings::AddItem" + << "exception: NULL Pointer in panel" << std::endl; + exit(1); + } + + wxListItem item; + wxString myString((info->buttonName).c_str(),wxConvUTF8); + item.SetText(myString); + + try + { + for(KeyMapList::iterator it = this->m_GroupNameList.begin( ); it + != this->m_GroupNameList.end( ); ++it ) + { + if((*it).compare(info->groupName) == 0) + { + this->m_ListGroupContainer[info->groupName].push_back(item); + return; + } + }//rof + this->m_GroupNameList.push_back(info->groupName); + this->m_ListGroupContainer[info->groupName].push_back(item); + + }//yrt + catch ( const std::exception& e ) + { + std::cerr + << "ContainerSettings::AddButtons( BCStructVectorType infoList ) " + << "exception: " << e.what( ) << std::endl; + }//hctac + } + + void + ButtonContainerSettings::AddItems(BCStructVectorType infoList) + { + try + { + for( BCStructVectorType::iterator it = infoList.begin( ); it + != infoList.end( ); ++it ) + { + this->AddItem(*it); + }//rof + }//yrt + catch ( const std::exception& e ) + { + std::cerr + << "ContainerSettings::AddButtons( BCStructVectorType infoList ) " + << "exception: " << e.what( ) << std::endl; + }//hctac + } + + // ---------------------------------------------------------------------------------- }//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h index a502b9a..cdb3207 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -45,6 +46,7 @@ #include "containerSettings.h" #include "functor.h" + /*! @namespace * @brief Contains the creaPanelButtonContainer library included in creaMaracasVisu. */ @@ -123,6 +125,12 @@ namespace creaPanelButtonContainer /*! @class ButtonContainerSettings buttonContainerSettings.h "buttonContainerSettings.h" * @brief This class contains the settings of the button container. */ + + typedef wxListItem Item; + typedef std::list < tList* > ItemsList; + typedef std::map< StringType, ListLst > ListGroupMap; + + public: // ---------------------------------------------------------------------------------- /*! @fn ButtonContainerSettings( ); @@ -173,6 +181,16 @@ namespace creaPanelButtonContainer * @brief This method sets the button group container. * @param bGroupContainer */ + + // ---------------------------------------------------------------------------------- + + ButtonGroupSettings* + GetListGroupSettings(); + + // ---------------------------------------------------------------------------------- + + + void SetButtonGroupContainer( ButtonGroupMap bGroupContainer ); // ---------------------------------------------------------------------------------- @@ -217,10 +235,19 @@ namespace creaPanelButtonContainer */ void AddButtons( BCStructVectorType infoList ); + + void + AddItem (BCPSettingsStruct* info); + + void + AddItems( BCStructVectorType infoList ); + // ---------------------------------------------------------------------------------- private: ButtonGroupMap m_ButtonGroupContainer; //! TConcreteFunctor; // ---------------------------------------------------------------------------------- - PanelButtonContainer::PanelButtonContainer( wxWindow* parent, ButtonContainerSettings* bcSettings ) + PanelButtonContainer::PanelButtonContainer( wxWindow* parent, ButtonContainerSettings* bcSettings, std::string type ) : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("creaPanelButtonContainer") ) { + std::cout<< std::endl << " MLER creaPanelButtonContainer.cxx / PanelButtonContainer() " << std::endl; + this->m_ButtonContainerSettings = bcSettings; this->m_ButtonPanel = new wxPanel( this ); @@ -53,7 +55,7 @@ namespace creaPanelButtonContainer // TConcreteFunctor* functor = new TConcreteFunctor( this->m_ButtonPanel, &PanelButtonContainer::GenericButtonEvent ); //end of the event definition - this->m_ButtonContainerPanel = new ButtonContainerPanel( this, this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ) ); + this->m_ButtonContainerPanel = new ButtonContainerPanel( this, this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ),type ); //Using AuiManager to Manage the Panels this->m_AuiManager = new wxAuiManager( this, wxAUI_MGR_DEFAULT ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h index 9b752a6..deb2134 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h @@ -76,7 +76,7 @@ namespace creaPanelButtonContainer * @param bcSettings //The buttonContainerSettings */ PanelButtonContainer( wxWindow* parent, - ButtonContainerSettings* bcSettings ); + ButtonContainerSettings* bcSettings, std::string type ); // ---------------------------------------------------------------------------------- /*! @fn virtual PanelButtonContainer( ); * @brief This is the destructor. diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/structBCPSettings.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/structBCPSettings.h index 6802a24..4868154 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/structBCPSettings.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/structBCPSettings.h @@ -36,6 +36,7 @@ #include #include #include +#include "tlist.h" /*! @namespace * @brief Contains the creaPanelButtonContainer library included in creaMaracasVisu. @@ -53,6 +54,11 @@ namespace creaPanelButtonContainer wxBitmap icon; //! + std::string itemsList; + }; } #endif //STRUCTBCPSETTINGS_H_ -- 2.45.2