ButtonContainerSettings* settings = new ButtonContainerSettings( );
printf("EED PanelButtonContainer::Process %d\n", bbGetInputIn( ).size() );
- if(bbGetInputType()== "1")
- {
- //EED-MLER settings->AddItems( bbGetInputIn() );
- }
- else {
- settings->AddButtons( bbGetInputIn() );
- }
+
+ settings->AddButtons(bbGetInputIn( ), bbGetInputType());
-
PBContainer* panel = new PBContainer( myPanel, settings, bbGetInputType() );
wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL );
delta = GetGreyLevelBoundaries(1) - GetGreyLevelBoundaries(0);
for (int ii = 1; ii <= delta ; ii++)
{
-- thresholdTable->SetTableValue( GetGreyLevelBoundaries(0) + ii, GetBaseColors(0) * ii/delta,
++ thresholdTable->SetTableValue( (GetGreyLevelBoundaries(0) + ii), GetBaseColors(0) * ii/delta,
GetBaseColors(1) * ii/delta, GetBaseColors(2) * ii/delta, 1);
}
for (int ii = 1; ii <= delta; ii++)
{
// Color computation : previous_color + (current_color - previous_color)/delta * ii
-- thresholdTable->SetTableValue(GetGreyLevelBoundaries(i) + ii,
++ thresholdTable->SetTableValue((GetGreyLevelBoundaries(i) + ii),
GetBaseColors((i-1)*3) + (GetBaseColors(i*3) - GetBaseColors((i-1)*3)) / delta * ii ,
GetBaseColors((i-1)*3 + 1) + (GetBaseColors(i*3 + 1) - GetBaseColors((i-1)*3 + 1)) / delta * ii ,
GetBaseColors((i-1)*3 + 2) + (GetBaseColors(i*3 + 2) - GetBaseColors((i-1)*3 + 2)) / delta * ii ,
}
// ----------------------------------------------------------------------------------
- //EED-MLER
- /*
-
- 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
}
- //EED-MLER
- /*
- 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
}//ecapseman
void
AddButtons( BCStructVectorType infoList );
- //EED-MLER
- /*
// ----------------------------------------------------------------------------------
- void
- /* void
-- AddItem(const StringType & groupName);
-
- void
- AddItem( BCSettingsStruct* info );
-
- void
+ AddItems( BCStructVectorType infoList );*/
- void
- AddItem( BCSettingsStruct* info );
-
- void
- AddItems( BCStructVectorType infoList );
- */
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
private:
}
// ----------------------------------------------------------------------------------
}//ecapseman
- }//ecapseman
+ }//ecapseman*/
- */
+
#include <exception>
#include <string>
#include "functor.h"
- //EED-MLER #include <listWx.h>
- //EED-MLER #include <wx/listctrl.h>
- /*! @namespace <creaButtonContainer>
- * @brief Contains the creaButtonContainer library included in creaMaracasVisu.
- */
-
- /*namespace creaButtonContainer
+ namespace creaButtonContainer
{
- namespace view
- {
- typedef std::list< ListWx* > ListLst;
- typedef std::map< StringType, ListLst > ListGroupMap; // ex: grupo A,lista A,lista B
- }
+
+ //using namespace view;
+
- }*/
- namespace creaButtonContainer
- {
- //EED-MLER using namespace view;
// ----------------------------------------------------------------------------------
/*! @typedef std::string* StringType;
* @brief Defines the StringType type.
typedef creaButtonContainer::controller::ButtonContainerController
BCController;
- //EED-MLER typedef creaButtonContainer::view::ListGroup ListGroup;
+
- //EED-MLER typedef std::list< ListGroup* > ListGroupList;
+ //typedef creaButtonContainer::model::ListGroupFactory ListGroupFactory;
+
+ //typedef creaButtonContainer::view::ListGroup ListGroup;
+
+ //typedef std::list< ListGroup* > ListGroupList;
+
+ //typedef creaButtonContainer::model::ListGroupFactory ListGroupFactory;
- //EED-MLER typedef creaButtonContainer::model::ListGroupFactory ListGroupFactory;
+
// ----------------------------------------------------------------------------------
//end of typedef definition
public:
public:
friend class creaButtonContainer::controller::ButtonContainerController;
private:
- GroupManagerList m_GroupManagerList; //!<The container of managers.
- ButtonGroupList m_ButtonGroupList; //!<The list of button groups.
- BCController* m_ButtonCController; //!<Pontier to controller.
- Sizer* m_Sizer; //!<Pointer to wxSizer
+ GroupManagerList m_GroupManagerList; //!<The container of managers.
+ ButtonGroupList m_ButtonGroupList; //!<The list of button groups.
+ BCController* m_ButtonCController; //!<Pontier to controller.
+ Sizer* m_Sizer; //!<Pointer to wxSizer
+
- //EED-MLER ListGroupList m_ListGroupList;
+
+ //ListGroupList m_ListGroupList;
++
DECLARE_EVENT_TABLE() //!<Event Table declaration.
};
}//ecapseman
}
// ----------------------------------------------------------------------------------
+ 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
+ }//ecapseman*/
++
+
- */
# ------------------------------------------------------------------------ */
- //EED-MLER
- /*
+
#include "listWx.h"
namespace creaButtonContainer
{
namespace view
{
- ListWx::ListWx(wxWindow* parent, ItemsList items)
+ // ----------------------------------------------------------------------------------
+ ListWx::ListWx( wxWindow* parent, wxWindowID id,ItemsMap iMap , TFunctor* functor ): wxListCtrl(parent,id)
{
- wxListCtrl* lstCtrl = new wxListCtrl (parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxLC_REPORT);
- this->m_items = items;
- lstCtrl->InsertItem(0,(*items.front()).GetText());
- }
-
- //-------------------------------------------------------
+ std::cout<< "MLER | ListWx::ListWx()" << std::endl;
+ this->m_itemsMap = iMap;
- tList::~tList( )
- {
- }
+ 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(i, wxString(key.c_str(), wxConvUTF8));
- ItemsList getItems() const
- {
- return m_items;
+ std::cout << "index" << index << std::endl;
+ this->Connect( -1, wxEVT_COMMAND_LIST_ITEM_SELECTED,
+ wxListEventHandler(ListWx::ListEvent) );
+ i++;
+ }
}
- void setItems(ItemsList items)
+ // ----------------------------------------------------------------------------------
+ ListWx::~ListWx( )
{
- m_items = items;
}
+ void
+ ListWx::ListEvent( wxListEvent& event )
+ {
+ try
+ {
+ 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"<<std::endl;
- */
+ }//yrt
+ catch ( const std::exception& e )
+ {
+ std::cerr
+ << "ButtonContainerController::ButtonEvent( wxCommandEvent& event ) exception: "
+ << e.what( ) << std::endl;
+ }//hctac
+ }
+ // ----------------------------------------------------------------------------------
+ }//ecapseman
+ }//ecapseman
+
+
}//hctac
}
+
+//EED-MLER
+/*
void
- ButtonContainerSettings::AddItem(BCPSettingsStruct* info)
+ ButtonContainerSettings::AddItems(BCPSettingsStruct* info)
+ {
+ try
{
- if(info->panel == NULL)
+ 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 )
{
- std::cerr
- << "ButtonContainerSettings::AddItem"
- << "exception: NULL Pointer in panel" << std::endl;
- exit(1);
+ std::cerr << "ButtonContainerSettings::AddButton"
+ << "exception: NULL Pointer in panel " << std::endl;
+ exit( 1 );
}
- wxListItem item;
- wxString myString((info->buttonName).c_str(),wxConvUTF8);
- item.SetText(myString);
+ info->panel->Show( false );
- 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
- }
+ std::string mapKey = info->groupName + ":" + info->buttonName;
+ m_itemsMap[mapKey] = info->panel;
- void
- ButtonContainerSettings::AddItems(BCStructVectorType infoList)
+ }//yrt
+ catch ( const std::exception& e )
{
++<<<<<<< HEAD
+ 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
+ }
+*/
++=======
+ std::cerr
+ << "ButtonContainerSettings::AddButton( BCPSettingsStruct* info )"
+ << "exception: " << e.what( ) << std::endl;
+ exit( 1 );
+ }//hctac
+ }
+
+ ButtonContainerSettings::ItemsMap
+ ButtonContainerSettings::GetItemsMap()
+ {
+ std::cout<< "MLER | ButtonContainerSettings:: GetItemsMap()" << std::endl;
+ return m_itemsMap;
+ }
+
++>>>>>>> b8c5a565c70ac0def1f21518afa2d847a9582d79
// ----------------------------------------------------------------------------------
}//ecapseman
* @brief This class contains the settings of the button container.
*/
- //EED-MLER typedef wxListItem Item;
- //EED-MLER typedef std::list < tList* > ItemsList;
- //EED-MLER typedef std::map< StringType, ListLst > ListGroupMap;
+
+ typedef std::map< std::string, wxPanel* > ItemsMap;
+
public:
// ----------------------------------------------------------------------------------
/*! @fn ButtonContainerSettings( );
* @exception std::bad_alloc
*/
void
- AddButtons( BCStructVectorType infoList );
-
- //EED-MLER
- /*
- void
- AddItem (BCPSettingsStruct* info);
-
- void
- AddItems( BCStructVectorType infoList );
- */
+ AddButtons( BCStructVectorType infoList, int type );
- void
- AddItems(BCPSettingsStruct* info);
-
- ItemsMap
- GetItemsMap();
-
- PanelButton
- GetPanelList( const StringType &buttonName );
-
-
// ----------------------------------------------------------------------------------
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.
- //EED-MLER ListGroupMap m_ListGroupContainer;
- };
++
+ //MLER
+ ItemsMap m_itemsMap; //This is the map with the name and the wPanel
+ };
++
}//ecapseman
#endif /* BUTTONCONTAINERSETTINGS_H_ */