]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaPanelButtonContainer/buttonContainerSettings.cxx
#2507 creaMaracasVisu Feature New Normal - creaPanelButtonContainer ListPanel
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / creaPanelButtonContainer / buttonContainerSettings.cxx
index f8cd8f3f70d64cecdfec0a3beb3bed16a601e084..e93c87a03fcc78994b6dda0b3a478429507dd985 100644 (file)
@@ -37,6 +37,7 @@ namespace creaPanelButtonContainer
        // ----------------------------------------------------------------------------------
        ButtonContainerSettings::ButtonContainerSettings( )
        {
+
        }
        // ----------------------------------------------------------------------------------
        ButtonContainerSettings::~ButtonContainerSettings( )
@@ -47,12 +48,14 @@ namespace creaPanelButtonContainer
        ButtonContainerSettings::ButtonGroupMap
        ButtonContainerSettings::GetButtonGroupContainer( )
        {
+               std::cout<< "MLER | ButtonContainerSettings:: GetButtonGroupContainer( ) " << std::endl;
                return m_ButtonGroupContainer;
        }
        // ----------------------------------------------------------------------------------
        ButtonContainerSettings::KeyMapList
        ButtonContainerSettings::GetGroupNameList( )
        {
+               std::cout<< "MLER | ButtonContainerSettings:: GetGroupNameList( ) " << std::endl;
                return m_GroupNameList;
        }
        // ----------------------------------------------------------------------------------
@@ -62,9 +65,14 @@ namespace creaPanelButtonContainer
        {
                try
                {
+                       std::cout<< "MLER | ButtonContainerSettings:: GetPanelButton " << std::endl;
+
                        for( KeyMapList::iterator it = this->m_GroupNameList.begin( ); it
                            != this->m_GroupNameList.end( ); ++it )
                        {
+
+                               //std::cout<< std::endl<<"MLER ButtonContainerSettings // GetPanelButton :: it "<< *it<<std::endl;
+
                                ButtonList list = this->m_ButtonGroupContainer[ ( *it ) ];
                                for( ButtonList::iterator it1 = list.begin( ); it1 != list.end( ); ++it1 )
                                {
@@ -83,6 +91,35 @@ namespace creaPanelButtonContainer
                }//hctac
                return ( NULL );
        }
+       // ----------------------------------------------------------------------------------
+       ButtonContainerSettings::PanelButton
+       ButtonContainerSettings::GetPanelList( const StringType &buttonName )
+       {
+               std::cout<< "MLER | ButtonContainerSettings:: GetPanelList " << std::endl;
+
+
+               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 )
+                                       return ( (*it).second );
+                       }
+
+
+               }catch ( std::exception& e )
+               {
+                       std::cerr
+                           << "ButtonContainerSettings::GetPanelButton( const StringType &buttonName ) "
+                           << "exception: " << e.what( ) << std::endl;
+               }//hctac
+               return (NULL);
+
+       }
+
+
        // ----------------------------------------------------------------------------------
        ButtonContainerSettings::ButtonGroupSettings*
        ButtonContainerSettings::GetButtonGroupSettings( TFunctor* functor )
@@ -90,13 +127,20 @@ namespace creaPanelButtonContainer
                ButtonGroupSettings* settings = NULL;
                try
                {
+                       std::cout<< "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 ) ];
+
                                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
@@ -114,12 +158,14 @@ namespace creaPanelButtonContainer
        ButtonContainerSettings::SetButtonGroupContainer(
            ButtonGroupMap m_ButtonGroupContainer )
        {
+               std::cout<< "MLER | ButtonContainerSettings:: SetButtonGroupContainer() " << std::endl;
                this->m_ButtonGroupContainer = m_ButtonGroupContainer;
        }
        // ----------------------------------------------------------------------------------
        void
        ButtonContainerSettings::SetGroupNameList( KeyMapList m_GroupNameList )
        {
+               std::cout<< "MLER | ButtonContainerSettings:: SetGroupNameList() " << std::endl;
                this->m_GroupNameList = m_GroupNameList;
        }
        
@@ -131,6 +177,8 @@ namespace creaPanelButtonContainer
        {
                try
                {
+                       std::cout<< "MLER | ButtonContainerSettings:: AddButton( const StringType & groupName ..) " << std::endl;
+
                        //builds the button information
                        //I don't know the try catch doesn't work!!
                        if ( panel == NULL )
@@ -139,10 +187,13 @@ namespace creaPanelButtonContainer
                                    << "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 )
                        {
@@ -171,6 +222,8 @@ namespace creaPanelButtonContainer
        {
                try
                {
+                       std::cout<< "MLER | ButtonContainerSettings:: AddButton( BCPSettingsStruct* info )" << std::endl;
+
                        //builds the button information
                        //I don't know the try catch doesn't work!!
                        if ( info->panel == NULL )
@@ -206,14 +259,18 @@ namespace creaPanelButtonContainer
        
        // ----------------------------------------------------------------------------------
        void
-       ButtonContainerSettings::AddButtons( BCStructVectorType infoList )
+       ButtonContainerSettings::AddButtons( BCStructVectorType infoList, int type )
        {
+               std::cout<< "MLER | ButtonContainerSettings:: AddButtons( BCStructVectorType infoList, int type )" << std::endl;
                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 )
@@ -223,6 +280,67 @@ namespace creaPanelButtonContainer
                            << "exception: " << e.what( ) << std::endl;
                }//hctac
        }
+
+
+//EED-MLER
+/*
+       void
+       ButtonContainerSettings::AddItems(BCPSettingsStruct* info)
+       {
+               try
+               {
+                       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::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 )
+               {
+<<<<<<< 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