]> Creatis software - bbtk.git/blob - packages/wx/src/bbwxSplit.cxx
2e61dc71b4f82cdb46c03e64863976d242ae0dc1
[bbtk.git] / packages / wx / src / bbwxSplit.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbwxSplit.cxx,v $
5   Language:  C++
6   Date:      $Date: 2008/02/14 16:55:07 $
7   Version:   $Revision: 1.6 $
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 "bbwxSplit.h"
27 #include "bbwxPackage.h"
28 #include "bbtkUtilities.h"
29
30
31 //#include "bbtk
32
33 namespace bbwx
34 {
35   BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,Split);
36
37
38   BBTK_USER_BLACK_BOX_IMPLEMENTATION(Split,bbtk::WxBlackBox);
39   
40
41   void Split::bbUserConstructor() 
42   { 
43         bbSetInputWinTitle("Split");
44     bbSetInputOrientation("HORIZONTAL");
45     bbSetInputProportion(50);
46     bbSetInputWidget1(NULL);
47     bbSetInputWidget2(NULL);
48   }
49
50   void Split::Process() 
51   { 
52   }
53
54   void Split::CreateWidget() 
55   { 
56     wxSplitterWindow* w = new wxSplitterWindow(bbGetWxParent(),
57                                                -1,
58                                                wxDefaultPosition,
59                                                wxDefaultSize, 
60                                                //wxSize(400,200),
61                                                wxSP_3D | 
62                                                wxSP_LIVE_UPDATE );
63         w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
64     wxWindow* w1 = bbGetInputWidget1();
65     wxWindow* w2 = bbGetInputWidget2();
66
67     if (w1==NULL) { w1=new wxPanel(bbGetWxParent()); }
68     if (w2==NULL) { w2=new wxPanel(bbGetWxParent()); }
69     w1->Reparent(w);
70     w2->Reparent(w);
71     int orientation=0;
72         if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true)  { orientation=0; }
73         if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true)  { orientation=1; }
74         if (orientation==0) { w->SplitHorizontally( w1, w2, 100); }
75         if (orientation==1) { w->SplitVertically( w1, w2, 100); }
76     
77     
78     bbSetOutputWidget( w );
79   }
80   
81   
82
83 }//namespace bbtk
84
85 #endif // _USE_WXWIDGETS_ 
86