]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonManager.cxx
creaButtonContainer & creaPanelButtonContainer: Deep errors have been solved!! ready...
[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-05-24
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                 ButtonManager::ButtonManager( ButtonGroup* buttonGroup ) :
21                         wxFlexGridSizer( 0, 1, 0, 0 )
22                 {
23                         try
24                         {
25                                 this->SetGroupName( buttonGroup->GetGroupName( ) );
26                                 this->SetButtonManager( buttonGroup->GetButtonContainer( ) );
27                         }//yrt
28                         catch ( const std::exception& e )
29                         {
30                                 std::cerr << "Button::Execute( ) exception: " << e.what( ) << std::endl;
31                         }//hctac
32                 }
33                 // ----------------------------------------------------------------------------------
34                 ButtonManager::~ButtonManager( )
35                 {
36                 }
37                 // ----------------------------------------------------------------------------------
38                 void
39                 ButtonManager::SetGroupName( wxStaticText* groupName )
40                 {
41                         this->m_GroupName = groupName;
42                         this->Add( this->m_GroupName, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
43                 }
44                 // ----------------------------------------------------------------------------------
45                 void
46                 ButtonManager::SetButtonManager( ButtonContainer buttonContainer )
47                 {
48                         try
49                         {
50                                 if ( this->m_GroupName != NULL )
51                                 {
52                                         this->m_GridSizer = new wxGridSizer( 0, 3, 0, 0 );
53                                         for( ButtonContainer::iterator it = buttonContainer.begin( ); it
54                                             != buttonContainer.end( ); ++it )
55                                                 this->m_GridSizer->Add( ( *it ).second, -1,
56                                                     wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
57                                         this->Add( m_GridSizer, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
58                                 }
59                         }//yrt
60                         catch ( const std::exception& e )
61                         {
62                                 std::cerr
63                                     << "ButtonManager::SetButtonManager( ButtonContainer buttonContainer )"
64                                     << "exception: " << e.what( ) << std::endl;
65                         }//hctac
66                 }
67                 // ----------------------------------------------------------------------------------
68                 void
69                 ButtonManager::ShowButtonManager( )
70                 {
71                         this->Show( this->m_GridSizer, true, false );
72                 }
73                 // ----------------------------------------------------------------------------------
74                 void
75                 ButtonManager::HideButtonManager( )
76                 {
77                         this->Show( this->m_GridSizer, false, false );
78                 }
79         // ----------------------------------------------------------------------------------
80         }//ecapseman
81 }//ecapseman