]> Creatis software - bbtk.git/blob - packages/wx/src/bbwxLayoutLine.cxx
*** empty log message ***
[bbtk.git] / packages / wx / src / bbwxLayoutLine.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbwxLayoutLine.cxx,v $
5   Language:  C++
6   Date:      $Date: 2008/06/19 09:46:46 $
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 #include "bbwxLayoutLine.h"
27 #include "bbwxPackage.h"
28 #include "bbtkUtilities.h"
29
30
31 namespace bbwx
32 {
33   BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx, LayoutLine);
34   BBTK_BLACK_BOX_IMPLEMENTATION(LayoutLine,bbtk::WxBlackBox);
35   
36   void LayoutLine::bbUserConstructor()
37   {
38     bbSetInputOrientation("VERTICAL");
39     bbSetInputWidget1(NULL);
40     bbSetInputWidget2(NULL);
41     bbSetInputWidget3(NULL);
42     bbSetInputWidget4(NULL);
43     bbSetInputWidget5(NULL);
44     bbSetInputWidget6(NULL);
45     bbSetInputWidget7(NULL);
46     bbSetInputWidget8(NULL);
47     bbSetInputWidget9(NULL);
48   }
49   
50   void LayoutLine::Process()
51   {
52   }
53   
54   void LayoutLine::TryInsertWindow(wxWindow *parent, wxWindow *w,wxBoxSizer *sizer)
55   {
56     if (w!=NULL)
57       {
58         w->Reparent(parent);
59         sizer->Add(w, 1, wxEXPAND, 0);
60       }
61   }
62   
63   void LayoutLine::CreateWidget()
64   {
65     wxBoxSizer *sizer;
66     wxPanel *w=new wxPanel(bbGetWxParent(), -1);
67     w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
68     
69     int style=0;
70     if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
71                                     "0|H|HORIZONTAL")==true)  
72       { style=wxHORIZONTAL; }
73     if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
74                                     "1|V|VERTICAL")==true)      
75       { style=wxVERTICAL;   }
76     
77     sizer       = new wxBoxSizer(style);
78     
79     TryInsertWindow(w,bbGetInputWidget1(),sizer);
80     TryInsertWindow(w,bbGetInputWidget2(),sizer);
81     TryInsertWindow(w,bbGetInputWidget3(),sizer);
82     TryInsertWindow(w,bbGetInputWidget4(),sizer);
83     TryInsertWindow(w,bbGetInputWidget5(),sizer);
84     TryInsertWindow(w,bbGetInputWidget6(),sizer);
85     TryInsertWindow(w,bbGetInputWidget7(),sizer);
86     TryInsertWindow(w,bbGetInputWidget8(),sizer);
87     TryInsertWindow(w,bbGetInputWidget9(),sizer);
88     
89     w   -> SetSizer(sizer);
90     bbSetOutputWidget( w );
91   }
92   
93   // This callback is necessary to get actual processing of the view 
94   // when window is shown
95   void  LayoutLine::bbUserOnShow()
96   {
97           bbUserOnShowWidget("Widget1");
98           bbUserOnShowWidget("Widget2");
99           bbUserOnShowWidget("Widget3");
100           bbUserOnShowWidget("Widget4");
101           bbUserOnShowWidget("Widget5");
102           bbUserOnShowWidget("Widget6");
103           bbUserOnShowWidget("Widget7");
104           bbUserOnShowWidget("Widget8");
105           bbUserOnShowWidget("Widget9");
106   }
107
108 }//namespace bbwx
109
110 #endif // _USE_WXWIDGETS_
111