]> Creatis software - bbtk.git/blobdiff - packages/wx/src/bbwxSplit.cxx
wxNotebook
[bbtk.git] / packages / wx / src / bbwxSplit.cxx
index ed661342d0940d49375858e223ba8623b7b180b2..e780ec10f7a6bb1fa70de9ed82c7eef7ccee1823 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxSplit.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/01/22 15:02:00 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/02/05 18:05:32 $
+  Version:   $Revision: 1.4 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 namespace bbwx
 {
   BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,Split);
-  /*
-  //-------------------------------------------------------------------------
-  SplitWidget::SplitWidget(Split* box,
-                          wxWindow *parent,
-                          int orientation)
-    :
-    WxBlackBoxWidgetPanel(box,parent), 
-    mOrientation(orientation)
-    //( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
-  {
-    wxPanel    *panel                  = this->GetPanel();
-    mwxSplitterWindow          = new wxSplitterWindow(panel,-1,
-                                                      wxDefaultPosition,
-                                                      wxDefaultSize, 
-                                                      wxSP_3D | 
-                                                      wxSP_LIVE_UPDATE );
-    
-    wxBoxSizer *sizer          = new wxBoxSizer(wxVERTICAL);
-    sizer      ->      Add(mwxSplitterWindow, 1, wxGROW, 0);
-#if defined(_WIN32)
- //mwxSplitterWindow -> SetMinimumPaneSize(25);
-#else
-   mwxSplitterWindow -> SetMinimumPaneSize(25);
-#endif // defined(_WIN32) 
-
-    panel      ->      SetSizer(sizer);
-    panel      ->      SetAutoLayout(true);
-    panel      ->      Layout();
-  }
-  //-------------------------------------------------------------------------
-
-  //-------------------------------------------------------------------------
-  void  SplitWidget::SetChilds(wxWindow* child1,wxWindow* child2,
-                                int prop)
-  {
-    if (mwxSplitterWindow->IsSplit()) return;
-    if (mOrientation==0)
-      {
-       int sz =  (int)(GetParent()->GetSize().GetHeight() * prop * 0.01);
-       mwxSplitterWindow->SplitHorizontally( child1 , child2, sz);
-      } 
-    else 
-      {
-       int sz =  (int)(GetParent()->GetSize().GetWidth() * prop * 0.01);
-       mwxSplitterWindow->SplitVertically( child1 , child2, sz );
-      }
-
-
-  }
-  
-  SplitWidget::~SplitWidget()
-  {
-  }
-  
-
-  //-------------------------------------------------------------------------
-  wxSplitterWindow *SplitWidget::GetWxSplitterWindow()
-  {
-    return mwxSplitterWindow;
-  }
-  
-  */
-  //--------------------------------------------------------------------------
-  //-------------------------------------------------------------------------
-  //--------------------------------------------------------------------------
-  //--------------------------------------------------------------------------
 
 
   BBTK_USER_BLACK_BOX_IMPLEMENTATION(Split,bbtk::WxBlackBox);
@@ -104,91 +38,37 @@ namespace bbwx
 
   void Split::bbUserConstructor() 
   { 
+       bbSetInputWinTitle("Split");
     bbSetInputOrientation(0);
     bbSetInputProportion(50);
   }
 
   void Split::Process() 
   { 
-    bbtkDebugMessageInc("Core",9,"Split::Process()"<<std::endl);
-
-    if (bbGetOutputWidget()==0) 
-      {
-       
-       
-       wxSplitterWindow* w = new wxSplitterWindow(bbGetWxParent(),
-                                                  -1,
-                                                  wxDefaultPosition,
-                                                  wxDefaultSize, 
-                                                  //wxSize(400,200),
-                                                  wxSP_3D | 
-                                                  wxSP_LIVE_UPDATE );
-       wxWindow* w1 = bbGetInputWidget1();
-       wxWindow* w2 = bbGetInputWidget2();
-       //w->SetInitialSize(wxSize(100,100));
-       //    int sz =  (int)(GetParent()->GetSize().GetHeight() * prop * 0.01);
-       w1->Reparent(w);
-       w2->Reparent(w);
-       w->SplitHorizontally( w1, w2, 100);
-       //w->SetMinimumPaneSize(100);
-       // w->SetAutoLayout(true);
-       // w->Fit();
-       // w->Layout();
-       
+  }
 
-       bbSetOutputWidget( w );
-      }
+  void Split::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();
+
+    w1->Reparent(w);
+    w2->Reparent(w);
+    w->SplitHorizontally( w1, w2, 100);
+    
+    
+    bbSetOutputWidget( w );
   }
   
   
-  /**
-   * \brief  Create wxWidget . 
-   *
-   *
-   */ 
-  /*
-  bbtk::WxBlackBoxWidget *Split::bbUserCreateWidget(wxWindow *parent)
-  {
-    //printf("EED Split::CreateWxWindow \n" );
-    bbtkDebugMessageInc("Core",9,"Split::bbUserCreateWidget("<<parent<<")"<<std::endl);
-    
-    SplitWidget *wxwidgetsplit = new SplitWidget(this, parent , 
-                                                bbGetInputOrientation() );
-
-    OutputConnectorMapType::iterator i;
-    for (i=bbGetOutputConnectorMap().begin() ; i!=bbGetOutputConnectorMap().end(); ++i )
-      {
-       if (i->first=="WinChild")
-         {
-           const std::vector<bbtk::Connection*>& C = i->second->GetConnectionVector();
-           std::vector<bbtk::Connection*>::const_iterator j;
-           j = C.begin();
-           if (C.size()==2)
-             {
-               wxPanel *w1 = new wxPanel(wxwidgetsplit->GetWxSplitterWindow() ,-1 );
-               wxPanel *w2 = new wxPanel(wxwidgetsplit->GetWxSplitterWindow() ,-1 );
-               bbtkDebugMessage("Debug",1,"Creating panel for "<<(*j)->GetFullName());
-               bbmOutputWinChild->AddToConnectionToWindowMap(*j,w1);
-               bbtkDebugMessage("Debug",1,"..OK"<<std::endl);
-               j++;
-               bbtkDebugMessage("Debug",1,"Creating panel for "<<(*j)->GetFullName());
-               bbmOutputWinChild->AddToConnectionToWindowMap(*j,w2);
-
-               bbtkDebugMessage("Debug",1,"..OK"<<std::endl);
-               wxwidgetsplit->SetChilds( w1 , w2, bbGetInputProportion() );
-             } // if C
-           break;
-         }// if Child
-      }// if i
-    //
-    
-
-    bbtkDebugDecTab("Core",9);
-
-    return wxwidgetsplit;
-
-      }
-  */
 
 }//namespace bbtk