]> Creatis software - bbtk.git/blob - packages/wx/src/bbwxLayoutSplit.cxx
*** empty log message ***
[bbtk.git] / packages / wx / src / bbwxLayoutSplit.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbwxLayoutSplit.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 #include "bbwxLayoutSplit.h"
27 #include "bbwxPackage.h"
28 #include "bbtkUtilities.h"
29
30
31 namespace bbwx
32 {
33   BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,LayoutSplit);
34   BBTK_BLACK_BOX_IMPLEMENTATION(LayoutSplit,bbtk::WxBlackBox);
35
36   void LayoutSplit::bbUserConstructor()
37   {
38     bbSetInputOrientation("VERTICAL");
39     bbSetInputProportion(50);
40     bbSetInputWidget1(NULL);
41     bbSetInputWidget2(NULL);
42   }
43
44   void LayoutSplit::Process()
45   {
46   }
47
48   void LayoutSplit::CreateWidget()
49   {
50     wxSplitterWindow* w = new wxSplitterWindow(bbGetWxParent(),
51                                                -1,
52                                                wxDefaultPosition,
53                                                wxDefaultSize,
54                                                //wxSize(400,200),
55                                                wxSP_3D |
56                                                wxSP_LIVE_UPDATE );
57         w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
58     wxWindow* w1 = bbGetInputWidget1();
59     wxWindow* w2 = bbGetInputWidget2();
60
61     if (w1==NULL) { w1=new wxPanel(bbGetWxParent()); }
62     if (w2==NULL) { w2=new wxPanel(bbGetWxParent()); }
63     w1->Reparent(w);
64     w2->Reparent(w);
65     int orientation=0;
66         if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true)  { orientation=0; }
67         if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true)    { orientation=1; }
68
69         if (orientation==1) { w->SplitHorizontally( w1, w2, 100); }
70         else                { w->SplitVertically( w1, w2, 100);   }
71
72     bbSetOutputWidget( w );
73   }
74
75
76   // This callback is necessary to get actual processing of the view 
77   // when window is shown
78   void  LayoutSplit::bbUserOnShow()
79   {
80           bbUserOnShowWidget("Widget1");
81           bbUserOnShowWidget("Widget2");
82   }
83
84
85
86 }//namespace bbwx
87
88 #endif // _USE_WXWIDGETS_
89