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
#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);
void Split::bbUserConstructor()
{
- bbSetInputOrientation(0);
+ bbSetInputWinTitle("Split");
+ bbSetInputOrientation("HORIZONTAL");
bbSetInputProportion(50);
}
//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("<<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