]> Creatis software - bbtk.git/blob - packages/wx/src/bbwxSizer.cxx
86736a9b4da16a2ca0d1db59607da7ec523e39c3
[bbtk.git] / packages / wx / src / bbwxSizer.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbwxSizer.cxx,v $
5   Language:  C++
6   Date:      $Date: 2008/02/08 14:58:31 $
7   Version:   $Revision: 1.4 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18 /**
19  *  \file 
20  *  \brief 
21  */
22
23
24 #ifdef _USE_WXWIDGETS_
25
26
27 #include "bbwxSizer.h"
28 #include "bbwxPackage.h"
29 #include "bbtkUtilities.h"
30
31
32
33
34
35 namespace bbwx
36 {
37   BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx , Sizer);
38   
39
40   BBTK_USER_BLACK_BOX_IMPLEMENTATION(Sizer,bbtk::WxBlackBox);
41   
42         void Sizer::bbUserConstructor() 
43         { 
44                 bbSetInputOrientation("VERTICAL");
45                 bbSetInputWidget1(NULL);
46                 bbSetInputWidget2(NULL);
47                 bbSetInputWidget3(NULL);
48                 bbSetInputWidget4(NULL);
49                 bbSetInputWidget5(NULL);
50                 bbSetInputWidget6(NULL);
51                 bbSetInputWidget7(NULL);
52                 bbSetInputWidget8(NULL);
53                 bbSetInputWidget9(NULL);
54         }
55
56         void Sizer::TryInsertWindow(wxWindow *parent, wxWindow *w,wxBoxSizer *sizer)
57         {
58                   if (w!=NULL)
59                   {
60                           w->Reparent(parent);
61                           sizer->Add(w, 1, wxEXPAND, 0);                  
62                   }             
63         }
64
65
66           void Sizer::Process() 
67           { 
68           }
69
70           
71           void Sizer::CreateWidget() 
72           { 
73           wxBoxSizer *sizer;
74           wxPanel *w=new wxPanel(bbGetWxParent(), -1);
75           w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
76           
77           int style=0;
78       if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true)  { style=wxHORIZONTAL; }
79           if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true)        { style=wxVERTICAL; }
80           
81           sizer = new wxBoxSizer(style);
82
83           TryInsertWindow(w,bbGetInputWidget1(),sizer);
84           TryInsertWindow(w,bbGetInputWidget2(),sizer);
85           TryInsertWindow(w,bbGetInputWidget3(),sizer);
86           TryInsertWindow(w,bbGetInputWidget4(),sizer);
87           TryInsertWindow(w,bbGetInputWidget5(),sizer);
88           TryInsertWindow(w,bbGetInputWidget6(),sizer);
89           TryInsertWindow(w,bbGetInputWidget7(),sizer);
90           TryInsertWindow(w,bbGetInputWidget8(),sizer);
91           TryInsertWindow(w,bbGetInputWidget9(),sizer);
92           
93           w     -> SetSizer(sizer); 
94           bbSetOutputWidget( w );
95   }
96   
97
98
99
100
101 }//namespace bbwx
102
103 #endif
104