2 * @file containerSettings.cxx
3 * @brief Implements the ContainerSettings class.
4 * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
8 #include "containerSettings.h"
10 namespace creaButtonContainer
14 // ----------------------------------------------------------------------------------
15 ContainerSettings::ContainerSettings( )
18 // ----------------------------------------------------------------------------------
19 ContainerSettings::~ContainerSettings( )
22 // ----------------------------------------------------------------------------------
24 ContainerSettings::GetButtonGroupContainer( )
26 return ( this->m_ButtonGroupContainer );
28 // ----------------------------------------------------------------------------------
30 ContainerSettings::GetGroupNameList( )
32 return ( this->m_GroupNameList );
34 // ----------------------------------------------------------------------------------
36 ContainerSettings::SetButtonGroupContainer( ButtonGroupMap bgContainer )
38 this->m_ButtonGroupContainer = bgContainer;
40 // ----------------------------------------------------------------------------------
42 ContainerSettings::SetGroupNameList( KeyMapList gNameList )
44 this->m_GroupNameList = gNameList;
46 // ----------------------------------------------------------------------------------
48 ContainerSettings::AddButton( const StringType & groupName,
49 const StringType &buttonName, const StringType &iconpath,
50 const StringType &buttonDescription, FunctionEventType event )
52 ButtonPair* pair = new ButtonPair(
53 new ButtonInfo( buttonName, iconpath ),
54 new ButtonAction( buttonDescription, event ) );
57 for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it
58 != this->m_GroupNameList.end( ); ++it )
60 if ( ( *it ).compare( groupName ) == 0 )
62 this->m_ButtonGroupContainer[ groupName ].push_back( pair );
66 this->m_GroupNameList.push_back( groupName );
67 this->m_ButtonGroupContainer[ groupName ].push_back( pair );
69 catch ( const std::exception& e )
72 << "ContainerSettings::AddButton( const std::string & groupName,"
73 << "const std::string buttonName, const std::string iconpath,"
74 << "const std::string buttonDescription, FunctionEventType event ) exception: "
75 << e.what( ) << std::endl;
78 // ----------------------------------------------------------------------------------
80 ContainerSettings::AddButton( BCSettingsStruct* info )
82 ButtonPair* pair = new ButtonPair(
83 new ButtonInfo( info->buttonName, info->iconpath ),
84 new ButtonAction( info->buttonDescription, info->eventFunction ) );
87 for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it
88 != this->m_GroupNameList.end( ); ++it )
90 if ( ( *it ).compare( info->groupName ) == 0 )
92 this->m_ButtonGroupContainer[ info->groupName ].push_back( pair );
96 this->m_GroupNameList.push_back( info->groupName );
97 this->m_ButtonGroupContainer[ info->groupName ].push_back( pair );
99 catch ( const std::exception& e )
102 << "void ContainerSettings::AddButton( BCSettingsStruct* info ) "
103 << "exception: " << e.what( ) << std::endl;
106 // ----------------------------------------------------------------------------------
108 ContainerSettings::AddButtons( BCStructVectorType infoList )
112 for( BCStructVectorType::iterator it = infoList.begin( ); it
113 != infoList.end( ); ++it )
115 this->AddButton( *it );
118 catch ( const std::exception& e )
121 << "ContainerSettings::AddButtons( BCStructVectorType infoList ) "
122 << "exception: " << e.what( ) << std::endl;
125 // ----------------------------------------------------------------------------------