X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fwx%2Fsrc%2FbbwxSplit.cxx;h=8d05e106c3024af86cf8b1c87c8a50ff74f810c5;hb=dfd2ff30bc71b28174b0f5d49380648e11d58f0a;hp=7386ef3eca6c4098961f2293f1ec5fbfeed5c12e;hpb=555854b9edeeb49fdd03fad2b1274e6d6db6d9f7;p=bbtk.git diff --git a/packages/wx/src/bbwxSplit.cxx b/packages/wx/src/bbwxSplit.cxx index 7386ef3..8d05e10 100644 --- a/packages/wx/src/bbwxSplit.cxx +++ b/packages/wx/src/bbwxSplit.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbwxSplit.cxx,v $ Language: C++ - Date: $Date: 2008/01/22 15:41:35 $ - Version: $Revision: 1.2 $ + Date: $Date: 2008/02/08 14:58:31 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -25,78 +25,14 @@ #include "bbwxSplit.h" #include "bbwxPackage.h" +#include "bbtkUtilities.h" + //#include "bbtk 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,7 +40,8 @@ namespace bbwx void Split::bbUserConstructor() { - bbSetInputOrientation(0); + bbSetInputWinTitle("Split"); + bbSetInputOrientation("HORIZONTAL"); bbSetInputProportion(50); } @@ -121,71 +58,23 @@ namespace bbwx //wxSize(400,200), wxSP_3D | wxSP_LIVE_UPDATE ); + w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) ); 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(); + 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==0) { w->SplitHorizontally( w1, w2, 100); } + if (orientation==1) { w->SplitVertically( w1, w2, 100); } bbSetOutputWidget( w ); } - /** - * \brief Create wxWidget . - * - * - */ - /* - bbtk::WxBlackBoxWidget *Split::bbUserCreateWidget(wxWindow *parent) - { - //printf("EED Split::CreateWxWindow \n" ); - bbtkDebugMessageInc("Core",9,"Split::bbUserCreateWidget("<first=="WinChild") - { - const std::vector& C = i->second->GetConnectionVector(); - std::vector::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"<GetFullName()); - bbmOutputWinChild->AddToConnectionToWindowMap(*j,w2); - - bbtkDebugMessage("Debug",1,"..OK"<SetChilds( w1 , w2, bbGetInputProportion() ); - } // if C - break; - }// if Child - }// if i - // - - - bbtkDebugDecTab("Core",9); - - return wxwidgetsplit; - - } - */ }//namespace bbtk