]> Creatis software - bbtk.git/blob - packages/wx/src/bbwxSplit.cxx
0b5a71f41ae4158db41f0c49bac2d856a3572fbe
[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 20:55:52 $
7   Version:   $Revision: 1.7 $
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 namespace bbwx
32 {
33   BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,Split);
34   BBTK_USER_BLACK_BOX_IMPLEMENTATION(Split,bbtk::WxBlackBox);
35
36   void Split::bbUserConstructor()
37   {
38         bbSetInputWinTitle("Split");
39     bbSetInputOrientation("HORIZONTAL");
40     bbSetInputProportion(50);
41     bbSetInputWidget1(NULL);
42     bbSetInputWidget2(NULL);
43   }
44
45   void Split::Process()
46   {
47   }
48
49   void Split::CreateWidget()
50   {
51     wxSplitterWindow* w = new wxSplitterWindow(bbGetWxParent(),
52                                                -1,
53                                                wxDefaultPosition,
54                                                wxDefaultSize,
55                                                //wxSize(400,200),
56                                                wxSP_3D |
57                                                wxSP_LIVE_UPDATE );
58         w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
59     wxWindow* w1 = bbGetInputWidget1();
60     wxWindow* w2 = bbGetInputWidget2();
61
62     if (w1==NULL) { w1=new wxPanel(bbGetWxParent()); }
63     if (w2==NULL) { w2=new wxPanel(bbGetWxParent()); }
64     w1->Reparent(w);
65     w2->Reparent(w);
66     int orientation=0;
67         if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true)  { orientation=0; }
68         if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true)    { orientation=1; }
69
70         if (orientation==0) { w->SplitHorizontally( w1, w2, 100); }
71         else                { w->SplitVertically( w1, w2, 100);   }
72
73     bbSetOutputWidget( w );
74   }
75
76 }//namespace bbwx
77
78 #endif // _USE_WXWIDGETS_
79