]> Creatis software - bbtk.git/blobdiff - packages/wx/src/bbwxLayoutSplit.cxx
*** empty log message ***
[bbtk.git] / packages / wx / src / bbwxLayoutSplit.cxx
index 6b554c932ca714dab292a95832426f4682d3d48b..c5d6cf907cd4bafa44b40f5f832eefc4081416c3 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxLayoutSplit.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/10/17 08:18:32 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2008/11/24 15:45:51 $
+  Version:   $Revision: 1.8 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -58,9 +58,9 @@ namespace bbwx
   {
   }
 
-  void LayoutSplit::CreateWidget()
+  void LayoutSplit::CreateWidget(wxWindow* parent)
   {
-    wxSplitterWindow* w = new wxSplitterWindow(bbGetWxParent(),
+    wxSplitterWindow* w = new wxSplitterWindow(parent, //bbGetWxParent(),
                                               -1,
                                               wxDefaultPosition,
                                               wxDefaultSize,
@@ -68,30 +68,49 @@ namespace bbwx
                                               wxSP_3D |
                                               wxSP_LIVE_UPDATE );
     w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
-    wxWindow* w1 = bbGetInputWidget1();
+/*
+         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;
+ */ 
+
+         wxWindow* w1 = bbCreateWidgetOfInput("Widget1",w);
+         wxWindow* w2 = bbCreateWidgetOfInput("Widget2",w);
+         if (w1==NULL) { w1=new wxPanel(parent); }
+         if (w2==NULL) { w2=new wxPanel(parent); }
+         
+         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); }
+
+         if (orientation==1) { w->SplitHorizontally( w1, w2, 100); }
     else                { w->SplitVertically( w1, w2, 100);   }
-    
+  
     bbSetOutputWidget( w );
   }
 
 
   // This callback is necessary to get actual processing of the view 
   // when window is shown
-  void  LayoutSplit::bbUserOnShow()
+  void  LayoutSplit::OnShowWidget()
   {
+    if (bbGetOutputWidget()==0)
+      {
+       return;
+       //bbtkError("LayoutSplit::OnShowWidget() : Output Widget == 0 !");
+      }
     wxSplitterWindow* win = (wxSplitterWindow*)bbGetOutputWidget();
     int w,h;
+    if (win==0)
+      {
+       return;
+       //      bbtkError("LayoutSplit::OnShowWidget() : win == 0 !");
+      }
     win->GetClientSize(&w,&h);
     int pos = 100;
     if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
@@ -103,6 +122,7 @@ namespace bbwx
       {
        pos = (int)(h * bbGetInputProportion() * 0.01);
       } 
+    //    std::cout << "pos = "<<pos<<std::endl;
   
     win->SetSashPosition(pos,true);
     bbUserOnShowWidget("Widget1");