Program: bbtk
Module: $RCSfile: bbtkWidgetBlackBox.txx,v $
Language: C++
- Date: $Date: 2009/04/21 14:36:51 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/05/19 10:19:23 $
+ Version: $Revision: 1.4 $
=========================================================================*/
/* ---------------------------------------------------------------------
//=========================================================================
template <class T>
- void WidgetBlackBox<T>::bbUserConstructor()
+ void WidgetBlackBox<T>::bbUserSetDefaultValues()
{
- bbtkDebugMessage("widget",9,"WidgetBlackBox::bbUserConstructor()"<<std::endl);
- bbInitAttributes();
+ bbtkDebugMessage("widget",9,"WidgetBlackBox::bbUserSetDefaultValues()"<<std::endl);
+ bbmWindow = 0;
+ bbSetInputWinTitle(bbGetName());
+ bbSetInputWinWidth(800);
+ bbSetInputWinHeight(800);
+ bbSetInputWinDialog(false);
+ bbSetOutputWidget(0);
}
//=========================================================================
+
//=========================================================================
template <class T>
- void WidgetBlackBox<T>::bbUserCopyConstructor(bbtk::BlackBox::Pointer)
+ void WidgetBlackBox<T>::bbUserInitializeProcessing()
{
- bbtkDebugMessage("widget",9,"WidgetBlackBox::bbUserCopyConstructor()"
- <<std::endl);
- bbInitAttributes();
}
//=========================================================================
-
//=========================================================================
template <class T>
- void WidgetBlackBox<T>::bbUserDestructor()
+ void WidgetBlackBox<T>::bbUserFinalizeProcessing()
{
- bbtkDebugMessage("widget",9,"==> WidgetBlackBox::bbUserDestructor() ["<<bbGetFullName()<<"]"<<std::endl);
- if (bbGetWindow()) {
- bbGetWindow()->bbClose();
- bbSetWindow(0);
- }
- bbtkDebugMessage("widget",9,"<== WidgetBlackBox::bbUserDestructor() ["<<bbGetFullName()<<"]"<<std::endl);
+ bbtkDebugMessage("widget",9,"==> WidgetBlackBox::bbUserFinalizeProcessing() ["<<bbGetFullName()<<"]"<<std::endl);
+ if (bbGetWindow())
+ {
+ if (GetUseCount()==0)
+ {
+ if (bbGetWindow()->bbIsShown()) DecNbWindowsShown();
+ DecNbWindowsAlive();
+ }
+ bbGetWindow()->bbDestroy();
+ bbSetWindow(0);
+ }
+ bbtkDebugMessage("widget",9,"<== WidgetBlackBox::bbUserFinalizeProcessing() ["<<bbGetFullName()<<"]"<<std::endl);
}
//=========================================================================
- //=========================================================================
- /**
- * \brief Initialize the attributes of the class
- *
- */
- template <class T>
- void WidgetBlackBox<T>::bbInitAttributes()
- {
- bbmWindow = 0;
- bbSetInputWinTitle(bbGetName());
- bbSetInputWinWidth(800);
- bbSetInputWinHeight(800);
- bbSetInputWinDialog(false);
- bbSetOutputWidget(0);
- }
- //=========================================================================
-
+
//=========================================================================
template <class T>
// Cast it into a WidgetBlackBox
typename WidgetBlackBox<T>::Pointer wfrom
= boost::dynamic_pointer_cast<WidgetBlackBox<T> >(from);
- // Call bbCreateWidget
+ // If the black box from construction is not done yet : do it
+ // If not constructed do it
+ wfrom->bbInitializeProcessing();
+ // Call bbUserCreateWidget
wfrom->bbUserCreateWidget(parent);
// Get the widget created
w = wfrom->bbGetOutputWidget();
bbtkDebugMessageInc("widget",1,"=> WidgetBlackBox::bbCloseWindow() ["
<<bbGetFullName()<<"]"<<std::endl);
- if (bbGetWindow()!=0) bbGetWindow()->bbClose();
+ if (bbGetWindow()!=0) bbGetWindow()->bbDestroy();
bbtkDebugMessageDec("widget",2,"<= WidgetBlackBox::bbCloseWindow() ["
<<bbGetFullName()<<"]"<<std::endl);