Program: bbtk
Module: $RCSfile: bbtkWxBlackBox.cxx,v $
Language: C++
- Date: $Date: 2008/02/08 10:05:38 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2008/03/10 12:28:43 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
mBox->bbGetFullName()<<")"<<std::endl);
mBox->bbSetWindow(this);
Wx::IncNbWindowsAlive();
- bbtkDebugMessage("Wx",9," -> Number of windows alive = "
+ bbtkDebugMessage("Wx",5," -> Number of windows alive = "
<<Wx::GetNbWindowsAlive()<<std::endl);
}
//=========================================================================
bbHide();
mBox->bbSetWindow(0);
Wx::DecNbWindowsAlive();
- bbtkDebugMessage("Wx",9," -> Number of windows alive = "
+ bbtkDebugMessage("Wx",5," -> Number of windows alive = "
<<Wx::GetNbWindowsAlive()<<std::endl);
}
//=========================================================================
+
//=========================================================================
void WxBlackBoxWindow::bbShow()
{
mBox->bbGetFullName()<<"]"<<std::endl);
Wx::IncNbWindowsShown();
mShown = true;
- bbtkDebugMessage("Wx",9," -> Number of windows shown = "
+ bbtkDebugMessage("Wx",5," -> Number of windows shown = "
<<Wx::GetNbWindowsShown()<<std::endl);
}
//=========================================================================
mBox->bbGetFullName()<<"]"<<std::endl);
Wx::DecNbWindowsShown();
mShown = false;
- bbtkDebugMessage("Wx",9," -> Number of windows shown = "
+ bbtkDebugMessage("Wx",5," -> Number of windows shown = "
<<Wx::GetNbWindowsShown()<<std::endl);
}
//=========================================================================
bbtkDebugMessage("Wx",5,"WxBlackBoxFrame::bbShow("
<<bbGetBlackBox()->bbGetFullName()<<")"<<std::endl);
WxBlackBoxWindow::bbShow();
- wxFrame::Show();
+ wxFrame::Show();
+ // This Update is ** MANDATORY **
+ // to synchronize wxvtkRenderWindowInteractor objects
+ // (force wx objects creation **NOW**)
+ wxFrame::Update();
+ bbGetBlackBox()->bbUserOnShow();
+ // wxFrame::SetFocus();
}
//=========================================================================
bbtkDebugMessage("Wx",9,"WxBlackBoxFrame::bbHide() ["<<
bbGetBlackBox()->bbGetFullName()<<"]"<<std::endl);
WxBlackBoxWindow::bbHide();
- Hide();
+ wxFrame::Hide();
+ bbGetBlackBox()->bbUserOnHide();
}
//=========================================================================
}
//=========================================================================
+ //=========================================================================
+ /// Main processing method of the box.
+ void WxBlackBox::bbExecute(bool force)
+ {
+ bbtkDebugMessageInc("Process",1,
+ "=> WxBlackBox::bbExecute() ["
+ <<bbGetFullName()<<"]"<<std::endl);
+ // If the output 'Widget' is connected then
+ // we must execute the parent box
+ BlackBox::OutputConnectorMapType::const_iterator i
+ = bbGetOutputConnectorMap().find("Widget");
+ if ( i->second->GetConnectionVector().size() != 0 )
+ {
+ bbtkDebugMessage("Process",2,
+ "-> Output 'Widget' connected : transfering execution to parent"
+ <<std::endl);
+
+ i->second->GetConnectionVector().front()
+ ->GetBlackBoxTo()->bbExecute(force);
+
+ }
+ // else call 'standard' BlackBox execution method
+ else
+ {
+ BlackBox::bbExecute(force);
+ }
+ //
+
+ bbtkDebugMessageDec("Process",1,
+ "<= WxBlackBox::bbExecute() ["
+ <<bbGetFullName()<<"]"<<std::endl);
+ }
+ //=========================================================================
+
+
+ //=========================================================================
+ void WxBlackBox::bbProcess()
+ {
+ if (bbGetOutputWidget()==0) this->bbUserCreateWidget();
+ this->bbUserProcess();
+ bbShowWindow();
+ }
+ //=========================================================================
+
//==================================================================
/// Specific methods for window creation during pipeline execution
/// Shows the window associated to the box
" Input WinDialog set to true : creating a Dialog"
<<std::endl);
show = (Window*) new WxBlackBoxDialog( this,
- Wx::GetTopWindow(),
+ bbGetWxParent(),
std2wx( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN"),
wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) );
}
" Input WinDialog set to false : creating a Frame"
<<std::endl);
show = (Window*) new WxBlackBoxFrame( this,
- Wx::GetTopWindow(),
+ bbGetWxParent(),
std2wx( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN"),
wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) );
}
//==================================================================
+ //==================================================================
+ WxBlackBox::Window* WxBlackBox::bbGetContainingWindow()
+ {
+ if (bbGetWindow()!=0) return bbGetWindow();
+ BlackBox::OutputConnectorMapType::const_iterator i
+ = bbGetOutputConnectorMap().find("Widget");
+ if ( i->second->GetConnectionVector().size() != 0 )
+ {
+ return ((WxBlackBox*)i->second->GetConnectionVector().front()
+ ->GetBlackBoxTo())->bbGetContainingWindow();
+ }
+ return 0;
+ }
+ //==================================================================
+
+
+ //==================================================================
+ wxWindow* WxBlackBox::bbGetWxParent() { return Wx::GetTopWindow(); }
+ //==================================================================
+
+
+ //==================================================================
+ bool WxBlackBox::bbIsShown()
+ {
+ if (bbGetContainingWindow()!=0)
+ return bbGetContainingWindow()->bbIsShown();
+ return false;
+ }
+ //==================================================================
}//namespace bbtk