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