]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/creaButtonContainer/view/buttonContainerPanel.cxx
creaButtonContainer, creaPanelButtonContainer. Cleaned 98% ready to be used :) :) :)
[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-05-28
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,
21                     ButtonGroupSettings* settings ) :
22                             wxScrolledWindow(
23                                 parent,
24                                 -1,
25                                 wxDefaultPosition,
26                                 wxDefaultSize,
27                                 wxTAB_TRAVERSAL | wxVSCROLL | wxHSCROLL
28                                     | wxFULL_REPAINT_ON_RESIZE, _T("creaButtonContainer") )
29                 {
30                         ButtonGroupFactory factory;
31                         this->SetGroupContainer(
32                             factory.CreateButtonGroupContainer( this, settings ) );
33                         this->PanelInit( );
34                         this->m_ButtonCController = new BCController( this );
35                         this->m_ButtonCController->AddEvents( );
36                         this->SetEventHandler( this->m_ButtonCController );
37                 }
38                 // ----------------------------------------------------------------------------------
39                 ButtonContainerPanel::~ButtonContainerPanel( )
40                 {
41                 }
42                 // ----------------------------------------------------------------------------------
43                 void
44                 ButtonContainerPanel::SetGroupContainer( ButtonGroupList groupContainer )
45                 {
46                         this->m_ButtonGroupList = groupContainer;
47                 }
48                 // ----------------------------------------------------------------------------------
49                 void
50                 ButtonContainerPanel::PanelInit( )
51                 {
52                         try
53                         {
54                                 this->m_Sizer = new Sizer( 0, 1, 0, 0 );
55                                 for( ButtonGroupList::iterator it = this->m_ButtonGroupList.begin( ); it
56                                     != this->m_ButtonGroupList.end( ); ++it )
57                                 {
58                                         GroupManager* manager = new GroupManager( this, *it );
59                                         this->m_GroupManagerList[ manager->GetButtonID( ) ] = manager;
60                                         this->m_Sizer->Add( manager, 1, wxALL | wxALIGN_LEFT | wxALIGN_TOP, 5 );
61                                         std::cout << "creaButtonContainer: New ButtonGroup Sizer Added"
62                                             << std::endl;
63                                 }
64                                 this->SetSizer( this->m_Sizer );
65                                 this->FitSizer( );
66                         }//yrt
67                         catch ( const std::exception& e )
68                         {
69                                 std::cerr << "ButtonContainerPanel::PanelInit( ) " << "exception: "
70                                     << e.what( ) << std::endl;
71                         }//hctac
72                 }
73                 // ----------------------------------------------------------------------------------
74                 void
75                 ButtonContainerPanel::FitSizer( )
76                 {
77                         this->m_Sizer->Fit( this );
78                         this->m_Sizer->FitInside( this );
79                         this->SetScrollRate( 20, 20 );
80                         this->m_Sizer->SetSizeHints( this );
81                 }
82         // ----------------------------------------------------------------------------------
83         }//ecapseman
84 }//ecapseman