]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.cxx
no message
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / creaButtonContainer / view / buttonContainerPanel.cxx
1 /*!
2  * @file buttonGroup.cxx
3  * @brief Implements the ButtonGroup class.
4  * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
5  * @date  2011-06-02
6  */
7
8 #include "buttonContainerPanel.h"
9
10 namespace creaButtonContainer
11 {
12         namespace view
13         {
14                 BEGIN_EVENT_TABLE(ButtonContainerPanel,wxScrolledWindow)
15                 //(*EventTable(ButtonContainerPanel)
16                 //*)
17                 END_EVENT_TABLE()
18
19                 // ----------------------------------------------------------------------------------
20                 ButtonContainerPanel::ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings ) 
21                 : wxScrolledWindow(parent,-1, wxDefaultPosition,wxDefaultSize, wxTAB_TRAVERSAL | wxVSCROLL | wxHSCROLL | wxFULL_REPAINT_ON_RESIZE, _T("creaButtonContainer") )
22                 {
23                         ButtonGroupFactory factory;
24                         this->SetGroupContainer( factory.CreateButtonGroupContainer( this, settings ) );
25                         this->PanelInit( );
26                         this->m_ButtonCController = new BCController( this );
27                         this->m_ButtonCController->AddEvents( );
28                         this->SetEventHandler( this->m_ButtonCController );
29                 }
30                 
31                 // ----------------------------------------------------------------------------------
32                 ButtonContainerPanel::~ButtonContainerPanel( )
33                 {
34                 }
35                 
36                 // ----------------------------------------------------------------------------------
37                 void ButtonContainerPanel::SetGroupContainer( ButtonGroupList groupContainer )
38                 {
39                         this->m_ButtonGroupList = groupContainer;
40                 }
41                 
42                 // ----------------------------------------------------------------------------------
43                 void ButtonContainerPanel::PanelInit( )
44                 {
45                         try
46                         {
47                                 
48 // EED 20/01/2012  flag 01
49                                 this->m_Sizer = new Sizer( 0, 1, 0, 0 );
50                                 for( ButtonGroupList::iterator it = this->m_ButtonGroupList.begin( ); it != this->m_ButtonGroupList.end( ); ++it )
51                                 {
52                                         GroupManager* manager = new GroupManager( this, *it );
53                                         this->m_GroupManagerList[ manager->GetButtonID( ) ] = manager;
54                                         this->m_Sizer->Add( manager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
55                                 }
56                                 this->SetSizer( this->m_Sizer );
57                                 this->Layout( );
58                                 this->FitSizer( );
59                         }//yrt
60                         catch ( const std::exception& e )
61                         {
62                                 std::cerr << "ButtonContainerPanel::PanelInit( ) " << "exception: "
63                                     << e.what( ) << std::endl;
64                         }//hctac
65                 }
66                 
67                 // ----------------------------------------------------------------------------------
68                 void ButtonContainerPanel::FitSizer( )
69                 {
70                         this->m_Sizer->Fit( this );
71                         this->m_Sizer->FitInside( this );
72                         this->SetScrollRate( 20, 20 );
73                         this->m_Sizer->SetSizeHints( this );
74                 }
75         // ----------------------------------------------------------------------------------
76         }//ecapseman
77 }//ecapseman