From b8c5a565c70ac0def1f21518afa2d847a9582d79 Mon Sep 17 00:00:00 2001 From: monica Date: Thu, 22 Jan 2015 02:00:00 +0100 Subject: [PATCH] #2509 creaMaracasVisu Feature New Normal - creaPanelButtonContainer ListPanel with events --- .../controller/buttonContainerController.cxx | 7 ++ .../controller/buttonContainerController.h | 1 + .../model/buttonGroupFactory.cxx | 5 +- .../model/containerSettings.cxx | 11 ++- .../creaButtonContainer/model/functor.txx | 3 +- .../creaButtonContainer/model/system.h | 26 ------- .../creaButtonContainer/view/button.cxx | 8 ++ .../view/buttonContainerPanel.cxx | 5 +- .../creaButtonContainer/view/buttonGroup.cxx | 4 + .../view/buttonManager.cxx | 7 +- .../creaButtonContainer/view/groupManager.cxx | 5 +- .../creaButtonContainer/view/listWx.cxx | 29 +++++-- .../widgets/creaButtonContainer/view/listWx.h | 11 ++- .../buttonContainerSettings.cxx | 54 +++++++++++-- .../buttonContainerSettings.h | 3 + .../creaPanelButtonContainer.cxx | 77 ++++++++++++++++--- .../creaPanelButtonContainer.h | 12 ++- 17 files changed, 206 insertions(+), 62 deletions(-) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.cxx index f636952..1ac95c8 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.cxx @@ -39,6 +39,7 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- ButtonContainerController::ButtonContainerController( BCPanel* panel ) { + std::cout<< "MLER | ButtonContainerController::ButtonContainerController( BCPanel* panel )" << std::endl; this->m_BCPanel = panel; } // ---------------------------------------------------------------------------------- @@ -51,6 +52,7 @@ namespace creaButtonContainer { try { + std::cout<< "MLER | ButtonContainerController:: AddEvents( )" << std::endl; //Adding ButtonManagerEvents for( GroupManagerList::iterator it = this->m_BCPanel->m_GroupManagerList.begin( ); it @@ -86,6 +88,8 @@ namespace creaButtonContainer ButtonContainerController::ButtonExpEvent( wxCommandEvent& event ) { long id = event.GetId( ); + std::cout<< "MLER | ButtonContainerController:: ButtonExpEvent( wxCommandEvent& event )" << std::endl; + try { //changing the button label when its clicked and then hide the buttons of the group. @@ -116,6 +120,7 @@ namespace creaButtonContainer void ButtonContainerController::ButtonEvent( wxCommandEvent& event ) { + std::cout<< "MLER | ButtonContainerController:: ButtonEvent( wxCommandEvent& event )" << std::endl; try { for( ButtonGroupList::iterator it = @@ -136,6 +141,8 @@ namespace creaButtonContainer }//hctac } // ---------------------------------------------------------------------------------- + + }//ecapsename }//ecapsename diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.h index a54d4f4..3cfc6ef 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/controller/buttonContainerController.h @@ -153,6 +153,7 @@ namespace creaButtonContainer void ButtonEvent( wxCommandEvent& event ); // ---------------------------------------------------------------------------------- + private: BCPanel* m_BCPanel; //! GetButtonGroupContainer( ); for( ButtonGroupMap::iterator it = map.begin( ); it != map.end( ); ++it ) { @@ -75,6 +76,8 @@ namespace creaButtonContainer ButtonGroupFactory::ButtonContainer ButtonGroupFactory::GetButtons( wxWindow* parent, ButtonList buttonModel ) { ButtonContainer buttonList; + + std::cout<< "MLER | ButtonGroupFactory::GetButtons()" << std::endl; try { for( ButtonList::iterator it = buttonModel.begin( ); 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 836e5e0..7b640cd 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/containerSettings.cxx @@ -39,6 +39,7 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- ContainerSettings::ContainerSettings( ) { + } // ---------------------------------------------------------------------------------- ContainerSettings::~ContainerSettings( ) @@ -49,12 +50,14 @@ namespace creaButtonContainer ButtonGroupMap ContainerSettings::GetButtonGroupContainer( ) { + std::cout<< "MLER | ContainerSettings::GetButtonGroupContainer( )" << std::endl; return ( this->m_ButtonGroupContainer ); } // ---------------------------------------------------------------------------------- KeyMapList ContainerSettings::GetGroupNameList( ) { + std::cout<< "MLER | ContainerSettings::GetGroupNameList( )" << std::endl; return ( this->m_GroupNameList ); } @@ -62,12 +65,14 @@ namespace creaButtonContainer void ContainerSettings::SetButtonGroupContainer(ButtonGroupMap bgContainer) { + std::cout<< "MLER | ContainerSettings:: SetButtonGroupContainer(ButtonGroupMap bgContainer)" << std::endl; this->m_ButtonGroupContainer = bgContainer; } // ---------------------------------------------------------------------------------- void ContainerSettings::SetGroupNameList( KeyMapList gNameList ) { + std::cout<< "MLER | ContainerSettings::SetGroupNameList" << std::endl; this->m_GroupNameList = gNameList; } @@ -79,9 +84,7 @@ namespace creaButtonContainer 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 "<buttonName, info->icon ), new ButtonAction( info->buttonDescription, info->eventFunction ) ); @@ -143,6 +147,7 @@ namespace creaButtonContainer void ContainerSettings::AddButtons( BCStructVectorType infoList ) { + std::cout<< "MLER | ContainerSettings::AddButtons( BCStructVectorType infoList )" << std::endl; try { for( BCStructVectorType::iterator it = infoList.begin( ); it diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/functor.txx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/functor.txx index 33d0ae7..805b567 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/functor.txx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/functor.txx @@ -49,7 +49,7 @@ namespace creaButtonContainer template< typename TClass > void TConcreteFunctor< TClass >::operator()( const ButtonIDType &buttonName ) - { + {std::cout << "MLER - TConcreteFunctor< TClass >::operator():" << buttonName << std::endl; try { ( *pt2Object.*fpt )( buttonName ); @@ -66,6 +66,7 @@ namespace creaButtonContainer void TConcreteFunctor< TClass >::Call( const ButtonIDType &buttonName ) { + std::cout << "MLER - TConcreteFunctor< TClass >::Call " << buttonName << std::endl; try { ( *pt2Object.*fpt )( buttonName ); 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 475bb21..7473726 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/model/system.h @@ -39,24 +39,8 @@ #include #include #include "functor.h" -//#include "listWx.h" -//#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; @@ -113,16 +97,6 @@ namespace creaButtonContainer 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; // lista contenedor - //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/button.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx index ae64e06..7c81882 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/button.cxx @@ -39,6 +39,8 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- Button::Button( wxWindow* parent, long id, ButtonPair* pair ) { + std::cout<< "MLER | Button::Button()" << std::endl; + this->m_ButtonPair = pair; StringType wXbuttonName = this->m_ButtonPair->first->first; BitmapType wXicon = this->m_ButtonPair->first->second; @@ -61,6 +63,7 @@ namespace creaButtonContainer StringType Button::GetButtonName( ) { + std::cout<< "MLER | Button::GetButtonName( )" << std::endl; return ( this->m_ButtonPair->first->first ); } @@ -68,6 +71,7 @@ namespace creaButtonContainer BitmapType Button::GetIcon( ) { + std::cout<< "MLER | Button::GetIcon( )" << std::endl; return ( this->m_ButtonPair->first->second ); } @@ -82,6 +86,7 @@ namespace creaButtonContainer StringType Button::GetDescription( ) { + std::cout<< "MLER | Button::GetDescription( )" << std::endl; return ( this->m_ButtonPair->second->first ); } @@ -89,11 +94,14 @@ namespace creaButtonContainer void Button::Execute( ) { + std::cout<< "MLER | Button::Execute( )" << std::endl; try { TFunctor* vTable[ ] = { this->m_ButtonPair->second->second }; + vTable[ 0 ]->Call( this->m_ButtonPair->first->first ); + std::cout<< "Call Button: " << this->m_ButtonPair->first->first <m_ButtonGroupList = groupContainer; } // ---------------------------------------------------------------------------------- @@ -92,6 +93,7 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- void ButtonContainerPanel::PanelInit( int type ) { + std::cout<< "MLER | ButtonContainerPanel::PanelInit( int type )" << std::endl; try { @@ -132,6 +134,7 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- void ButtonContainerPanel::FitSizer( ) { + std::cout<< "MLER | ButtonContainerPanel::FitSizer( )" << std::endl; this->m_Sizer->Fit( this ); this->m_Sizer->FitInside( this ); this->SetScrollRate( 20, 20 ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.cxx index bf26736..c9fb31e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonGroup.cxx @@ -39,6 +39,7 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- ButtonGroup::ButtonGroup( wxStaticText* groupName, ButtonContainer cartoButtons ) { + std::cout<< "MLER | ButtonGroup::ButtonGroup()" << std::endl; this->m_GroupName = groupName; this->m_Buttons = cartoButtons; } @@ -52,6 +53,7 @@ namespace creaButtonContainer ButtonGroup::ButtonContainer ButtonGroup::GetButtonContainer( ) { + std::cout<< "MLER | ButtonGroup::GetButtonContainer( )" << std::endl; return ( this->m_Buttons ); } @@ -66,6 +68,7 @@ namespace creaButtonContainer ButtonGroup::IdButtonContainer ButtonGroup::GetButtonIdContainer( ) { + std::cout<< "MLER | ButtonGroup::GetButtonIdContainer( )" << std::endl; IdButtonContainer idContainer; try { @@ -87,6 +90,7 @@ namespace creaButtonContainer Button* ButtonGroup::GetButton( long id ) { + std::cout<< "MLER | ButtonGroup::GetButton( long id )" << std::endl; try { //return ( this->m_Buttons[ id ] ); // JPR 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 62220ff..4454d0c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.cxx @@ -40,6 +40,7 @@ namespace creaButtonContainer ButtonManager::ButtonManager( ) : wxFlexGridSizer( 0, 1, 0, 0 ) { + std::cout<< "MLER | ButtonManager::ButtonManager( )" << std::endl; } //EED 20/01/2012 Flag03 @@ -49,7 +50,7 @@ namespace creaButtonContainer { try { - std::cout << " MLER buttonManager.cxx / GroupManager(ButtonGroup* buttonGroup) " << std::endl; + std::cout<< "MLER | ButtonManager::ButtonManager( ButtonGroup* buttonGroup )" << std::endl; this->SetGroupName( buttonGroup->GetGroupName( ) ); this->SetButtonManager( buttonGroup->GetButtonContainer( ) ); }//yrt @@ -82,6 +83,7 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- void ButtonManager::SetGroupName( wxStaticText* groupName ) { + std::cout<< "MLER | ButtonManager::SetGroupName( wxStaticText* groupName )" << std::endl; this->m_GroupName = groupName; this->Add( this->m_GroupName, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 ); } @@ -89,6 +91,7 @@ namespace creaButtonContainer // ---------------------------------------------------------------------------------- void ButtonManager::SetButtonManager( ButtonContainer buttonContainer ) { + std::cout<< "MLER | ButtonManager::SetButtonManager( ButtonContainer buttonContainer )" << std::endl; try { if ( this->m_GroupName != NULL ) @@ -139,12 +142,14 @@ namespace creaButtonContainer void ButtonManager::ShowButtonManager( ) { + std::cout<< "MLER | ButtonManager::ShowButtonManager( )" << std::endl; this->Show( this->m_GridSizer, true, false ); } // ---------------------------------------------------------------------------------- void ButtonManager::HideButtonManager( ) { + std::cout<< "MLER | ButtonManager::HideButtonManager( )" << std::endl; this->Show( this->m_GridSizer, false, false ); } // ---------------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.cxx index 9974723..eac787a 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/groupManager.cxx @@ -41,7 +41,7 @@ namespace creaButtonContainer wxFlexGridSizer( 1, 0, 0, 0 ) { //EED 20/01/2012 flag 02 - std::cout << " MLER groupManager.cxx / GroupManager(ButtonGroup* buttonGroup) " << std::endl; + std::cout<< "MLER | GroupManager::GroupManager( )" << 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 ); @@ -69,6 +69,7 @@ namespace creaButtonContainer long GroupManager::GetButtonID( ) { + std::cout<< "MLER | GroupManager::GetButtonID( )" << std::endl; return ( this->m_IDExpButton ); } @@ -76,6 +77,7 @@ namespace creaButtonContainer GroupManager::ExpansionButton* GroupManager::GetButton( ) { + std::cout<< "MLER | GroupManager::GetButton( )" << std::endl; return ( this->m_ExpansionButton ); } @@ -111,6 +113,7 @@ namespace creaButtonContainer void GroupManager::HideSubPanel( bool hide ) { + std::cout<< "MLER | GroupManager::HideSubPanel( bool hide )" << std::endl; if ( hide == true ) { this->m_ButtonManager->HideButtonManager( ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx index 868e331..9fd986b 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/listWx.cxx @@ -31,16 +31,24 @@ namespace creaButtonContainer namespace view { // ---------------------------------------------------------------------------------- - ListWx::ListWx( wxWindow* parent, wxWindowID id, ItemsMap iMap , TFunctor* functor ): wxListCtrl(parent,id) + ListWx::ListWx( wxWindow* parent, wxWindowID id,ItemsMap iMap , TFunctor* functor ): wxListCtrl(parent,id) { + + std::cout<< "MLER | ListWx::ListWx()" << std::endl; this->m_itemsMap = iMap; + this->functor = functor; + int i = 0; for (ItemsMap::iterator it=this->m_itemsMap.begin(); it!=this->m_itemsMap.end(); ++it) { + std::string key = it->first; - long index = this->InsertItem(0, wxString::From8BitData(key.c_str())); - //this->Connect( index, wxEVT_LIST_ITEM_SELECTED, - // (wxObjectEventFunction) &ListWx::ButtonEvent ); + long index = this->InsertItem(i, wxString(key.c_str(), wxConvUTF8)); + + std::cout << "index" << index << std::endl; + this->Connect( -1, wxEVT_COMMAND_LIST_ITEM_SELECTED, + wxListEventHandler(ListWx::ListEvent) ); + i++; } } @@ -50,12 +58,19 @@ namespace creaButtonContainer } void - ListWx::ButtonEvent( wxCommandEvent& event ) + ListWx::ListEvent( wxListEvent& event ) { try { - //MLDR - Aqui necesita el nombre de la funcion para poderla ejecutar - this->functor->Call("PanelButtonContainer::GenericButtonEvent"); + std::cout<< "MLER | ListWx::ListEvent( wxListEvent& event )" << std::endl; + + wxString itemNom = event.GetItem().GetText(); + + std::string itemNomC = std::string(itemNom.mb_str()); + + this->functor->Call(itemNomC); + std::cout<<"mmmmmmmmmmmmmmmmmmmmmmm"< #include #include +#include + + #include -#include +#include #include "functor.h" +#include #include "system.h" @@ -51,9 +55,10 @@ namespace creaButtonContainer typedef creaButtonContainer::model::TFunctor TFunctor; typedef std::map ItemsMap; + public: - ListWx( wxWindow* parent, wxWindowID id, ItemsMap iMap , TFunctor* functor ); + ListWx( wxWindow* parent, wxWindowID id,ItemsMap iMap , TFunctor* functor ); // ---------------------------------------------------------------------------------- virtual @@ -64,7 +69,7 @@ namespace creaButtonContainer GetID( ); void - ButtonEvent( wxCommandEvent& event ); + ListEvent( wxListEvent& event ); // ---------------------------------------------------------------------------------- private: ItemsMap m_itemsMap; //! 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 ) @@ -88,6 +91,35 @@ namespace creaPanelButtonContainer }//hctac return ( NULL ); } + // ---------------------------------------------------------------------------------- + ButtonContainerSettings::PanelButton + ButtonContainerSettings::GetPanelList( const StringType &buttonName ) + { + std::cout<< "MLER | ButtonContainerSettings:: GetPanelList " << std::endl; + + + try { + if(m_itemsMap.empty()) + std::cout<< "no tengo nada "<< std::endl; + + for( ItemsMap::iterator it= this->m_itemsMap.begin(); it!=this->m_itemsMap.end(); ++it ) + { + if( (*it).first.compare(buttonName) == 0 ) + return ( (*it).second ); + } + + + }catch ( std::exception& e ) + { + std::cerr + << "ButtonContainerSettings::GetPanelButton( const StringType &buttonName ) " + << "exception: " << e.what( ) << std::endl; + }//hctac + return (NULL); + + } + + // ---------------------------------------------------------------------------------- ButtonContainerSettings::ButtonGroupSettings* ButtonContainerSettings::GetButtonGroupSettings( TFunctor* functor ) @@ -95,17 +127,14 @@ 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 ) ]; //MLER : Hacer cambio de contenedor - - std::cout<<"MLER ButtonContainerSettings // GetButtonGroupSettings :: it "<< *it<m_ButtonGroupContainer[ ( *it ) ]; for( ButtonList::iterator it1 = list.begin( ); it1 != list.end( ); ++it1 ) { @@ -129,12 +158,14 @@ namespace creaPanelButtonContainer ButtonContainerSettings::SetButtonGroupContainer( ButtonGroupMap m_ButtonGroupContainer ) { + std::cout<< "MLER | ButtonContainerSettings:: SetButtonGroupContainer() " << std::endl; this->m_ButtonGroupContainer = m_ButtonGroupContainer; } // ---------------------------------------------------------------------------------- void ButtonContainerSettings::SetGroupNameList( KeyMapList m_GroupNameList ) { + std::cout<< "MLER | ButtonContainerSettings:: SetGroupNameList() " << std::endl; this->m_GroupNameList = m_GroupNameList; } @@ -146,7 +177,7 @@ namespace creaPanelButtonContainer { try { - std::cout<< std::endl<<"MLER ButtonContainerSettings / AddButton(groupname...)"<panel == NULL ) @@ -228,6 +261,7 @@ namespace creaPanelButtonContainer void ButtonContainerSettings::AddButtons( BCStructVectorType infoList, int type ) { + std::cout<< "MLER | ButtonContainerSettings:: AddButtons( BCStructVectorType infoList, int type )" << std::endl; try { for( BCStructVectorType::iterator it = infoList.begin( ); it @@ -252,6 +286,7 @@ namespace creaPanelButtonContainer { try { + std::cout<< "MLER | ButtonContainerSettings:: AddItems(BCPSettingsStruct* info)" << std::endl; //builds the button information //I don't know the try catch doesn't work!! if ( info->panel == NULL ) @@ -260,7 +295,9 @@ namespace creaPanelButtonContainer << "exception: NULL Pointer in panel " << std::endl; exit( 1 ); } + info->panel->Show( false ); + std::string mapKey = info->groupName + ":" + info->buttonName; m_itemsMap[mapKey] = info->panel; @@ -277,6 +314,7 @@ namespace creaPanelButtonContainer ButtonContainerSettings::ItemsMap ButtonContainerSettings::GetItemsMap() { + std::cout<< "MLER | ButtonContainerSettings:: GetItemsMap()" << std::endl; return m_itemsMap; } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h index e88f08d..bb00f7d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.h @@ -238,6 +238,9 @@ namespace creaPanelButtonContainer ItemsMap GetItemsMap(); + PanelButton + GetPanelList( const StringType &buttonName ); + // ---------------------------------------------------------------------------------- private: diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx index d377773..7139fd1 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.cxx @@ -36,6 +36,8 @@ namespace creaPanelButtonContainer { BEGIN_EVENT_TABLE(PanelButtonContainer,wxPanel) + //EVT_LIST_ITEM_SELECTED(-1, ListWx::ListEvent) + //(*EventTable(ButtonContainerPanel) //*) END_EVENT_TABLE() @@ -45,7 +47,7 @@ namespace creaPanelButtonContainer 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; + std::cout<< "MLER | creaPanelButtonContainer:: PanelButtonContainer() " << std::endl; this->m_ButtonContainerSettings = bcSettings; this->m_ButtonPanel = new wxPanel( this ); @@ -56,25 +58,36 @@ namespace creaPanelButtonContainer // TConcreteFunctor* functor = new TConcreteFunctor( this->m_ButtonPanel, &PanelButtonContainer::GenericButtonEvent ); //end of the event definition + TConcreteFunctor* lFunctor = new TConcreteFunctor( this, &PanelButtonContainer::GenericListEvent ); + //MLER - wxPanel* listPanel = new wxPanel(this); + this->m_ListPanel = new wxPanel(this); if(type == 0) + { + std::cout << "tipo 0; new ButtonContainerPanel"<m_ButtonContainerPanel = new ButtonContainerPanel( this, this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ),type ); + } else if( type == 1) - this->mylist = new ListWx(listPanel, -1, this->m_ButtonContainerSettings->GetItemsMap(), functor); - //MLER + { + std::cout << "tipo 1; new LIstWx"<mylist = new ListWx(this->m_ListPanel, -1,this->m_ButtonContainerSettings->GetItemsMap(), lFunctor); + }//MLER //Using AuiManager to Manage the Panels this->m_AuiManager = new wxAuiManager( this, wxAUI_MGR_DEFAULT ); - this->m_AuiManager->AddPane(this->m_ButtonPanel, wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( _("Panel") ). CaptionVisible(true ).CloseButton( false ).Bottom( ).Resizable( true ) ); + if(type == 0) + this->m_AuiManager->AddPane(this->m_ButtonContainerPanel, wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( _("Panel") ). CaptionVisible(true ).CloseButton( false ).Bottom( ).Resizable( true ) ); + else if(type == 1) + this->m_AuiManager->AddPane(this->m_ListPanel, wxAuiPaneInfo( ).Name( _T("ListPanel") ).Caption( _("Panel") ). CaptionVisible(true ).CloseButton( false ).Bottom( ).Resizable( true ) ); + //CartoButtonPanel Management if(type == 0) - this->m_AuiManager->AddPane( this->m_ButtonContainerPanel,wxAuiPaneInfo( ).Name( _T("creaButtonContainer") ).Caption(_("creaButtonContainer") ). CaptionVisible( false ).CloseButton(false ).Center( ).Resizable( true ) ); - else - this->m_AuiManager->AddPane( listPanel,wxAuiPaneInfo( ).Name( _T("creaButtonContainer") ).Caption(_("creaButtonContainer") ). CaptionVisible( false ).CloseButton(false ).Center( ).Resizable( true ) ); + this->m_AuiManager->AddPane( this->m_ButtonContainerPanel,wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption(_("ListPanel") ). CaptionVisible( false ).CloseButton(false ).Center( ).Resizable( true ) ); + else if(type ==1) + {this->m_AuiManager->AddPane( this->m_ListPanel,wxAuiPaneInfo( ).Name( _T("ListPanel") ).Caption(_("ListPanel") ). CaptionVisible( false ).CloseButton(false ).Center( ).Resizable( true ) );} this->m_AuiManager->Update( ); } // ---------------------------------------------------------------------------------- @@ -87,16 +100,19 @@ namespace creaPanelButtonContainer { try { + std::cout<< "MLER | creaPanelButtonContainer:: UpdatePanel() " << std::endl; + //Hiding the last CartoSettingsPanel this->m_ButtonPanel->Show( false ); //Finding the CartoSettingsPanel of the ButtonClicket this->m_ButtonPanel = this->m_ButtonContainerSettings->GetPanelButton(buttonName ); + std::cout<< buttonName << "---testEvento 2 "<m_ButtonPanel->GetParent( ) != this ) { this->m_ButtonPanel->Reparent( this ); }//fi - //CartoSettingsPanel Management + //Panel Management this->m_AuiManager->GetPane( _T("ButtonPanel") ).window = this->m_ButtonPanel; //Updating the manager this->m_AuiManager->Update( ); @@ -114,9 +130,52 @@ namespace creaPanelButtonContainer void PanelButtonContainer::GenericButtonEvent( const std::string &buttonName ) { + std::cout<< "MLER | creaPanelButtonContainer:: GenericButtonEvent() " << std::endl; + std::cout<< buttonName << "---testEvento 1 "<UpdatePanel( buttonName ); } // ---------------------------------------------------------------------------------- + + void + PanelButtonContainer::UpdateListPanel( const std::string &buttonName ) + { + try{ + + std::cout<< "MLER | creaPanelButtonContainer:: UpdateListPanel() " << std::endl; + std::cout<< buttonName << " --- test 2 "<m_ListPanel->Show( false ); + + this->m_ListPanel = this->m_ButtonContainerSettings->GetPanelList(buttonName ); + + if ( this->m_ListPanel->GetParent( ) != this ) + { + this->m_ListPanel->Reparent( this ); + }//fi + //Panel Management + this->m_AuiManager->GetPane( _T("ListPanel") ).window = this->m_ListPanel; + //Updating the manager + this->m_AuiManager->Update( ); + + }catch( const std::exception& e ) + { + std::cerr + << "PanelButtonContainer::UpdatePanel( const std::string &buttonName )" + << "exception: " << e.what( ) << std::endl; + std::cout << "Maybe the panel of the list is NULL" << std::endl; + exit( 1 ); + }//hctac + } + + void + PanelButtonContainer::GenericListEvent( const std::string &buttonName ) + { + std::cout<< "MLER | creaPanelButtonContainer:: GenericListEvent() " << std::endl; + std::cout<< buttonName << " --- test 3 "<UpdateListPanel( buttonName ); + } + + }//ecapseman diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h index acbe800..93ea3da 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/creaPanelButtonContainer.h @@ -36,6 +36,7 @@ #include #include #include +#include #include "containerSettings.h" #include "buttonContainerPanel.h" @@ -101,6 +102,15 @@ namespace creaPanelButtonContainer */ void GenericButtonEvent( const std::string &buttonName ); + + // ---------------------------------------------------------------------------------- + void + UpdateListPanel( const std::string &buttonName ); + + void + GenericListEvent( const std::string &buttonName ); + //MLER + // ---------------------------------------------------------------------------------- private: //Settings @@ -109,7 +119,7 @@ namespace creaPanelButtonContainer ButtonContainerPanel* m_ButtonContainerPanel; //!