]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/src/buttonContainerPanel.cxx
Diego Caceres: Changes in CMakeLists.txt.
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / creaButtonContainer / view / src / buttonContainerPanel.cxx
1 /***************************************************************
2  * Name:      ButtonContainerPanel.cxx
3  * Purpose:   Implements ButtonContainerPanel.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 #include "buttonContainerPanel.h"
10
11 namespace creaButtonContainer
12 {
13         namespace view
14         {
15                 ButtonContainerPanel::ButtonContainerPanel( wxWindow* parent,
16                     ButtonGroupSettings* settings ) :
17                             wxScrolledWindow(
18                                 parent,
19                                 -1,
20                                 wxDefaultPosition,
21                                 wxSize( 400, 400 ),
22                                 wxTAB_TRAVERSAL | wxVSCROLL | wxHSCROLL
23                                     | wxFULL_REPAINT_ON_RESIZE, _T("creaButtonContainer") )
24                 {
25                         ButtonGroupFactory factory;
26                         this->SetGroupContainer(
27                             factory.CreateButtonGroupContainer( this, settings ) );
28                         this->PanelInit( );
29                         this->m_ButtonCController = new BCController(this);
30                         this->m_ButtonCController->AddEvents();
31                         this->SetEventHandler( this->m_ButtonCController );
32                 }
33                 // -------------------------------------------------------------------
34                 ButtonContainerPanel::~ButtonContainerPanel( )
35                 {
36                 }
37                 // -------------------------------------------------------------------
38                 void
39                 ButtonContainerPanel::SetGroupContainer( ButtonGroupList groupContainer )
40                 {
41                         this->m_ButtonGroupList = groupContainer;
42                 }
43                 // -------------------------------------------------------------------
44                 void
45                 ButtonContainerPanel::PanelInit( )
46                 {
47                         this->m_Sizer = new Sizer( 0, 1, 0, 0 );
48                         for( ButtonGroupList::iterator it = this->m_ButtonGroupList.begin( ); it
49                             != this->m_ButtonGroupList.end( ); ++it )
50                         {
51                                 GroupManager* manager = new GroupManager( this, *it );
52                                 this->m_GroupManagerList[ manager->GetButtonID( ) ] = manager;
53                                 this->m_Sizer->Add( manager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
54                                 std::cout << "creaButtonContainer: New ButtonGroup Sizer Added"
55                                     << std::endl;
56                         }
57                         this->SetSizer( this->m_Sizer );
58                         this->FitSizer( );
59                 }
60
61                 // -------------------------------------------------------------------
62                 void
63                 ButtonContainerPanel::FitSizer( )
64                 {
65                         this->m_Sizer->Fit( this );
66                         this->m_Sizer->SetSizeHints( this );
67                 }
68
69         }//ecapseman
70 }//ecapseman