Program: bbtk
Module: $RCSfile: bbtkUserBlackBox.h,v $
Language: C++
- Date: $Date: 2008/01/22 15:02:00 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2008/01/22 15:41:34 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/// First checks that re-processing is needed (either Status==MODIFIED or InputProcessMode==Always)
/// then :
/// - updates its inputs by calling bbUpdateInputs (which recursively calls bbBackwardUpdate on amont boxes)
- /// - calls bbCreateWidget
- /// - calls bbProcess which is the user callback which does the actual processing
- /// - calls bbUpdateChildren
- /// - calls bbShowWidget which shows the widget associated to the box (if any)
+ /// - calls bbProcess which here simply calls the user callback bbUserProcess which does the actual processing.
+ /// bbProcess is overloaded in WxBlackBox to handle widget creation and show
IOStatus bbBackwardUpdate(Connection* caller);
//==================================================================
//==================================================================
- /// Recursive pipeline processing in forward direction along "Child"-"Parent" connections
- ///
- /// First checks that re-processing is needed (either Status==MODIFIED or InputProcessMode==Always)
- /// then :
- /// - calls bbCreateWidget
- /// - calls bbProcess which is the user callback which does the actual processing
- /// - calls bbUpdateChildren which recursively calls bbForwardUpdate on connections attached the "Child" output
- // void bbForwardUpdate(Connection* caller);
- //==================================================================
protected:
+ //==================================================================
+ /// Calls the user defined processing method.
+ /// Overloaded in WxBlackBox to handle widget creation and show
+ virtual void bbProcess() { this->bbUserProcess(); }
+ //==================================================================
+
//==================================================================
/// User callback which computes the outputs as a function of the inputs.
/// It is assumed to be deterministic and thus is only called is the inputs have changed
/// (i.e. if the black box is marked as modified)
- virtual void bbProcess()
+ virtual void bbUserProcess()
{
- bbtkWarning("UserBlackBox::bbProcess() not overloaded for box '"
+ bbtkWarning("UserBlackBox::bbUserProcess() not overloaded for box '"
<<bbGetFullName()
<<"' : the box does nothing. Is it a bug or a feature ?"
<<std::endl);
Program: bbtk
Module: $RCSfile: bbtkUserBlackBoxMacros.h,v $
Language: C++
- Date: $Date: 2008/01/22 15:02:00 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2008/01/22 15:41:34 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//============================================================================
-/// Defines the bbProcess method
+/// Defines the bbUserProcess method
#define BBTK_PROCESS(CALLBACK) \
public: \
- inline void bbProcess() \
+ inline void bbUserProcess() \
{ \
- bbtkDebugMessageInc("Process",1,"=> "<<bbGetTypeName()<<"::bbProcess() [" \
+ bbtkDebugMessageInc("Process",1,"=> "<<bbGetTypeName()<<"::bbUserProcess() [" \
<<bbGetFullName()<<"]"<<std::endl); \
CALLBACK(); \
- bbtkDebugMessageDec("Process",1,"<= "<<bbGetTypeName()<<"::bbProcess() [" \
+ bbtkDebugMessageDec("Process",1,"<= "<<bbGetTypeName()<<"::bbUserProcess() [" \
<<bbGetFullName()<<"]"<<std::endl); \
}
//============================================================================
Program: bbtk
Module: $RCSfile: bbtkWxBlackBox.cxx,v $
Language: C++
- Date: $Date: 2008/01/22 15:02:00 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2008/01/22 15:41:34 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/// Specific methods for window creation during pipeline execution
/// Shows the window associated to the box
/// (called after bbProcess during bbExecute)
- void WxBlackBox::bbShowWindow(Connection* caller)
+ void WxBlackBox::bbShowWindow()
{
bbtkDebugMessageInc("Process",1,"=> WxBlackBox::bbShowWindow() ["
<<bbGetFullName()<<"]"<<std::endl);
Program: bbtk
Module: $RCSfile: bbtkWxBlackBox.h,v $
Language: C++
- Date: $Date: 2008/01/22 15:02:00 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2008/01/22 15:41:34 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
BBTK_DECLARE_INPUT(WinDialog,bool);
BBTK_DECLARE_INPUT(WinHide,Void);
BBTK_DECLARE_OUTPUT(Widget, wxWindow*);//WxBlackBoxWidget*);
- BBTK_PROCESS(Process);
public:
typedef WxBlackBoxWindow Window;
virtual void bbUserDestructor();
//==================================================================
- /*
-
- //==================================================================
- /// User callback for creating the window associated to the box
- /// Can be overloaded in order to impose your own window to show,
- /// Typically if your widget is already a dialog that cannot
- /// be inserted into a parent.
- /// WARNING : If you use it then your widget will not be inserted
- /// in the parent window, if any
- /// (i.e. even if the Parent-Child connection is set)
- virtual Window* bbUserCreateWindow()
- {
- return 0;
- }
- //==================================================================
-
//==================================================================
/// User callback for creating the widget associated to the box
- /// Must be defined if bbUserCreateWindow is not
- virtual Widget* bbUserCreateWidget(wxWindow *parent)
+ /// ** Must be defined **
+ virtual void bbUserCreateWidget()
{
- bbtkError(bbGetTypeName()<<" is a WxBlackBox whose bbUserCreateWindow and bbUserCreateWidget methods are both undefined : cannot work !!");
- return 0;
+ bbtkError(bbGetTypeName()<<" is a WxBlackBox whose bbUserCreateWidget methods is undefined : cannot work !!");
}
//==================================================================
- */
+
+ //==================================================================
+ /// Calls the user defined widget creation method
+ /// and the user processing method and then displays the window
+ virtual void bbProcess()
+ {
+ if (bbGetOutputWidget()==0) this->bbUserCreateWidget();
+ this->bbUserProcess();
+ bbShowWindow();
+ }
+ //==================================================================
//==================================================================
/// Specific methods for windows creation during pipeline execution
- //void bbCreateWindow();
- void bbShowWindow(Connection* caller);
+ void bbShowWindow();
void bbHideWindow();
//==================================================================
- void Process() { }
-
private:
/// friendship
friend class WxBlackBoxWindow;
//=================================================================
+ //======================================================================
+ /// Defines the bbUserCreateWidget method
+#define BBTK_CREATE_WIDGET(CALLBACK) \
+ public: \
+ inline void bbUserCreateWidget() \
+ { \
+ bbtkDebugMessageInc("Process",1,"=> "<<bbGetTypeName()<<"::bbUserCreateWidget() [" \
+ <<bbGetFullName()<<"]"<<std::endl); \
+ CALLBACK(); \
+ bbtkDebugMessageDec("Process",1,"<= "<<bbGetTypeName()<<"::bbUserCreateWidget() [" \
+ <<bbGetFullName()<<"]"<<std::endl); \
+ }
+
+ //======================================================================
+
//=================================================================
// UserBlackBox description
BBTK_BEGIN_DESCRIBE_BLACK_BOX(WxBlackBox,bbtk::UserBlackBox);
Program: bbtk
Module: $RCSfile: bbwxSlider.cxx,v $
Language: C++
- Date: $Date: 2008/01/22 15:02:00 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2008/01/22 15:41:35 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//--------------------------------------------------------------------------
void Slider::Process()
{
- int val = bbGetInputIn();
bbSetOutputOut( bbGetInputIn() );
+ }
- if (bbGetOutputWidget()==0)
- {
- bbSetOutputWidget( new SliderWidget(this,
- bbGetWxParent(),
- bbGetInputOrientation() ,
- bbGetInputChangeResolution(),
- bbGetInputLabel(),
- bbtk::std2wx( bbGetInputTitle() ),
- bbGetInputMin(),
- bbGetInputMax(),
- val,
- bbGetInputReactiveOnTrack()
- )
- );
- }
+ void Slider::CreateWidget()
+ {
+ bbSetOutputWidget( new SliderWidget(this,
+ bbGetWxParent(),
+ bbGetInputOrientation() ,
+ bbGetInputChangeResolution(),
+ bbGetInputLabel(),
+ bbtk::std2wx( bbGetInputTitle() ),
+ bbGetInputMin(),
+ bbGetInputMax(),
+ bbGetInputIn(),
+ bbGetInputReactiveOnTrack()
+ )
+ );
}
+
//--------------------------------------------------------------------------
/*
//--------------------------------------------------------------------------
Program: bbtk
Module: $RCSfile: bbwxSlider.h,v $
Language: C++
- Date: $Date: 2008/01/22 15:02:00 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2008/01/22 15:41:35 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
BBTK_DECLARE_INPUT(ReactiveOnTrack,int);
BBTK_DECLARE_OUTPUT(Out,int);
BBTK_PROCESS(Process);
+ BBTK_CREATE_WIDGET(CreateWidget);
void Process();
+ void CreateWidget();
protected:
virtual void bbUserConstructor();
-
- // private:
- // virtual bbtk::WxBlackBoxWidget* bbUserCreateWidget(wxWindow *parent);
};
//=================================================================
Program: bbtk
Module: $RCSfile: bbwxSplit.cxx,v $
Language: C++
- Date: $Date: 2008/01/22 15:02:00 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2008/01/22 15:41:35 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
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 );
+ 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 );
}
Program: bbtk
Module: $RCSfile: bbwxSplit.h,v $
Language: C++
- Date: $Date: 2008/01/22 15:02:00 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2008/01/22 15:41:35 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
BBTK_DECLARE_INPUT(Orientation,int);
BBTK_DECLARE_INPUT(Proportion,int);
BBTK_PROCESS(Process);
- // BBTK_CREATE_WIDGET(CreateWidget);
+ BBTK_CREATE_WIDGET(CreateWidget);
void Process();
- // void CreateWidget();
+ void CreateWidget();
protected:
virtual void bbUserConstructor();