From 4518d93a0a51221812cfb6d783f8e7f4fd77b498 Mon Sep 17 00:00:00 2001 From: monica Date: Wed, 14 Jan 2015 11:26:53 +0100 Subject: [PATCH] #2502 creaMaracasVisu Feature New Normal - alternation between containers: button and list without items --- .../bbcreaMaracasVisuPanelButtonContainer.cxx | 12 +- .../bbcreaMaracasVisuPanelButtonContainer.h | 4 +- .../model/buttonGroupFactory.cxx | 1 + .../model/containerSettings.cxx | 108 ------------------ .../model/containerSettings.h | 12 +- .../model/listGroupFactory.cxx | 42 +++---- .../model/listGroupFactory.h | 81 ++++--------- .../creaButtonContainer/model/system.h | 10 +- .../creaButtonContainer/view/button.cxx | 5 +- .../widgets/creaButtonContainer/view/button.h | 1 + .../view/buttonContainerPanel.cxx | 39 +++++-- .../view/buttonContainerPanel.h | 14 ++- .../view/buttonManager.cxx | 45 +++++++- .../creaButtonContainer/view/buttonManager.h | 17 +++ .../creaButtonContainer/view/groupManager.cxx | 12 ++ .../creaButtonContainer/view/groupManager.h | 12 +- .../creaButtonContainer/view/listGroup.cxx | 52 ++++++--- .../creaButtonContainer/view/listGroup.h | 78 ++++--------- .../creaButtonContainer/view/listWx.cxx | 75 +++++++++--- .../widgets/creaButtonContainer/view/listWx.h | 67 ++++++----- .../buttonContainerSettings.cxx | 68 ++--------- .../buttonContainerSettings.h | 12 +- .../creaPanelButtonContainer.cxx | 2 +- .../creaPanelButtonContainer.h | 2 +- .../structBCPSettings.h | 2 +- 25 files changed, 352 insertions(+), 421 deletions(-) diff --git a/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.cxx b/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.cxx index 76119b7..abbdd39 100644 --- a/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.cxx +++ b/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.cxx @@ -43,14 +43,14 @@ PanelButtonContainer::Process( ) ButtonContainerSettings* settings = new ButtonContainerSettings( ); printf("EED PanelButtonContainer::Process %d\n", bbGetInputIn( ).size() ); - if(bbGetInputType()== "1") - { - settings->AddItems(bbGetInputIn()); + //if(bbGetInputType()== "1") + //{ + // settings->AddItems(bbGetInputIn()); - } - else { + //} + //else { settings->AddButtons(bbGetInputIn( )); - } + //} PBContainer* panel = new PBContainer( myPanel, settings, bbGetInputType() ); diff --git a/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.h b/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.h index 3d59055..89c5e3d 100644 --- a/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.h +++ b/bbtk/src/bbcreaMaracasVisuPanelButtonContainer.h @@ -51,7 +51,7 @@ class bbcreaMaracasVisu_EXPORT PanelButtonContainer //===== BBTK_DECLARE_INPUT(Title,std::string); BBTK_DECLARE_INPUT(In,BCStructVectorType); - BBTK_DECLARE_INPUT(Type,std::string); + BBTK_DECLARE_INPUT(Type,int); BBTK_PROCESS(Process); void Process(); BBTK_CREATE_WIDGET(CreateWidget); @@ -71,7 +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_INPUT(PanelButtonContainer,Type,"Type container",int,""); BBTK_END_DESCRIBE_BLACK_BOX(PanelButtonContainer); //===== diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.cxx index 759faa3..484ffca 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/buttonGroupFactory.cxx @@ -51,6 +51,7 @@ namespace creaButtonContainer ButtonGroupContainer groupView; try { + std::cout<< std::endl << " MLER buttonGroupFactory.cxx / CreateButtonGroupContainer(): " << std::endl; ButtonGroupMap map = settings->GetButtonGroupContainer( ); for( ButtonGroupMap::iterator it = map.begin( ); it != map.end( ); ++it ) { 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 6779dd3..836e5e0 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx @@ -73,21 +73,7 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- - 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, @@ -173,100 +159,6 @@ namespace creaButtonContainer }//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 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 d00db70..7aa3dc5 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.h @@ -115,12 +115,6 @@ namespace creaButtonContainer void SetGroupNameList( KeyMapList gNameList ); - ListGroupMap - GetListGroupContainer( ); - - void - SetListGroupContainer( ListGroupMap lstContainer ); - // ---------------------------------------------------------------------------------- /*! @@ -159,14 +153,14 @@ namespace creaButtonContainer AddButtons( BCStructVectorType infoList ); // ---------------------------------------------------------------------------------- - void + /* void AddItem(const StringType & groupName); void AddItem( BCSettingsStruct* info ); void - AddItems( BCStructVectorType infoList ); + AddItems( BCStructVectorType infoList );*/ // ---------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------- @@ -174,7 +168,7 @@ namespace creaButtonContainer ButtonGroupMap m_ButtonGroupContainer; //! GetListGroupContainer( ); - for( ListGroupMap::iterator it = map.begin( ); it != map.end( ); ++it ) + std::cout<< std::endl << " MLER listGroupFactory.cxx / CreateButtonGroupContainer(): " << std::endl; + ButtonGroupMap map = settings->GetButtonGroupContainer( ); + for( ButtonGroupMap::iterator it = map.begin( ); it != map.end( ); ++it ) { - wxString groupNameAux( ( *it ).first.c_str( ), wxConvUTF8 );//nombre grupo + wxString groupNameAux( ( *it ).first.c_str( ), wxConvUTF8 ); wxStaticText* wxGroupName = new wxStaticText( parent, -1, groupNameAux, wxDefaultPosition, wxDefaultSize, 0, _T("GroupText") ); - ListGroup* group = new ListGroup( wxGroupName, this->GetList( parent, ( *it ).second ) ); - //ListGroup* group; + ButtonGroup* group = new ButtonGroup( wxGroupName, this->GetButtons( parent, ( *it ).second ) ); groupView.push_back( group ); }//rof }//yrt catch ( const std::exception& e ) { std::cerr - << "ListGroupFactory::CreateListGroupContainer( wxWindow* parent, ListModel* settings )" + << "ButtonGroupFactory::CreateButtonGroupContainer( wxWindow* parent, ButtonGroupModel* settings )" << " exception: " << e.what( ) << std::endl; }//chtac return ( groupView ); @@ -72,17 +66,18 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- - ListGroupFactory::ListContainer ListGroupFactory::GetList( wxWindow* parent, tlist lst ) + ListGroupFactory::ButtonContainer ListGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel ) { - ListContainer cList; - + ButtonContainer buttonList; try { - /*List list = new List(parent,items); - - cList.push_back(list); - //return ( buttonList ); // JPR*/ - }//yrt + for( ButtonList::iterator it = buttonModel.begin( ); it + != buttonModel.end( ); ++it ) + { + long id = wxNewId( ); + buttonList[ id ] = new Button( parent, id, *it ); + } + } catch ( const std::exception& e ) { std::cerr @@ -90,8 +85,9 @@ namespace creaButtonContainer << "exception: " << e.what( ) << std::endl; }//chtac - return ( cList ); // JPR + return ( buttonList ); // 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 index 7e137bd..a90a26a 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/listGroupFactory.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/listGroupFactory.h @@ -23,101 +23,60 @@ # 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 "button.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::ListWx Button; + // ---------------------------------------------------------------------------------- - typedef creaButtonContainer::view::ListGroup ListGroup; + typedef creaButtonContainer::view::ListGroup ButtonGroup; // ---------------------------------------------------------------------------------- - /*! @typedef creaButtonContainer::model::ContainerSettings ButtonGroupModel; - * @brief Defines the ButtonGroupModel type. - */ - typedef creaButtonContainer::model::ContainerSettings ListModel; + + typedef creaButtonContainer::model::ContainerSettings ButtonGroupModel; // ---------------------------------------------------------------------------------- - /*! @typedef std::list< ButtonGroup* > ButtonGroupContainer; - * @brief Defines the ButtonGroupContainer type. - */ - typedef std::list< ListGroup* > ListGroupContainer; + + typedef std::list< ButtonGroup* > ButtonGroupContainer; // ---------------------------------------------------------------------------------- - /*! @typedef std::map< long, Button* > ButtonContainer; - * @brief Defines the ButtonContainer type. - */ - typedef std::list ListContainer; + typedef std::map< long, Button* > ButtonContainer; // ---------------------------------------------------------------------------------- //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 ); + ButtonGroupContainer + CreateButtonGroupContainer( wxWindow* parent, + ButtonGroupModel* 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 ); + ButtonContainer + GetButtons( wxWindow* parent, ButtonList buttonModel ); }; }//ecapseman }//ecapseman -#endif // CARTOBUTTONFACTORY_H +#endif // LISTGROUPFACTORY_H 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 8317474..475bb21 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h @@ -39,8 +39,8 @@ #include #include #include "functor.h" -#include -#include +//#include "listWx.h" +//#include /*! @namespace @@ -59,7 +59,7 @@ }*/ namespace creaButtonContainer { - using namespace view; + //using namespace view; // ---------------------------------------------------------------------------------- /*! @typedef std::string* StringType; * @brief Defines the StringType type. @@ -120,8 +120,8 @@ namespace creaButtonContainer //typedef std::map< StringType, ItemsList > ListGroupMap; // ex: grupo A,items lista A (la lista de ese grupo) - typedef std::list< ListWx > ListLst; // lista contenedor - typedef std::map< StringType, ListLst > ListGroupMap; // ex: grupo A,lista A,lista B + //typedef std::list< ListWx > ListLst; // lista contenedor + //typedef std::map< StringType, ListLst > ListGroupMap; // ex: grupo A,lista A,lista B // ---------------------------------------------------------------------------------- } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx index 39a30e3..ae64e06 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx @@ -46,9 +46,8 @@ namespace creaButtonContainer wxString buttonName( wXbuttonName.c_str( ), wxConvUTF8 ); wxString description( wXdescription.c_str( ), wxConvUTF8 ); //creating the button. - this->Create( parent, id, - wXicon, - wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW, wxDefaultValidator, + this->Create( parent, id,wXicon, + wxDefaultPosition, wxDefaultSize,wxBU_AUTODRAW, wxDefaultValidator, buttonName ); this->SetToolTip( description ); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.h index b7a8fb6..f323c4d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.h @@ -33,6 +33,7 @@ #ifndef BUTTON_H #define BUTTON_H +//#include #include #include #include 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 aaeae8c..3402582 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.cxx @@ -42,14 +42,31 @@ namespace creaButtonContainer END_EVENT_TABLE() // ---------------------------------------------------------------------------------- - ButtonContainerPanel::ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings, std::string type ) + ButtonContainerPanel::ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings, int 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 ) ); + ListGroupFactory listFactory; + + //this->SetButtonGroupContainer( factory.CreateButtonGroupContainer( this, settings ) ); + + std::cout<< std::endl << " MLER buttonContainerPanel.cxx / ButtonContainerPanel() :: type " << type<SetButtonGroupContainer( factory.CreateButtonGroupContainer( this, settings ) ); + break; + case 1: + this->SetListGroupContainer(listFactory.CreateButtonGroupContainer( this, settings ) ); + //Verificar ButtonGroupList contra ListGroupList + break; + default: + this->SetButtonGroupContainer(factory.CreateButtonGroupContainer( this, settings ) ); + } + this->PanelInit(type ); this->m_ButtonCController = new BCController( this ); this->m_ButtonCController->AddEvents( ); @@ -62,21 +79,27 @@ namespace creaButtonContainer } // ---------------------------------------------------------------------------------- - void ButtonContainerPanel::SetGroupContainer( ButtonGroupList groupContainer ) + void ButtonContainerPanel::SetButtonGroupContainer(ButtonGroupList groupContainer ) { this->m_ButtonGroupList = groupContainer; } + // ---------------------------------------------------------------------------------- + void ButtonContainerPanel::SetListGroupContainer(ListGroupList groupContainer ) + { + this->m_ListGroupList = groupContainer; + } // ---------------------------------------------------------------------------------- - void ButtonContainerPanel::PanelInit( std::string type ) + void ButtonContainerPanel::PanelInit( int type ) { try { // EED 20/01/2012 flag 01 this->m_Sizer = new Sizer( 0, 1, 0, 0 ); + std::cout << " MLER buttonContainerPanel.cxx / Panel Init() :: type " << type << std::endl; - if(type == "1") + if(type == 0) { for( ButtonGroupList::iterator it = this->m_ButtonGroupList.begin( ); it != this->m_ButtonGroupList.end( ); ++it ) { @@ -87,13 +110,13 @@ namespace creaButtonContainer } else { - for( ButtonGroupList::iterator it = this->m_ButtonGroupList.begin( ); it != this->m_ButtonGroupList.end( ); ++it ) + for(ListGroupList::iterator it1 = this->m_ListGroupList.begin(); it1 != this->m_ListGroupList.end(); ++it1) { - GroupManager* manager = new GroupManager( this, *it ); + GroupManager* manager = new GroupManager( this, *it1); this->m_GroupManagerList[ manager->GetButtonID( ) ] = manager; this->m_Sizer->Add( manager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); } - } + }//MLER this->SetSizer( this->m_Sizer ); this->Layout( ); 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 988fbc2..8fdc3b6 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.h @@ -133,11 +133,13 @@ namespace creaButtonContainer typedef creaButtonContainer::controller::ButtonContainerController BCController; + typedef creaButtonContainer::model::ListGroupFactory ListGroupFactory; + typedef creaButtonContainer::view::ListGroup ListGroup; typedef std::list< ListGroup* > ListGroupList; - typedef creaButtonContainer::model::ListGroupFactory ListGroupFactory; + //typedef creaButtonContainer::model::ListGroupFactory ListGroupFactory; // ---------------------------------------------------------------------------------- //end of typedef definition @@ -147,7 +149,7 @@ namespace creaButtonContainer * @param parent wxWindow pointer to parent. * @param settings ButtonGroupSettings Pointer to button container settings. */ - ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings, std::string type ); + ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings, int type ); // ---------------------------------------------------------------------------------- /*! @fn ~ButtonContainerPanel( ); * @brief This is the destructor. @@ -160,14 +162,18 @@ namespace creaButtonContainer * @param groupContainer */ void - SetGroupContainer( ButtonGroupList groupContainer ); + SetButtonGroupContainer( ButtonGroupList groupContainer ); // ---------------------------------------------------------------------------------- /*! @fn PanelInit( ); * This method initializes the panel. * @exception std::bad_alloc */ void - PanelInit( std::string type); + PanelInit( int type); + // ---------------------------------------------------------------------------------- + + void + SetListGroupContainer(ListGroupList groupContainer ); // ---------------------------------------------------------------------------------- /*! @fn FitSizer( ); * This method fits and organizes the sizer. diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.cxx index 74ea519..dc793d5 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.cxx @@ -49,6 +49,7 @@ namespace creaButtonContainer { try { + std::cout << " MLER buttonManager.cxx / GroupManager(ButtonGroup* buttonGroup) " << std::endl; this->SetGroupName( buttonGroup->GetGroupName( ) ); this->SetButtonManager( buttonGroup->GetButtonContainer( ) ); }//yrt @@ -57,7 +58,22 @@ namespace creaButtonContainer std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl; }//hctac } - + // ---------------------------------------------------------------------------------- + //MLER + ButtonManager::ButtonManager (ListGroup* buttonGroup): + wxFlexGridSizer( 0, 1, 0, 0 ) + { + try + { + std::cout << " MLER buttonManager.cxx / ButtonManager(ListGroup* buttonGroup) " << std::endl; + this->SetGroupName( buttonGroup->GetGroupName( ) ); + this->SetListManager(buttonGroup->GetButtonContainer( ) ); + }//yrt + catch ( const std::exception& e ) + { + std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl; + }//hctac + } // ---------------------------------------------------------------------------------- ButtonManager::~ButtonManager( ) { @@ -93,6 +109,33 @@ namespace creaButtonContainer }//hctac } // ---------------------------------------------------------------------------------- + + void ButtonManager::SetListManager(ListContainer buttonContainer ) + { + try + { + if ( this->m_GroupName != NULL ) + { + this->m_GridSizer = new wxGridSizer( 0, 3, 0, 0 ); + for( ListContainer::iterator it = buttonContainer.begin( ); it!= buttonContainer.end( ); ++it ) + { + this->m_GridSizer->Add( ( *it ).second, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); + } + this->Add( m_GridSizer, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); + }//fi + }//yrt + catch ( const std::exception& e ) + { + std::cerr + << "ButtonManager::SetButtonManager( ButtonContainer buttonContainer )" + << "exception: " << e.what( ) << std::endl; + }//hctac + } + // ---------------------------------------------------------------------------------- + + + + void ButtonManager::ShowButtonManager( ) { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.h index 9b7aca4..88eeb5f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.h @@ -43,6 +43,8 @@ #include "button.h" #include "buttonGroup.h" +#include "listWx.h" +#include "listGroup.h" /*! @namespace * @brief Contains the creaButtonContainer library included in creaMaracasVisu. @@ -80,6 +82,10 @@ namespace creaButtonContainer */ typedef std::map< long, Button* > ButtonContainer; // ---------------------------------------------------------------------------------- + //MLER + typedef creaButtonContainer::view::ListGroup ListGroup; + typedef std::map ListContainer; + //end of typedef definition. public: // ---------------------------------------------------------------------------------- @@ -95,6 +101,10 @@ namespace creaButtonContainer */ ButtonManager( ButtonGroup* buttonGroup ); // ---------------------------------------------------------------------------------- + //MLER + ButtonManager (ListGroup* buttonGroup); + // ---------------------------------------------------------------------------------- + /*! @fn ~ButtonManager( ); * @brief This is the destructor. */ @@ -111,6 +121,7 @@ namespace creaButtonContainer /*! @fn ShowButtonManager( ); * @brief This method shows the ButtonManager */ + void ShowButtonManager( ); // ---------------------------------------------------------------------------------- @@ -130,6 +141,12 @@ namespace creaButtonContainer void SetButtonManager( ButtonContainer buttonContainer ); // ---------------------------------------------------------------------------------- + //MLER + void + SetListManager( ListContainer buttonContainer ); + // ---------------------------------------------------------------------------------- + + private: wxStaticText* m_GroupName; //!m_IDExpButton = wxNewId( ); this->m_ExpansionButton = new ExpansionButton( parent, this->m_IDExpButton, _("-"), wxDefaultPosition, wxSize( 20, 20 ), 0, wxDefaultValidator, _T("EXPBUTTON") ); this->Add( m_ExpansionButton, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); @@ -48,6 +49,17 @@ namespace creaButtonContainer this->Add( this->m_ButtonManager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); } + GroupManager::GroupManager(wxWindow* parent, ListGroup* buttonGroup ): + wxFlexGridSizer( 1, 0, 0, 0 ) + { + std::cout << " MLER groupManager.cxx / GroupManager(ListGroup* buttonGroup) " << std::endl; + this->m_IDExpButton = wxNewId( ); + this->m_ExpansionButton = new ExpansionButton( parent, this->m_IDExpButton, _("-"), wxDefaultPosition, wxSize( 20, 20 ), 0, wxDefaultValidator, _T("EXPBUTTON") ); + this->Add( m_ExpansionButton, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); + this->m_ButtonManager = new ButtonManager( buttonGroup ); + this->Add( this->m_ButtonManager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); + }//MLER + // ---------------------------------------------------------------------------------- GroupManager::~GroupManager( ) { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.h index f78efa7..1d84118 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.h @@ -43,6 +43,7 @@ #include "buttonManager.h" #include "buttonGroup.h" +#include "listGroup.h" /*! @namespace * @brief Contains the creaButtonContainer library included in creaMaracasVisu. @@ -75,6 +76,9 @@ namespace creaButtonContainer */ typedef wxButton ExpansionButton; // ---------------------------------------------------------------------------------- + //MLER + typedef creaButtonContainer::view::ListGroup ListGroup; + //end of typedef definition. public: // ---------------------------------------------------------------------------------- @@ -85,9 +89,12 @@ namespace creaButtonContainer */ GroupManager( wxWindow* parent, ButtonGroup* buttonGroup ); // ---------------------------------------------------------------------------------- + + //MLER + GroupManager( wxWindow* parent, ListGroup* listGroup ); /*! @fn ~GroupManager( ); * @brief This is the destructor. - */ + */ virtual ~GroupManager( ); // ---------------------------------------------------------------------------------- @@ -144,6 +151,9 @@ namespace creaButtonContainer long m_IDExpButton; //!m_GroupName = groupName; - this->m_List = list; + this->m_Buttons = cartoButtons; } // ---------------------------------------------------------------------------------- @@ -49,10 +42,10 @@ namespace creaButtonContainer } // ---------------------------------------------------------------------------------- - ListGroup::ListContainer - ListGroup::GetListContainer( ) + ListGroup::ButtonContainer + ListGroup::GetButtonContainer( ) { - return ( this->m_List ); + return ( this->m_Buttons ); } // ---------------------------------------------------------------------------------- @@ -63,8 +56,41 @@ namespace creaButtonContainer } // ---------------------------------------------------------------------------------- + ListGroup::IdButtonContainer + ListGroup::GetButtonIdContainer( ) + { + IdButtonContainer idContainer; + try + { + for( ButtonContainer::iterator it = this->m_Buttons.begin( ); it + != this->m_Buttons.end( ); ++it ) + { + idContainer.push_back( ( *it ).first ); + }//rof + }//yrt + catch ( std::exception& e ) + { + std::cerr << "ButtonGroup::GetButtonIdContainer( )" << "exception: " + << e.what( ) << std::endl; + }//hctac + return ( idContainer ); + } - + // ---------------------------------------------------------------------------------- + ListGroup::Button* + ListGroup::GetButton( long id ) + { + try + { + //return ( this->m_Buttons[ id ] ); // JPR + }//yrt + catch ( std::exception& e ) + { + std::cerr << "ButtonGroup::GetButton( long id )" << "exception: " + << e.what( ) << std::endl; + }//hctac + return ( this->m_Buttons[ id ] );// JPR + } // ---------------------------------------------------------------------------------- }//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 index 209d09c..c347010 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listGroup.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listGroup.h @@ -23,13 +23,6 @@ # 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 @@ -42,79 +35,48 @@ #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; - // ---------------------------------------------------------------------------------- + typedef creaButtonContainer::view::ListWx Button; + + typedef std::map< long, Button* > ButtonContainer; + typedef std::list< long > IdButtonContainer; public: + + ListGroup( wxStaticText* groupName, ButtonContainer buttons ); // ---------------------------------------------------------------------------------- - /*! @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( ); + // ---------------------------------------------------------------------------------- + Button* + GetButton( long id ); // ---------------------------------------------------------------------------------- - /*! @fn GetButtonContainer( ); - * @brief This method returns the button container. - * @exception std::bad_alloc - * @return ButtonContainer. - */ - ListContainer - GetListContainer( ); + + ButtonContainer + GetButtonContainer( ); // ---------------------------------------------------------------------------------- - /*! @fn GetButtonIdContainer( ); - * @brief This method returns a list of button IDs. - * @exception std::bad_alloc - * @return - */ - // IdListContainer - // GetListIdContainer( ); + + IdButtonContainer + GetButtonIdContainer( ); // ---------------------------------------------------------------------------------- - /*! @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()); + this->m_ButtonPair = pair; + StringType wXbuttonName = this->m_ButtonPair->first->first; + BitmapType wXicon = this->m_ButtonPair->first->second; + StringType wXdescription = this->m_ButtonPair->second->first; + wxString buttonName( wXbuttonName.c_str( ), wxConvUTF8 ); + wxString description( wXdescription.c_str( ), wxConvUTF8 ); + //creating the button. + /*this->Create( parent, id, + wXicon, + wxDefaultPosition, wxDefaultSize,wxBU_AUTODRAW, wxDefaultValidator, + buttonName );*/ + this->Create( parent, id, + wxDefaultPosition, wxDefaultSize,wxLC_LIST, wxDefaultValidator, + buttonName ); + this->SetToolTip( description ); } - //------------------------------------------------------- - - tList::~tList( ) + // ---------------------------------------------------------------------------------- + ListWx::~ListWx( ) { } - //------------------------------------------------------- - - ItemsList getItems() const + // ---------------------------------------------------------------------------------- + StringType + ListWx::GetButtonName( ) { - return m_items; + return ( this->m_ButtonPair->first->first ); } - void setItems(ItemsList items) + // ---------------------------------------------------------------------------------- + BitmapType + ListWx::GetIcon( ) { - m_items = items; + return ( this->m_ButtonPair->first->second ); } + // ---------------------------------------------------------------------------------- + /*StringType + Button::GetIconPath( ) + { + return ( this->m_ButtonPair->first->second ); + }*/ + // ---------------------------------------------------------------------------------- + StringType + ListWx::GetDescription( ) + { + return ( this->m_ButtonPair->second->first ); + } - } - -} + // ---------------------------------------------------------------------------------- + void + ListWx::Execute( ) + { + try + { + TFunctor* vTable[ ] = + { this->m_ButtonPair->second->second }; + vTable[ 0 ]->Call( this->m_ButtonPair->first->first ); + }//yrt + catch ( const std::exception& e ) + { + std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl; + }//hctac + } + // ---------------------------------------------------------------------------------- + }//ecapseman +}//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.h index 472875c..905dbec 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.h @@ -24,55 +24,64 @@ # ------------------------------------------------------------------------ */ -#ifndef LISTWX_H_ -#define LISTWX_H_ +#ifndef LISTWX_H +#define LISTWX_H -#include +//#include +#include #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 + + class ListWx : public wxListCtrl { - public : + public: - typedef wxListItem* Item; - typedef std::list< Item > ItemsList; //lista de los objetos lista + typedef creaButtonContainer::model::TFunctor TFunctor; - public : + public: - ListWx(); - ListWx( wxWindow* parent, ItemsList items ); + ListWx( wxWindow* parent, long id, ButtonPair* pair ); + // ---------------------------------------------------------------------------------- virtual - ~ListWx(); + ~ListWx( ); + // ---------------------------------------------------------------------------------- - ItemsList const - getItems (); + long + GetID( ); + // ---------------------------------------------------------------------------------- - void - setItems(Item i); + StringType + GetButtonName( ); - private : + // ---------------------------------------------------------------------------------- - ItemsList m_items; + BitmapType + GetIcon( ); + + // ---------------------------------------------------------------------------------- + + StringType + GetDescription( ); + // ---------------------------------------------------------------------------------- + + void + Execute( ); + // ---------------------------------------------------------------------------------- + private: + ButtonPair* m_ButtonPair; //! m_GroupNameList.begin( ); it != this->m_GroupNameList.end( ); ++it ) { - ButtonList list = this->m_ButtonGroupContainer[ ( *it ) ]; + ButtonList list = this->m_ButtonGroupContainer[ ( *it ) ]; //MLER : Hacer cambio de contenedor std::cout<<"MLER ButtonContainerSettings // GetButtonGroupSettings :: it "<< *it<first->first <AddButton( ( *it ), ( *it1 )->first->first, ( *it1 )->first->second, ( *it1 )->second->first, functor ); }//rof }//rof @@ -142,7 +146,7 @@ namespace creaPanelButtonContainer { try { - std::cout<< std::endl<<"MLER ButtonContainerSettings // AddButton"<Show( false ); + ButtonPair* pair = new ButtonPair( new ButtonInfo( buttonName, icon ), new ActionButton( buttonDescription, panel ) ); + for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it != this->m_GroupNameList.end( ); ++it ) { @@ -237,63 +244,6 @@ namespace creaPanelButtonContainer }//hctac } - void - ButtonContainerSettings::AddItem(BCPSettingsStruct* info) - { - if(info->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 cdb3207..329ced9 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h @@ -126,10 +126,6 @@ namespace creaPanelButtonContainer * @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: // ---------------------------------------------------------------------------------- @@ -236,18 +232,12 @@ 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, std::string type ) + PanelButtonContainer::PanelButtonContainer( wxWindow* parent, ButtonContainerSettings* bcSettings, int type ) : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("creaPanelButtonContainer") ) { std::cout<< std::endl << " MLER creaPanelButtonContainer.cxx / PanelButtonContainer() " << std::endl; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h index deb2134..f20232b 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, std::string type ); + ButtonContainerSettings* bcSettings, int 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 4868154..722f4e7 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/structBCPSettings.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/structBCPSettings.h @@ -36,7 +36,7 @@ #include #include #include -#include "tlist.h" + /*! @namespace * @brief Contains the creaPanelButtonContainer library included in creaMaracasVisu. -- 2.47.1