2 * @file buttonGroup.cxx
3 * @brief Implements the ButtonGroup class.
4 * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
8 #include "buttonContainerPanel.h"
10 namespace creaButtonContainer
14 BEGIN_EVENT_TABLE(ButtonContainerPanel,wxScrolledWindow)
15 //(*EventTable(ButtonContainerPanel)
19 // ----------------------------------------------------------------------------------
20 ButtonContainerPanel::ButtonContainerPanel( wxWindow* parent, ButtonGroupSettings* settings )
21 : wxScrolledWindow(parent,-1, wxDefaultPosition,wxDefaultSize, wxTAB_TRAVERSAL | wxVSCROLL | wxHSCROLL | wxFULL_REPAINT_ON_RESIZE, _T("creaButtonContainer") )
23 ButtonGroupFactory factory;
24 this->SetGroupContainer( factory.CreateButtonGroupContainer( this, settings ) );
26 this->m_ButtonCController = new BCController( this );
27 this->m_ButtonCController->AddEvents( );
28 this->SetEventHandler( this->m_ButtonCController );
31 // ----------------------------------------------------------------------------------
32 ButtonContainerPanel::~ButtonContainerPanel( )
36 // ----------------------------------------------------------------------------------
37 void ButtonContainerPanel::SetGroupContainer( ButtonGroupList groupContainer )
39 this->m_ButtonGroupList = groupContainer;
42 // ----------------------------------------------------------------------------------
43 void ButtonContainerPanel::PanelInit( )
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 )
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 );
56 this->SetSizer( this->m_Sizer );
60 catch ( const std::exception& e )
62 std::cerr << "ButtonContainerPanel::PanelInit( ) " << "exception: "
63 << e.what( ) << std::endl;
67 // ----------------------------------------------------------------------------------
68 void ButtonContainerPanel::FitSizer( )
70 this->m_Sizer->Fit( this );
71 this->m_Sizer->FitInside( this );
72 this->SetScrollRate( 20, 20 );
73 this->m_Sizer->SetSizeHints( this );
75 // ----------------------------------------------------------------------------------