ButtonContainerSettings* settings = new ButtonContainerSettings( );
printf("EED PanelButtonContainer::Process %d\n", bbGetInputIn( ).size() );
- //if(bbGetInputType()== "1")
- //{
- // settings->AddItems(bbGetInputIn());
-
- //}
- //else {
- settings->AddButtons(bbGetInputIn( ));
- //}
+
+ settings->AddButtons(bbGetInputIn( ), bbGetInputType());
+
PBContainer* panel = new PBContainer( myPanel, settings, bbGetInputType() );
# ------------------------------------------------------------------------ */
-#include "listGroupFactory.h"
+/*#include "listGroupFactory.h"
namespace creaButtonContainer
{
}
// ----------------------------------------------------------------------------------
}//ecapseman
-}//ecapseman
+}//ecapseman*/
# knowledge of the CeCILL-B license and that you accept its terms.
# ------------------------------------------------------------------------ */
-#ifndef LISTGROUPFACTORY_H
+/*#ifndef LISTGROUPFACTORY_H
#define LISTGROUPFACTORY_H
#include <wx/window.h>
}//ecapseman
}//ecapseman
-#endif // LISTGROUPFACTORY_H
+#endif // LISTGROUPFACTORY_H*/
std::cout<< std::endl << " MLER buttonContainerPanel.cxx / ButtonContainerPanel() " << std::endl;
ButtonGroupFactory factory;
- ListGroupFactory listFactory;
+ //ListGroupFactory listFactory;
//MLER this->SetButtonGroupContainer( factory.CreateButtonGroupContainer( this, settings ) );
case 0:
this->SetButtonGroupContainer( factory.CreateButtonGroupContainer( this, settings ) );
break;
- case 1:
- this->SetListGroupContainer(listFactory.CreateButtonGroupContainer( this, settings ) );
+ //case 1:
+ //this->SetListGroupContainer(listFactory.CreateButtonGroupContainer( this, settings ) );
// MLER Verificar ButtonGroupList contra ListGroupList
- break;
+ //break;
default:
this->SetButtonGroupContainer(factory.CreateButtonGroupContainer( this, settings ) );
}
this->m_ButtonGroupList = groupContainer;
}
// ----------------------------------------------------------------------------------
- void ButtonContainerPanel::SetListGroupContainer(ListGroupList groupContainer )
+ /*void ButtonContainerPanel::SetListGroupContainer(ListGroupList groupContainer )
{
this->m_ListGroupList = groupContainer;
- }
+ }*/
// ----------------------------------------------------------------------------------
void ButtonContainerPanel::PanelInit( int type )
this->m_Sizer->Add( manager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
}
}
- else
+ /*else
{
for(ListGroupList::iterator it1 = this->m_ListGroupList.begin(); it1 != this->m_ListGroupList.end(); ++it1)
{
this->m_GroupManagerList[ manager->GetButtonID( ) ] = manager;
this->m_Sizer->Add( manager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
}
- }//MLER
+ }//MLER*/
this->SetSizer( this->m_Sizer );
this->Layout( );
typedef creaButtonContainer::controller::ButtonContainerController
BCController;
- typedef creaButtonContainer::model::ListGroupFactory ListGroupFactory;
+ //typedef creaButtonContainer::model::ListGroupFactory ListGroupFactory;
- typedef creaButtonContainer::view::ListGroup ListGroup;
+ //typedef creaButtonContainer::view::ListGroup ListGroup;
- typedef std::list< ListGroup* > ListGroupList;
+ //typedef std::list< ListGroup* > ListGroupList;
//typedef creaButtonContainer::model::ListGroupFactory ListGroupFactory;
PanelInit( int type);
// ----------------------------------------------------------------------------------
- void
- SetListGroupContainer(ListGroupList groupContainer );
+ //void
+ //SetListGroupContainer(ListGroupList groupContainer );
// ----------------------------------------------------------------------------------
/*! @fn FitSizer( );
* This method fits and organizes the sizer.
BCController* m_ButtonCController; //!<Pontier to controller.
Sizer* m_Sizer; //!<Pointer to wxSizer
- ListGroupList m_ListGroupList;
+ //ListGroupList m_ListGroupList;
DECLARE_EVENT_TABLE() //!<Event Table declaration.
};
}//ecapseman
}
// ----------------------------------------------------------------------------------
//MLER
- ButtonManager::ButtonManager (ListGroup* buttonGroup):
+ /*ButtonManager::ButtonManager (ListGroup* buttonGroup):
wxFlexGridSizer( 0, 1, 0, 0 )
{
try
{
std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl;
}//hctac
- }
+ }*/
// ----------------------------------------------------------------------------------
ButtonManager::~ButtonManager( )
{
}
// ----------------------------------------------------------------------------------
- void ButtonManager::SetListManager(ListContainer buttonContainer )
+ /*void ButtonManager::SetListManager(ListContainer buttonContainer )
{
try
{
<< "ButtonManager::SetButtonManager( ButtonContainer buttonContainer )"
<< "exception: " << e.what( ) << std::endl;
}//hctac
- }
+ }*/
// ----------------------------------------------------------------------------------
typedef std::map< long, Button* > ButtonContainer;
// ----------------------------------------------------------------------------------
//MLER
- typedef creaButtonContainer::view::ListGroup ListGroup;
- typedef std::map<long, ListWx* > ListContainer;
+ //typedef creaButtonContainer::view::ListGroup ListGroup;
+ //typedef std::map<long, ListWx* > ListContainer;
//end of typedef definition.
public:
ButtonManager( ButtonGroup* buttonGroup );
// ----------------------------------------------------------------------------------
//MLER
- ButtonManager (ListGroup* buttonGroup);
+ //ButtonManager (ListGroup* buttonGroup);
// ----------------------------------------------------------------------------------
/*! @fn ~ButtonManager( );
SetButtonManager( ButtonContainer buttonContainer );
// ----------------------------------------------------------------------------------
//MLER
- void
- SetListManager( ListContainer buttonContainer );
+ /*void
+ SetListManager( ListContainer buttonContainer );*/
// ----------------------------------------------------------------------------------
this->Add( this->m_ButtonManager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
}
- GroupManager::GroupManager(wxWindow* parent, ListGroup* buttonGroup ):
+ /*GroupManager::GroupManager(wxWindow* parent, ListGroup* buttonGroup ):
wxFlexGridSizer( 1, 0, 0, 0 )
{
std::cout << " MLER groupManager.cxx / GroupManager(ListGroup* buttonGroup) " << std::endl;
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
+ }//MLER*/
// ----------------------------------------------------------------------------------
GroupManager::~GroupManager( )
typedef wxButton ExpansionButton;
// ----------------------------------------------------------------------------------
//MLER
- typedef creaButtonContainer::view::ListGroup ListGroup;
+ //typedef creaButtonContainer::view::ListGroup ListGroup;
//end of typedef definition.
public:
// ----------------------------------------------------------------------------------
//MLER
- GroupManager( wxWindow* parent, ListGroup* listGroup );
+ //GroupManager( wxWindow* parent, ListGroup* listGroup );
/*! @fn ~GroupManager( );
* @brief This is the destructor.
*/
# knowledge of the CeCILL-B license and that you accept its terms.
# ------------------------------------------------------------------------ */
-#include "listGroup.h"
+/*#include "listGroup.h"
namespace creaButtonContainer
{
}
// ----------------------------------------------------------------------------------
}//ecapseman
-}//ecapseman
+}//ecapseman*/
#ifndef LISTGROUP_H
#define LISTGROUP_H
-//Library Definition
+/*//Library Definition
#include <wx/stattext.h>
#include <map>
ButtonContainer m_Buttons; //!<A container with buttons.
};
}//ecapseman
-}//ecapseman
+}//ecapseman*/
#endif // LISTGROUP_H
namespace view
{
// ----------------------------------------------------------------------------------
- ListWx::ListWx( wxWindow* parent, long id, ButtonPair* pair )
+ ListWx::ListWx( wxWindow* parent, wxWindowID id, ItemsMap iMap , TFunctor* functor ): wxListCtrl(parent,id)
{
- 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 );
-
-
- long index = this->InsertItem(0, _("John Smith"));
- this->SetItem(index, 1, _("jsmith"));
-
- index = this->InsertItem(1, _("Monica"));
- this->SetItem(index, 1, _("monica"));
-
- index = this->InsertItem(2, _("Momo"));
- this->SetItem(index, 2, _("momo"));
-
-
-
+ this->m_itemsMap = iMap;
+ this->functor = functor;
+ 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 );
+ }
}
// ----------------------------------------------------------------------------------
{
}
- // ----------------------------------------------------------------------------------
- StringType
- ListWx::GetButtonName( )
- {
- return ( this->m_ButtonPair->first->first );
- }
-
- // ----------------------------------------------------------------------------------
- BitmapType
- ListWx::GetIcon( )
- {
- 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( )
+ ListWx::ButtonEvent( wxCommandEvent& event )
{
try
{
- TFunctor* vTable[ ] =
- { this->m_ButtonPair->second->second };
- vTable[ 0 ]->Call( this->m_ButtonPair->first->first );
+ //MLDR - Aqui necesita el nombre de la funcion para poderla ejecutar
+ this->functor->Call("PanelButtonContainer::GenericButtonEvent");
}//yrt
catch ( const std::exception& e )
{
- std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl;
+ std::cerr
+ << "ButtonContainerController::ButtonEvent( wxCommandEvent& event ) exception: "
+ << e.what( ) << std::endl;
}//hctac
}
// ----------------------------------------------------------------------------------
#define LISTWX_H
//#include <wx/bmpbuttn.h>
+#include <wx/panel.h>
#include <wx/image.h>
#include <wx/string.h>
#include <wx/bitmap.h>
#include <wx/listctrl.h>
+#include <map>
+#include <cstring>
+#include "functor.h"
#include "system.h"
public:
typedef creaButtonContainer::model::TFunctor TFunctor;
-
+ typedef std::map<std::string, wxPanel*> ItemsMap;
public:
- ListWx( wxWindow* parent, long id, ButtonPair* pair );
+ ListWx( wxWindow* parent, wxWindowID id, ItemsMap iMap , TFunctor* functor );
// ----------------------------------------------------------------------------------
virtual
long
GetID( );
- // ----------------------------------------------------------------------------------
-
- StringType
- GetButtonName( );
-
- // ----------------------------------------------------------------------------------
-
- BitmapType
- GetIcon( );
-
- // ----------------------------------------------------------------------------------
-
- StringType
- GetDescription( );
- // ----------------------------------------------------------------------------------
void
- Execute( );
+ ButtonEvent( wxCommandEvent& event );
// ----------------------------------------------------------------------------------
private:
- ButtonPair* m_ButtonPair; //! <The pair with the button information.
+ ItemsMap m_itemsMap; //! <The pair with the button information.
+ TFunctor* functor;
};
}//ecapseman
// ----------------------------------------------------------------------------------
void
- ButtonContainerSettings::AddButtons( BCStructVectorType infoList )
+ ButtonContainerSettings::AddButtons( BCStructVectorType infoList, int type )
{
try
{
for( BCStructVectorType::iterator it = infoList.begin( ); it
!= infoList.end( ); ++it )
{
- this->AddButton( *it );
+ if( type == 0 )
+ this->AddButton( *it );
+ else if( type == 1 )
+ this->AddItems(*it);
}//rof
}//yrt
catch ( std::exception& e )
}//hctac
}
+ void
+ ButtonContainerSettings::AddItems(BCPSettingsStruct* info)
+ {
+ try
+ {
+ //builds the button information
+ //I don't know the try catch doesn't work!!
+ if ( info->panel == NULL )
+ {
+ std::cerr << "ButtonContainerSettings::AddButton"
+ << "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;
+
+ }//yrt
+ catch ( const std::exception& e )
+ {
+ std::cerr
+ << "ButtonContainerSettings::AddButton( BCPSettingsStruct* info )"
+ << "exception: " << e.what( ) << std::endl;
+ exit( 1 );
+ }//hctac
+ }
+
+ ButtonContainerSettings::ItemsMap
+ ButtonContainerSettings::GetItemsMap()
+ {
+ return m_itemsMap;
+ }
+
// ----------------------------------------------------------------------------------
}//ecapseman
* @brief This class contains the settings of the button container.
*/
-
+ typedef std::map< std::string, wxPanel* > ItemsMap;
public:
// ----------------------------------------------------------------------------------
/*! @fn ButtonContainerSettings( );
* @exception std::bad_alloc
*/
void
- AddButtons( BCStructVectorType infoList );
+ AddButtons( BCStructVectorType infoList, int type );
+
+ void
+ AddItems(BCPSettingsStruct* info);
+
+ ItemsMap
+ GetItemsMap();
// ----------------------------------------------------------------------------------
ButtonGroupMap m_ButtonGroupContainer; //!<This is the map with the groups of buttons.
KeyMapList m_GroupNameList; //!<This is a container with the name of the groups.
- };
+ //MLER
+ ItemsMap m_itemsMap; //This is the map with the name and the wPanel
+ };
}//ecapseman
#endif /* BUTTONCONTAINERSETTINGS_H_ */
#include "creaPanelButtonContainer.h"
+
namespace creaPanelButtonContainer
{
BEGIN_EVENT_TABLE(PanelButtonContainer,wxPanel)
// TConcreteFunctor* functor = new TConcreteFunctor( this->m_ButtonPanel, &PanelButtonContainer::GenericButtonEvent );
//end of the event definition
- this->m_ButtonContainerPanel = new ButtonContainerPanel( this, this->m_ButtonContainerSettings->GetButtonGroupSettings( functor ),type );
+
+ wxPanel* listPanel = new wxPanel(this);
+
+ if(type == 0)
+ this->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
+
//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 ) );
//CartoButtonPanel Management
- this->m_AuiManager->AddPane( this->m_ButtonContainerPanel,wxAuiPaneInfo( ).Name( _T("creaButtonContainer") ).Caption(_("creaButtonContainer") ). CaptionVisible( false ).CloseButton(false ).Center( ).Resizable( true ) );
+ 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->Update( );
}
// ----------------------------------------------------------------------------------
#include "buttonContainerPanel.h"
#include "buttonContainerSettings.h"
#include "functor.h"
+#include "listWx.h"
/*! @namespace <creaPanelButtonContainer>
* @brief Contains the creaPanelButtonContainer library included in creaMaracasVisu.
*/
typedef creaButtonContainer::view::ButtonContainerPanel
ButtonContainerPanel;
+ typedef creaButtonContainer::view::ListWx ListWx;
// ----------------------------------------------------------------------------------
//end of typedef definition.
public:
ButtonContainerPanel* m_ButtonContainerPanel; //!<This is the panel with de buttons (creaButtonContainer)
wxAuiManager* m_AuiManager; //!<The AUI Manager for the panels.
wxPanel* m_ButtonPanel; //!<This is the panel used to contain the panels of the buttons. (it changes with the buttonAction)
+
+
+ ListWx* mylist; //MLER
+
DECLARE_EVENT_TABLE() //!<Event Table declaration.
};
}//ecapseman