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() );
//=====
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);
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);
//=====
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 )
{
// ----------------------------------------------------------------------------------
- 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,
}//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
void
SetGroupNameList( KeyMapList gNameList );
- ListGroupMap
- GetListGroupContainer( );
-
- void
- SetListGroupContainer( ListGroupMap lstContainer );
-
// ----------------------------------------------------------------------------------
/*!
AddButtons( BCStructVectorType infoList );
// ----------------------------------------------------------------------------------
- void
+ /* void
AddItem(const StringType & groupName);
void
AddItem( BCSettingsStruct* info );
void
- AddItems( BCStructVectorType infoList );
+ AddItems( BCStructVectorType infoList );*/
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
ButtonGroupMap m_ButtonGroupContainer; //! <The container with the group of buttons.
KeyMapList m_GroupNameList; //! <The container with the name of the groups of buttons.
- ListGroupMap m_ListGroupContainer; // contenedor del grupo de listas
+ //ListGroupMap m_ListGroupContainer; // contenedor del grupo de listas
};
}
}
# knowledge of the CeCILL-B license and that you accept its terms.
# ------------------------------------------------------------------------ */
-/*!
- * @file buttonGroupFactory.cxx
- * @brief Implements the ButtonGroupFactory class.
- * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
- * @date 2011-06-02
- */
#include "listGroupFactory.h"
}
// ----------------------------------------------------------------------------------
- ListGroupFactory::ListGroupContainer ListGroupFactory::CreateListGroupContainer(wxWindow* parent,ListModel* settings )
+ ListGroupFactory::ButtonGroupContainer ListGroupFactory::CreateButtonGroupContainer( wxWindow* parent, ButtonGroupModel* settings )
{
- ListGroupContainer groupView;
+ ButtonGroupContainer groupView;
try
{
- ListGroupMap map = settings->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 );
// ----------------------------------------------------------------------------------
- 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
<< "exception: " << e.what( ) << std::endl;
}//chtac
- return ( cList ); // JPR
+ return ( buttonList ); // JPR
}
// ----------------------------------------------------------------------------------
}//ecapseman
}//ecapseman
+
# 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 <wx/window.h>
-#include <wx/listctrl.h>
-#include "listWx.h"
#include "system.h"
+#include "button.h"
#include "listGroup.h"
#include "containerSettings.h"
-/*! @namespace <creaButtonContainer>
- * @brief Contains the creaButtonContainer library included in creaMaracasVisu.
- */
+
namespace creaButtonContainer
{
- /*! @namespace <creaButtonContainer::model>
- * @brief Contains the implementation of the model in creaButtonContainer library.
- * @see <a href="http://en.wikipedia.org/wiki/Model-view-controller">MVC Software Architecture</a>
- */
+
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 <a href="http://en.wikipedia.org/wiki/Factory_method_pattern">Factory Pattern</a>
- */
+
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<ListWx> 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
#include <exception>
#include <string>
#include "functor.h"
-#include <listWx.h>
-#include <wx/listctrl.h>
+//#include "listWx.h"
+//#include <wx/listctrl.h>
/*! @namespace <creaButtonContainer>
}*/
namespace creaButtonContainer
{
- using namespace view;
+ //using namespace view;
// ----------------------------------------------------------------------------------
/*! @typedef std::string* StringType;
* @brief Defines the StringType type.
//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
// ----------------------------------------------------------------------------------
}
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 );
}
#ifndef BUTTON_H
#define BUTTON_H
+//#include <wx/listctrl.h>
#include <wx/bmpbuttn.h>
#include <wx/image.h>
#include <wx/string.h>
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<<std::endl;
+ switch (type)
+ {
+ case 0:
+ this->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( );
}
// ----------------------------------------------------------------------------------
- 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 )
{
}
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( );
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
* @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.
* @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.
{
try
{
+ std::cout << " MLER buttonManager.cxx / GroupManager(ButtonGroup* buttonGroup) " << std::endl;
this->SetGroupName( buttonGroup->GetGroupName( ) );
this->SetButtonManager( buttonGroup->GetButtonContainer( ) );
}//yrt
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( )
{
}//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( )
{
#include "button.h"
#include "buttonGroup.h"
+#include "listWx.h"
+#include "listGroup.h"
/*! @namespace <creaButtonContainer>
* @brief Contains the creaButtonContainer library included in creaMaracasVisu.
*/
typedef std::map< long, Button* > ButtonContainer;
// ----------------------------------------------------------------------------------
+ //MLER
+ typedef creaButtonContainer::view::ListGroup ListGroup;
+ typedef std::map<long, ListWx* > ListContainer;
+
//end of typedef definition.
public:
// ----------------------------------------------------------------------------------
*/
ButtonManager( ButtonGroup* buttonGroup );
// ----------------------------------------------------------------------------------
+ //MLER
+ ButtonManager (ListGroup* buttonGroup);
+ // ----------------------------------------------------------------------------------
+
/*! @fn ~ButtonManager( );
* @brief This is the destructor.
*/
/*! @fn ShowButtonManager( );
* @brief This method shows the ButtonManager
*/
+
void
ShowButtonManager( );
// ----------------------------------------------------------------------------------
void
SetButtonManager( ButtonContainer buttonContainer );
// ----------------------------------------------------------------------------------
+ //MLER
+ void
+ SetListManager( ListContainer buttonContainer );
+ // ----------------------------------------------------------------------------------
+
+
private:
wxStaticText* m_GroupName; //!<The name of the group.
wxGridSizer* m_GridSizer; //!<The sizer that contains the buttons.
wxFlexGridSizer( 1, 0, 0, 0 )
{
//EED 20/01/2012 flag 02
+ std::cout << " MLER groupManager.cxx / GroupManager(ButtonGroup* 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->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( )
{
#include "buttonManager.h"
#include "buttonGroup.h"
+#include "listGroup.h"
/*! @namespace <creaButtonContainer>
* @brief Contains the creaButtonContainer library included in creaMaracasVisu.
*/
typedef wxButton ExpansionButton;
// ----------------------------------------------------------------------------------
+ //MLER
+ typedef creaButtonContainer::view::ListGroup ListGroup;
+
//end of typedef definition.
public:
// ----------------------------------------------------------------------------------
*/
GroupManager( wxWindow* parent, ButtonGroup* buttonGroup );
// ----------------------------------------------------------------------------------
+
+ //MLER
+ GroupManager( wxWindow* parent, ListGroup* listGroup );
/*! @fn ~GroupManager( );
* @brief This is the destructor.
- */
+ */
virtual
~GroupManager( );
// ----------------------------------------------------------------------------------
long m_IDExpButton; //!<ID of "+""-" expansion button.
ExpansionButton* m_ExpansionButton; //!<The expansion button.
ButtonManager* m_ButtonManager; //!<The button manager.
+
+
+
};
}//ecapseman
}//ecapseman
# knowledge of the CeCILL-B license and that you accept its terms.
# ------------------------------------------------------------------------ */
-/*!
- * @file buttonGroup.cxx
- * @brief Implements the ListGroup class.
- * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
- * @date 2011-06-02
- */
-
#include "listGroup.h"
namespace creaButtonContainer
namespace view
{
// ----------------------------------------------------------------------------------
- ListGroup::ListGroup( wxStaticText* groupName, ListContainer list )
+ ListGroup::ListGroup( wxStaticText* groupName, ButtonContainer cartoButtons )
{
this->m_GroupName = groupName;
- this->m_List = list;
+ this->m_Buttons = cartoButtons;
}
// ----------------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------------
- ListGroup::ListContainer
- ListGroup::GetListContainer( )
+ ListGroup::ButtonContainer
+ ListGroup::GetButtonContainer( )
{
- return ( this->m_List );
+ return ( this->m_Buttons );
}
// ----------------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------------
+ 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
# 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
#include "listWx.h"
-/*! @namespace <creaButtonContainer>
- * @brief Contains the creaButtonContainer library included in creaMaracasVisu.
- */
namespace creaButtonContainer
{
- /*! @namespace <creaButtonContainer::view>
- * @brief Contains the implementation of the view in creaButtonContainer library.
- * @see <a href="http://en.wikipedia.org/wiki/Model-view-controller">MVC Software Architecture</a>
- */
+
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; //!<A pointer with the wxStaticText of name of the group.
- ListContainer m_List; //!<A container with buttons.
+ ButtonContainer m_Buttons; //!<A container with buttons.
};
}//ecapseman
}//ecapseman
# knowledge of the CeCILL-B license and that you accept its terms.
# ------------------------------------------------------------------------ */
+
#include "listWx.h"
namespace creaButtonContainer
{
namespace view
{
- ListWx::ListWx(wxWindow* parent, ItemsList items)
+ // ----------------------------------------------------------------------------------
+ ListWx::ListWx( wxWindow* parent, long id, ButtonPair* pair )
{
- wxListCtrl* lstCtrl = new wxListCtrl (parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxLC_REPORT);
-
- this->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
# ------------------------------------------------------------------------ */
-#ifndef LISTWX_H_
-#define LISTWX_H_
+#ifndef LISTWX_H
+#define LISTWX_H
-#include <wx/window.h>
+//#include <wx/bmpbuttn.h>
+#include <wx/image.h>
#include <wx/string.h>
+#include <wx/bitmap.h>
#include <wx/listctrl.h>
-#include <list>
-
#include "system.h"
-/*! @namespace <creaButtonContainer>
- * @brief Contains the creaButtonContainer library included in creaMaracasVisu.
- */
namespace creaButtonContainer
{
- /*! @namespace <creaButtonContainer::view>
- * @brief Contains the implementation of the view in creaButtonContainer library.
- * @see <a href="http://en.wikipedia.org/wiki/Model-view-controller">MVC Software Architecture</a>
- */
+
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; //! <The pair with the button information.
};
- }
-}
+ }//ecapseman
+}//ecapseman
-#endif /* LISTWX_H_ */
+#endif // LISTWX_H
std::cout<< std::endl<<"MLER ButtonContainerSettings // GetButtonGroupSettings "<<std::endl;
settings = new ButtonGroupSettings( );
+
for( KeyMapList::iterator it = this->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<<std::endl;
for( ButtonList::iterator it1 = list.begin( ); it1 != list.end( ); ++it1 )
{
+ std::cout<<"MLER ButtonContainerSettings // GetButtonGroupSettings :: groupName "<< *it<<std::endl;
+ std::cout<<"MLER ButtonContainerSettings // GetButtonGroupSettings :: buttonName "<< ( *it1 )->first->first <<std::endl;
+
settings->AddButton( ( *it ), ( *it1 )->first->first, ( *it1 )->first->second, ( *it1 )->second->first, functor );
}//rof
}//rof
{
try
{
- std::cout<< std::endl<<"MLER ButtonContainerSettings // AddButton"<<std::endl;
+ std::cout<< std::endl<<"MLER ButtonContainerSettings / AddButton(groupname...)"<<std::endl;
//builds the button information
//I don't know the try catch doesn't work!!
<< "exception: NULL Pointer in panel " << std::endl;
exit( 1 );
}
+
panel->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 )
{
}//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
* @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:
// ----------------------------------------------------------------------------------
void
AddButtons( BCStructVectorType infoList );
- void
- AddItem (BCPSettingsStruct* info);
-
- void
- AddItems( BCStructVectorType infoList );
// ----------------------------------------------------------------------------------
private:
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.
- ListGroupMap m_ListGroupContainer;
- };
+ };
}//ecapseman
#endif /* BUTTONCONTAINERSETTINGS_H_ */
// ----------------------------------------------------------------------------------
typedef creaButtonContainer::model::TConcreteFunctor< PanelButtonContainer > 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;
* @param bcSettings //The buttonContainerSettings
*/
PanelButtonContainer( wxWindow* parent,
- ButtonContainerSettings* bcSettings, std::string type );
+ ButtonContainerSettings* bcSettings, int type );
// ----------------------------------------------------------------------------------
/*! @fn virtual PanelButtonContainer( );
* @brief This is the destructor.
#include <string>
#include <wx/panel.h>
#include <wx/bitmap.h>
-#include "tlist.h"
+
/*! @namespace <creaPanelButtonContainer>
* @brief Contains the creaPanelButtonContainer library included in creaMaracasVisu.