]> Creatis software - bbtk.git/blob - packages/wx/src/bbwxLayoutLine.cxx
.
[bbtk.git] / packages / wx / src / bbwxLayoutLine.cxx
1 /*=========================================================================                                                                               
2   Program:   bbtk
3   Module:    $RCSfile: bbwxLayoutLine.cxx,v $
4   Language:  C++
5   Date:      $Date: 2009/05/15 14:58:03 $
6   Version:   $Revision: 1.8 $
7 =========================================================================*/
8
9 /* ---------------------------------------------------------------------
10
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
13 *
14 *  This software is governed by the CeCILL-B license under French law and 
15 *  abiding by the rules of distribution of free software. You can  use, 
16 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
17 *  license as circulated by CEA, CNRS and INRIA at the following URL 
18 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
19 *  or in the file LICENSE.txt.
20 *
21 *  As a counterpart to the access to the source code and  rights to copy,
22 *  modify and redistribute granted by the license, users are provided only
23 *  with a limited warranty  and the software's author,  the holder of the
24 *  economic rights,  and the successive licensors  have only  limited
25 *  liability. 
26 *
27 *  The fact that you are presently reading this means that you have had
28 *  knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */                                                                         
30     
31
32 /**
33  *  \file
34  *  \brief
35  */
36
37
38 #ifdef _USE_WXWIDGETS_
39
40 #include "bbwxLayoutLine.h"
41 #include "bbwxPackage.h"
42 #include "bbtkUtilities.h"
43
44
45 namespace bbwx
46 {
47   BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx, LayoutLine);
48   BBTK_BLACK_BOX_IMPLEMENTATION(LayoutLine,bbtk::WxBlackBox);
49   
50         //-----------------------------------------------------------------     
51         void LayoutLine::bbUserSetDefaultValues()
52         {
53                 bbSetInputOrientation("VERTICAL");
54                 bbSetInputWidget1(NULL);
55                 bbSetInputWidget2(NULL);
56                 bbSetInputWidget3(NULL);
57                 bbSetInputWidget4(NULL);
58                 bbSetInputWidget5(NULL);
59                 bbSetInputWidget6(NULL);
60                 bbSetInputWidget7(NULL);
61                 bbSetInputWidget8(NULL);
62                 bbSetInputWidget9(NULL);
63         }
64         
65         //-----------------------------------------------------------------     
66         void LayoutLine::bbUserInitializeProcessing()
67         {
68         }
69         
70         //-----------------------------------------------------------------     
71         void LayoutLine::bbUserFinalizeProcessing()
72         {
73         }       
74         
75         
76   void LayoutLine::Process()
77   {
78   }
79   
80         
81 /*
82   void LayoutLine::TryInsertWindow(wxWindow *parent, wxWindow *w,wxBoxSizer *sizer)
83   {
84     if (w!=NULL)
85       {
86         w->Reparent(parent);
87         sizer->Add(w, 1, wxEXPAND, 0);
88       }
89   }
90   */
91         
92   void LayoutLine::CreateWidget(wxWindow* parent)
93   {
94     wxBoxSizer *sizer;
95     wxPanel *w=new wxPanel(parent, //bbGetWxParent(),
96                                                    -1);
97     w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
98     
99     int style=0;
100     if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
101                                     "0|H|HORIZONTAL")==true)  
102       { style=wxHORIZONTAL; }
103     if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
104                                     "1|V|VERTICAL")==true)      
105       { style=wxVERTICAL;   }
106     
107     sizer       = new wxBoxSizer(style);
108
109           wxWindow* cw;
110         if ((cw=bbCreateWidgetOfInput("Widget1",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0);
111           if ((cw=bbCreateWidgetOfInput("Widget2",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0);
112           if ((cw=bbCreateWidgetOfInput("Widget3",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0);
113           if ((cw=bbCreateWidgetOfInput("Widget4",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0);
114           if ((cw=bbCreateWidgetOfInput("Widget5",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0);
115           if ((cw=bbCreateWidgetOfInput("Widget6",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0);
116           if ((cw=bbCreateWidgetOfInput("Widget7",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0);
117           if ((cw=bbCreateWidgetOfInput("Widget8",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0);
118           if ((cw=bbCreateWidgetOfInput("Widget9",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0);
119           /*
120     TryInsertWindow(w,bbGetInputWidget1(),sizer);
121     TryInsertWindow(w,bbGetInputWidget2(),sizer);
122     TryInsertWindow(w,bbGetInputWidget3(),sizer);
123     TryInsertWindow(w,bbGetInputWidget4(),sizer);
124     TryInsertWindow(w,bbGetInputWidget5(),sizer);
125     TryInsertWindow(w,bbGetInputWidget6(),sizer);
126     TryInsertWindow(w,bbGetInputWidget7(),sizer);
127     TryInsertWindow(w,bbGetInputWidget8(),sizer);
128     TryInsertWindow(w,bbGetInputWidget9(),sizer);
129     */
130     w   -> SetSizer(sizer);
131     bbSetOutputWidget( w );
132   }
133   
134   // This callback is necessary to get actual processing of the view 
135   // when window is shown
136   void  LayoutLine::OnShowWidget()
137   {
138           bbUserOnShowWidget("Widget1");
139           bbUserOnShowWidget("Widget2");
140           bbUserOnShowWidget("Widget3");
141           bbUserOnShowWidget("Widget4");
142           bbUserOnShowWidget("Widget5");
143           bbUserOnShowWidget("Widget6");
144           bbUserOnShowWidget("Widget7");
145           bbUserOnShowWidget("Widget8");
146           bbUserOnShowWidget("Widget9");
147   }
148
149 }//namespace bbwx
150
151 #endif // _USE_WXWIDGETS_
152