END_EVENT_TABLE()
// ----------------------------------------------------------------------------------
- ButtonContainerPanel::ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings, int type )
+ ButtonContainerPanel::ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings )
: wxScrolledWindow(parent,-1, wxDefaultPosition,wxDefaultSize, wxTAB_TRAVERSAL | wxVSCROLL | wxHSCROLL | wxFULL_REPAINT_ON_RESIZE, _T("creaButtonContainer") )
{
std::cout<< "MLER | ButtonContainerPanel::ButtonContainerPanel( )" << std::endl;
ButtonGroupFactory factory;
- //ListGroupFactory listFactory;
- //MLER this->SetButtonGroupContainer( factory.CreateButtonGroupContainer( this, settings ) );
- std::cout<< std::endl << " MLER buttonContainerPanel.cxx / ButtonContainerPanel() :: type " << type<<std::endl;
- switch (type)
- {
- case 0:
- this->SetButtonGroupContainer( factory.CreateButtonGroupContainer( this, settings ) );
- break;
- //case 1:
- //this->SetListGroupContainer(listFactory.CreateButtonGroupContainer( this, settings ) );
- // MLER Verificar ButtonGroupList contra ListGroupList
- //break;
- default:
- this->SetButtonGroupContainer(factory.CreateButtonGroupContainer( this, settings ) );
- }
+ this->SetButtonGroupContainer( factory.CreateButtonGroupContainer( this, settings ) );
+
- this->PanelInit(type );
+ this->PanelInit( );
this->m_ButtonCController = new BCController( this );
this->m_ButtonCController->AddEvents( );
this->SetEventHandler( this->m_ButtonCController );
}*/
// ----------------------------------------------------------------------------------
- void ButtonContainerPanel::PanelInit( int type )
+ void ButtonContainerPanel::PanelInit( )
{
- std::cout<< "MLER | ButtonContainerPanel::PanelInit( int type )" << std::endl;
+ std::cout<< "MLER | ButtonContainerPanel::PanelInit( )" << std::endl;
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 == 0)
- {
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(ListGroupList::iterator it1 = this->m_ListGroupList.begin(); it1 != this->m_ListGroupList.end(); ++it1)
- {
- 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( );
* @param parent wxWindow pointer to parent.
* @param settings ButtonGroupSettings Pointer to button container settings.
*/
- ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings, int type );
+ ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings);
// ----------------------------------------------------------------------------------
/*! @fn ~ButtonContainerPanel( );
* @brief This is the destructor.
* @exception std::bad_alloc
*/
void
- PanelInit( int type);
+ PanelInit( );
// ----------------------------------------------------------------------------------
//void
{
namespace view
{
- // ----------------------------------------------------------------------------------
+
ListWx::ListWx( wxWindow* parent, wxWindowID id,ItemsMap iMap , TFunctor* functor ):
wxPanel(parent,id)
{
std::cout << "is ListBox"<< listBox->GetId()<< std::endl;
// this->Connect( -1,wxEVT_COMMAND_CHOICE_SELECTED,
// (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))(&ListWx::ListEvent) );
- this->Connect(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,
- wxCommandEventHandler(ListWx::ListEvent));
+ //this->Connect(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,
+ // wxCommandEventHandler(ListWx::ListEvent));
- for (ItemsMap::iterator it=this->m_itemsMap.begin(); it!=this->m_itemsMap.end(); ++it)
- {
+ this->Connect(wxEVT_COMMAND_LISTBOX_SELECTED,
+ wxCommandEventHandler(ListWx::ListEvent));
- std::string key = it->first;
+ //FillList(0);
- listBox->Append( wxString(key.c_str(), wxConvUTF8));
- }
sizer->Add(listBox,1,wxGROW);
}
// ----------------------------------------------------------------------------------
+
+ ListWx::ListWx( wxWindow* parent, wxWindowID id, ItemsMap iMap,TFunctor* functor,
+ std::string c) : wxPanel(parent,id)
+ {
+ std::cout<< "MLER | ListWx::ListWx" << std::endl;
+
+ this->m_itemsMap = iMap;
+ this->functor = functor;
+
+ wxFlexGridSizer* sizer = new wxFlexGridSizer(1);
+
+ sizer->Add( new wxStaticText(this,-1, _("Lista Configurable")));
+ sizer->AddGrowableCol(0);
+ this->SetSizer(sizer);
+
+ listBox = new wxListBox(this,-1);
+
+ std::cout << "is ListBox"<< listBox->GetId()<< std::endl;
+
+ button = new wxButton(this, 1, _("Configurar"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxString(c.c_str(), wxConvUTF8));
+
+ sizer->Add(listBox,1,wxGROW);
+ sizer->Add(button,2,wxGROW);
+
+ // m_listConfigPanel = new ListConfigPanel(this,1,_("Configuracion"),m_itemsMap);
+ m_listConfig = new ListConfig(m_itemsMap);
+
+ //wxEVT_COMMAND_LISTBOX_SELECTED
+ this->Connect(wxEVT_COMMAND_LISTBOX_SELECTED,
+ wxCommandEventHandler(ListWx::ListEvent));
+
+ //FillList();
+
+ }
+
+ // ----------------------------------------------------------------------------------
+
ListWx::~ListWx( )
{
}
+ // ----------------------------------------------------------------------------------
+
+ void
+ ListWx::FillList()
+ {
+ this->listBox->Clear();
+ std::cout<<"clear"<<std::endl;
+ for (ItemsMap::iterator it=this->m_itemsMap.begin(); it!=this->m_itemsMap.end(); ++it)
+ {
+ std::string key = it->first;
+ int v = listBox->FindString(wxString(key.c_str(), wxConvUTF8));
+ if(v == -1)
+ listBox->Append( wxString(key.c_str(), wxConvUTF8));
+ }
+ listBox->Update();
+ this->Update();
+ }
+ // ----------------------------------------------------------------------------------
void
ListWx::ListEvent( wxCommandEvent& event )
{
+ if(!this->IsFunctorEnabled())
+ return;
try
{
std::cout<< "MLER | ListWx::ListEvent( wxListEvent& event )" << std::endl;
this->functor->Call(itemNomC);
std::cout<<"mmmmmmmmmmmmmmmmmmmmmmm"<<std::endl;
+
}//yrt
catch ( const std::exception& e )
{
<< e.what( ) << std::endl;
}//hctac
}
- // ----------------------------------------------------------------------------------
+ // ----------------------------------------------------------------------------------
+
+
+
+ ListWx::ItemsMap
+ ListWx::GetItemsMap()
+ {
+ return m_itemsMap;
+ }
+
+ void ListWx::SetFunctorEnabled(const bool& enabled)
+ {
+ m_functorEnabled = enabled;
+ }
+
+ bool ListWx::IsFunctorEnabled() const
+ {
+ return m_functorEnabled;
+ }
+
+ ListWx::TFunctor*
+ ListWx::GetWxListFunctor()
+ {
+ return this->functor;
+ }
+
+ void ListWx::AddItemToMap(std::string key, wxPanel* panel)
+ {
+ this->m_itemsMap[key] = panel;
+ }
+
+ wxListBox*
+ ListWx::GetListBox() const
+ {
+ return this->listBox;
+ }
+
+
+ void ListWx::DeleteItemFromMap(std::string key)
+ {
+ std::cout<< "MLER | ListConfig::DelFinalItems(std::string name)" << std::endl;
+ ItemsMap::iterator it1;
+
+ //if(m_finalItems.empty())
+ std::cout<<"name item -----test A"<< key <<std::endl;
+ if(!this->m_itemsMap.empty())
+ {
+ for(ItemsMap::iterator it= this->m_itemsMap.begin(); it!=this->m_itemsMap.end();++it)
+ {
+ if((it->first).compare(key) == 0 )
+ {
+ std::cout << "Item a borrar: "<< key << std::endl;
+ it1 = m_itemsMap.find(key);
+ m_itemsMap.erase(it1);
+
+ }
+ }
+ }
+ std::cout<< "si borre tengo --- test 2 "<< m_itemsMap.size() << std::endl;
+ }
+
+
}//ecapseman
}//ecapseman
/*# ---------------------------------------------------------------------
-#
-# 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.
-# ------------------------------------------------------------------------ */
-
+ #
+ # 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 <wx/listbox.h>
#include <wx/wx.h>
-
#include <map>
#include <string>
#include "functor.h"
#include <wx/event.h>
#include "system.h"
+#include "listConfig.h"
+//#include "listConfigPanel.h"
+
+namespace creaButtonContainer {
+
+namespace view {
+
+class ListWx: public wxPanel {
+public:
+
+ typedef creaButtonContainer::model::TFunctor TFunctor;
+ typedef std::map<std::string, wxPanel*> ItemsMap;
+ typedef creaButtonContainer::model::ListConfig ListConfig;
+
+public:
+
+ ListWx(wxWindow* parent, wxWindowID id, ItemsMap iMap, TFunctor* functor);
+ ListWx(wxWindow* parent, wxWindowID id, ItemsMap iMap, TFunctor* functor,
+ std::string c);
+ // ----------------------------------------------------------------------------------
+
+ virtual
+ ~ListWx();
+ // ----------------------------------------------------------------------------------
-namespace creaButtonContainer
-{
+ long
+ GetID();
- namespace view
- {
+ void
+ FillList();
- class ListWx : public wxPanel
- {
- public:
+ void
+ ListEvent(wxCommandEvent& event);
- typedef creaButtonContainer::model::TFunctor TFunctor;
- typedef std::map<std::string, wxPanel*> ItemsMap;
+ ItemsMap
+ GetItemsMap();
- public:
+ TFunctor*
+ GetWxListFunctor();
- ListWx( wxWindow* parent, wxWindowID id,ItemsMap iMap , TFunctor* functor );
- // ----------------------------------------------------------------------------------
+ void SetFunctorEnabled(const bool& enabled);
- virtual
- ~ListWx( );
- // ----------------------------------------------------------------------------------
+ void AddItemToMap(std::string key, wxPanel* panel);
- long
- GetID( );
+ void DeleteItemFromMap(std::string key);
- void
- ListEvent( wxCommandEvent& event );
- // ----------------------------------------------------------------------------------
- private:
- ItemsMap m_itemsMap; //! <The pair with the button information.
- TFunctor* functor;
- //wxPanel* panel;
- wxListBox* listBox;
- wxFlexGridSizer* sizer;
+ bool IsFunctorEnabled() const;
+ wxListBox*
+ GetListBox() const;
- };
- }//ecapseman
-}//ecapseman
+ // ----------------------------------------------------------------------------------
+private:
+ ItemsMap m_itemsMap; //!
+ TFunctor* functor;
+ wxListBox* listBox;
+ wxFlexGridSizer* sizer;
+ wxButton* button;
+ bool m_functorEnabled;
+ ListConfig* m_listConfig;
+};
+} //ecapseman
+} //ecapseman
#endif // LISTWX_H
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 )
+ {
+ std::cout<<"debe retornar" << std::endl;
return ( (*it).second );
+ }
}
{
if( type == 0 )
this->AddButton( *it );
- else if( type == 1 )
+ else if( type == 1 || type == 2)
this->AddItems(*it);
+
}//rof
}//yrt
catch ( std::exception& e )
//I don't know the try catch doesn't work!!
if ( info->panel == NULL )
{
- std::cerr << "ButtonContainerSettings::AddButton"
+ std::cerr << "ButtonContainerSettings::AddItems"
<< "exception: NULL Pointer in panel " << std::endl;
exit( 1 );
}
ButtonContainerSettings::GetItemsMap()
{
std::cout<< "MLER | ButtonContainerSettings:: GetItemsMap()" << std::endl;
+
return m_itemsMap;
}
{
this->m_ButtonPanel = new wxPanel( this );
std::cout << "tipo 0; new ButtonContainerPanel"<<std::endl;
- this->m_ButtonContainerPanel = new ButtonContainerPanel( this, this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ),type );
+ this->m_ButtonContainerPanel = new ButtonContainerPanel( this, this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ) );
this->m_AuiManager->AddPane( this->m_ButtonContainerPanel,wxAuiPaneInfo( ).Name( _T("ButtonContainerPanel") ).Caption(_("ButtonContainerPanel") ). CaptionVisible( true ).CloseButton(false ).Center( ).Resizable( true ) );
this->m_AuiManager->AddPane(this->m_ButtonPanel, wxAuiPaneInfo( ).Name( _T("ButtonPanel") ).Caption( _("ButtonPanel") ). CaptionVisible(true ).CloseButton( false ).Bottom( ).Resizable( true ) );
this->m_AuiManager->AddPane( this->mylist,wxAuiPaneInfo( ).Name( _T("ListContainerPanel") ).Caption(_("ListContainerPanel") ). CaptionVisible( true ).CloseButton(false ).Center( ).Resizable( true ) );
this->m_AuiManager->AddPane(this->m_ListPanel, wxAuiPaneInfo( ).Name( _T("ListPanel") ).Caption( _("ListPanel") ). CaptionVisible(true ).CloseButton( false ).Bottom( ).Resizable( true ) );
- }//MLER
+ }
+ else if( type == 2)
+ {
+ /*this->m_ListPanel = new wxPanel(this);
+ std::cout << "tipo 2; new LIstWx"<<std::endl;
+ this->mylist = new ListWx(this, -1,this->m_ButtonContainerSettings->GetItemsMap(), lFunctor);
+ this->mylist->Show(false);
+ ItemsMap empty;
+ this->myConfiglist = new ListWx(this,-1, empty,lFunctor);
+ //wxButton
+ wxPanel* panelButton = new wxPanel(this);
+ wxBoxSizer* buttonSizer = new wxBoxSizer(wxHORIZONTAL);
+ button = new wxButton(panelButton, -1, _("Configurar"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Configurar"));
+ buttonSizer->Add(button,0,wxEXPAND);
+ panelButton->SetSizer(buttonSizer);
+
+ this->m_AuiManager->AddPane( panelButton,wxAuiPaneInfo( ).Name( _T("ListConfigContainerPanel") ).Caption(_("ListConfigContainerPanel") ). CaptionVisible( true ).CloseButton(false ).Center( ).Resizable( true ) );
+
+ this->m_AuiManager->AddPane( this->myConfiglist,wxAuiPaneInfo( ).Name( _T("ListContainerPanel") ).Caption(_("ListContainerPanel") ). CaptionVisible( true ).CloseButton(false ).Center( ).Resizable( true ) );
+
+ this->m_AuiManager->AddPane(this->m_ListPanel, wxAuiPaneInfo( ).Name( _T("ListPanel") ).Caption( _("ListPanel") ). CaptionVisible(true ).CloseButton( false ).Bottom( ).Resizable( true ) );
+ */
+
+ this->m_ListPanel = new wxPanel(this);
+
+ panelUp = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ListConfigContainerPanel"));
+ wxBoxSizer* mainSizer = new wxBoxSizer(wxHORIZONTAL);
+
+ //=======
+ wxBoxSizer* listSizer = new wxBoxSizer(wxVERTICAL);
+
+ this->mylist = new ListWx(panelUp,-1,this->m_ButtonContainerSettings->GetItemsMap(),lFunctor);
+ this->mylist->Show(false);
+ ItemsMap empty;
+ this->myConfiglist = new ListWx(panelUp,-1, empty,lFunctor);
+ listSizer->Add(this->myConfiglist,0,wxEXPAND);
+ listSizer->Add(this->mylist,0,wxEXPAND);
+ mainSizer->Add(listSizer,0,wxEXPAND|wxALL,7);
+ //=======
+ wxBoxSizer* buttonSizer = new wxBoxSizer(wxVERTICAL);
- //CartoButtonPanel Management
+ button = new wxButton(panelUp, -1, _("Configurar"),
+ wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _("Configurar"));
+ buttonSizer->Add(button,0,wxEXPAND);
+ mainSizer->Add(buttonSizer,0,wxEXPAND|wxALL,14);
+ //=======
+
+ panelUp->SetSizer(mainSizer);
+
+ this->m_AuiManager->AddPane( panelUp,wxAuiPaneInfo( ).Name( _T("ListConfigContainerPanel") ).Caption(_("ListConfigContainerPanel") ). CaptionVisible( true ).CloseButton(false ).Center( ).Resizable( true ) );
+ this->m_AuiManager->AddPane(this->m_ListPanel, wxAuiPaneInfo( ).Name( _T("ListConfigPanel") ).Caption( _("ListConfigPanel") ). CaptionVisible(true ).CloseButton( false ).Bottom( ).Resizable( true ) );
+ }
+
+ //MLER
this->m_AuiManager->Update( );
+ //m_listConfigPanel = new ListConfigPanel(this,1,_("Configuracion"),mylist);
+
+ this->Connect(wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(PanelButtonContainer::ButtonEvent));
+
}
// ----------------------------------------------------------------------------------
PanelButtonContainer::~PanelButtonContainer( )
this->UpdateListPanel( buttonName );
}
+ void
+ PanelButtonContainer::ButtonEvent ( wxCommandEvent& event )
+ {
+
+ m_listConfigPanel = new ListConfigPanel(this,-1,_("Configuracion"), mylist, myConfiglist);
+
+ std::cout<< "BUtton Event"<<std::endl;
+
+ if ( m_listConfigPanel->ShowModal() == 1 )
+ {
+ this->myConfiglist->Reparent(panelUp);
+ this->myConfiglist->Show(true);
+ this->myConfiglist->SetFunctorEnabled(true);
+ this->panelUp->Update();
+ this->m_AuiManager->Update( );
+ }
+ }
+
+
+
}//ecapseman
#include "buttonContainerSettings.h"
#include "functor.h"
#include "listWx.h"
+#include "listConfigPanel.h"
/*! @namespace <creaPanelButtonContainer>
* @brief Contains the creaPanelButtonContainer library included in creaMaracasVisu.
typedef creaButtonContainer::view::ButtonContainerPanel
ButtonContainerPanel;
typedef creaButtonContainer::view::ListWx ListWx;
+ typedef creaPanelButtonContainer::ListConfigPanel
+ ListConfigPanel;
+ typedef std::map<std::string, wxPanel*> ItemsMap;
+
// ----------------------------------------------------------------------------------
//end of typedef definition.
public:
void
GenericListEvent( const std::string &buttonName );
+
//MLER
+ void
+ ButtonEvent ( wxCommandEvent& event );
+
+ void
+ ListEvent( wxCommandEvent& event );
+
// ----------------------------------------------------------------------------------
private:
//Settings
wxPanel* m_ListPanel;
ListWx* mylist; //MLER
+ ListWx* myConfiglist; //MLER
+ wxButton* button;
+ ListConfigPanel* m_listConfigPanel;
+ wxPanel* panelUp;
+
DECLARE_EVENT_TABLE() //!<Event Table declaration.
};