]> Creatis software - bbtk.git/blobdiff - packages/wx/src/bbwxLayoutSplit.cxx
LayoutSplit
[bbtk.git] / packages / wx / src / bbwxLayoutSplit.cxx
diff --git a/packages/wx/src/bbwxLayoutSplit.cxx b/packages/wx/src/bbwxLayoutSplit.cxx
new file mode 100644 (file)
index 0000000..4575074
--- /dev/null
@@ -0,0 +1,78 @@
+/*=========================================================================
+                                                                                
+  Program:   bbtk
+  Module:    $RCSfile: bbwxLayoutSplit.cxx,v $
+  Language:  C++
+  Date:      $Date: 2008/02/15 12:24:43 $
+  Version:   $Revision: 1.1 $
+                                                                                
+  Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+  l'Image). All rights reserved. See Doc/License.txt or
+  http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
+                                                                                
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+                                                                                
+=========================================================================*/
+/**
+ *  \file
+ *  \brief
+ */
+
+
+#ifdef _USE_WXWIDGETS_
+
+#include "bbwxLayoutSplit.h"
+#include "bbwxPackage.h"
+#include "bbtkUtilities.h"
+
+
+namespace bbwx
+{
+  BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,LayoutSplit);
+  BBTK_USER_BLACK_BOX_IMPLEMENTATION(LayoutSplit,bbtk::WxBlackBox);
+
+  void LayoutSplit::bbUserConstructor()
+  {
+    bbSetInputOrientation("VERTICAL");
+    bbSetInputProportion(50);
+    bbSetInputWidget1(NULL);
+    bbSetInputWidget2(NULL);
+  }
+
+  void LayoutSplit::Process()
+  {
+  }
+
+  void LayoutSplit::CreateWidget()
+  {
+    wxSplitterWindow* w = new wxSplitterWindow(bbGetWxParent(),
+                                              -1,
+                                              wxDefaultPosition,
+                                              wxDefaultSize,
+                                              //wxSize(400,200),
+                                              wxSP_3D |
+                                              wxSP_LIVE_UPDATE );
+       w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
+    wxWindow* w1 = bbGetInputWidget1();
+    wxWindow* w2 = bbGetInputWidget2();
+
+    if (w1==NULL) { w1=new wxPanel(bbGetWxParent()); }
+    if (w2==NULL) { w2=new wxPanel(bbGetWxParent()); }
+    w1->Reparent(w);
+    w2->Reparent(w);
+    int orientation=0;
+       if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true)  { orientation=0; }
+       if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true)    { orientation=1; }
+
+       if (orientation==1) { w->SplitHorizontally( w1, w2, 100); }
+       else                { w->SplitVertically( w1, w2, 100);   }
+
+    bbSetOutputWidget( w );
+  }
+
+}//namespace bbwx
+
+#endif // _USE_WXWIDGETS_
+