]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/src/buttonManager.cxx
83eda11dacb061379740729d326fb4f20b0115bf
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / creaButtonContainer / view / src / buttonManager.cxx
1 /***************************************************************
2  * Name:      ButtonManager.cxx
3  * Purpose:   Implements ButtonManager.h
4  * Author:    Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
5  * Modified:  2011-05-09
6  * Copyright: Diego CACERES (http://www.creatis.insa-lyon.fr/~caceres/)
7  * License:
8  **************************************************************/
9
10 #include "buttonManager.h"
11
12 namespace creaButtonContainer
13 {
14         namespace view
15         {
16
17                 ButtonManager::ButtonManager( ) :
18                         wxFlexGridSizer( 0, 1, 0, 0 )
19                 {
20                 }
21                 // -------------------------------------------------------------------
22                 ButtonManager::ButtonManager( ButtonGroup* buttonGroup ) :
23                         wxFlexGridSizer( 0, 1, 0, 0 )
24                 {
25                         this->SetGroupName( buttonGroup->GetGroupName( ) );
26                         this->SetButtonManager( buttonGroup->GetButtonContainer( ) );
27                 }
28                 // -------------------------------------------------------------------
29                 ButtonManager::~ButtonManager( )
30                 {
31                 }
32                 // -------------------------------------------------------------------
33                 void
34                 ButtonManager::SetGroupName( wxStaticText* groupName )
35                 {
36                         this->m_GroupName = groupName;
37                         this->Add( this->m_GroupName, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
38                 }
39                 // -------------------------------------------------------------------
40                 void
41                 ButtonManager::SetButtonManager( ButtonContainer buttonContainer )
42                 {
43                         if ( this->m_GroupName != NULL )
44                         {
45                                 this->m_GridSizer = new wxGridSizer( 0, 3, 0, 0 );
46                                 for( ButtonContainer::iterator it = buttonContainer.begin( ); it
47                                     != buttonContainer.end( ); ++it )
48                                         this->m_GridSizer->Add( (*it).second, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP,
49                                             5 );
50                                 this->Add( m_GridSizer, -1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
51                         }
52                 }
53                 // -------------------------------------------------------------------
54                 void
55                 ButtonManager::ShowButtonManager( )
56                 {
57                         this->Show( this->m_GridSizer, true, false );
58                 }
59                 // -------------------------------------------------------------------
60                 void
61                 ButtonManager::HideButtonManager( )
62                 {
63                         this->Show( this->m_GridSizer, false, false );
64                 }
65         }//ecapseman
66 }//ecapseman