]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.cxx
e788f82a0b5dffd3dbe608d1daaa0e6a96567248
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / creaButtonContainer / view / buttonManager.cxx
1 /*!
2  * @file buttonManager.cxx
3  * @brief Implements the ButtonManager class.
4  * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
5  * @date  2011-06-02
6  */
7
8 #include "buttonManager.h"
9
10 namespace creaButtonContainer
11 {
12         namespace view
13         {
14                 // ----------------------------------------------------------------------------------
15                 ButtonManager::ButtonManager( ) :
16                         wxFlexGridSizer( 0, 1, 0, 0 )
17                 {
18                 }
19                 
20 //EED 20/01/2012  Flag03                
21                 // ----------------------------------------------------------------------------------
22                 ButtonManager::ButtonManager( ButtonGroup* buttonGroup ) :
23                         wxFlexGridSizer( 0, 1, 0, 0 )
24                 {
25                         try
26                         {
27                                 this->SetGroupName( buttonGroup->GetGroupName( ) );
28                                 this->SetButtonManager( buttonGroup->GetButtonContainer( ) );
29                         }//yrt
30                         catch ( const std::exception& e )
31                         {
32                                 std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl;
33                         }//hctac
34                 }
35                 
36                 // ----------------------------------------------------------------------------------
37                 ButtonManager::~ButtonManager( )
38                 {
39                 }
40                 
41                 // ----------------------------------------------------------------------------------
42                 void ButtonManager::SetGroupName( wxStaticText* groupName )
43                 {
44                         this->m_GroupName = groupName;
45                         this->Add( this->m_GroupName, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
46                 }
47                 
48                 // ----------------------------------------------------------------------------------
49                 void ButtonManager::SetButtonManager( ButtonContainer buttonContainer )
50                 {
51                         try
52                         {
53                                 if ( this->m_GroupName != NULL )
54                                 {
55                                         this->m_GridSizer = new wxGridSizer( 0, 3, 0, 0 );
56                                         for( ButtonContainer::iterator it = buttonContainer.begin( ); it!= buttonContainer.end( ); ++it )
57                                         {
58                                                 this->m_GridSizer->Add( ( *it ).second, -1,  wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
59                                         }
60                                         this->Add( m_GridSizer, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
61                                 }//fi
62                         }//yrt
63                         catch ( const std::exception& e )
64                         {
65                                 std::cerr
66                                     << "ButtonManager::SetButtonManager( ButtonContainer buttonContainer )"
67                                     << "exception: " << e.what( ) << std::endl;
68                         }//hctac
69                 }
70                 // ----------------------------------------------------------------------------------
71                 void
72                 ButtonManager::ShowButtonManager( )
73                 {
74                         this->Show( this->m_GridSizer, true, false );
75                 }
76                 // ----------------------------------------------------------------------------------
77                 void
78                 ButtonManager::HideButtonManager( )
79                 {
80                         this->Show( this->m_GridSizer, false, false );
81                 }
82         // ----------------------------------------------------------------------------------
83         }//ecapseman
84 }//ecapseman