X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=kernel%2Fsrc%2FbbtkWxBlackBox.h;h=878c83b79ea61bf91d09b1843ae9f9633341024d;hb=fb65ef0feb38b84723ea928ec3d3c056ba26274e;hp=bfa37e78cfd215cfa9d0b6e7c9ab045acd6d2f1a;hpb=236a8e2fee9937c050e2d16c7222e1caa993f01c;p=bbtk.git diff --git a/kernel/src/bbtkWxBlackBox.h b/kernel/src/bbtkWxBlackBox.h index bfa37e7..878c83b 100644 --- a/kernel/src/bbtkWxBlackBox.h +++ b/kernel/src/bbtkWxBlackBox.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkWxBlackBox.h,v $ Language: C++ - Date: $Date: 2008/11/13 14:46:43 $ - Version: $Revision: 1.19 $ + Date: $Date: 2008/12/11 15:30:04 $ + Version: $Revision: 1.24 $ ========================================================================*/ @@ -44,7 +44,7 @@ */ -#ifdef _USE_WXWIDGETS_ +#ifdef USE_WXWIDGETS #ifndef __bbtkWxBlackBox_h__ @@ -77,18 +77,17 @@ namespace bbtk class BBTK_EXPORT WxBlackBox : public bbtk::AtomicBlackBox { BBTK_BLACK_BOX_INTERFACE(WxBlackBox,bbtk::AtomicBlackBox); - // BBTK_DECLARE_INPUT(WinParent,WxParentToChildData*); BBTK_DECLARE_INPUT(WinTitle,std::string); BBTK_DECLARE_INPUT(WinWidth,int); BBTK_DECLARE_INPUT(WinHeight,int); BBTK_DECLARE_INPUT(WinDialog,bool); BBTK_DECLARE_INPUT(WinHide,Void); BBTK_DECLARE_INPUT(WinClose,Void); - BBTK_DECLARE_OUTPUT(Widget, wxWindow*);//WxBlackBoxWidget*); + BBTK_DECLARE_OUTPUT(Widget, wxWindow*); public: /// Main processing method of the box. Overloaded to handle windows inclusion : if the output Widget is connected then the execution is transfered to the box to which it is connected (as the container window must be created and displayed - this box will be executed by the normal pipeline recursion mechanism) - virtual void bbExecute(bool force = false); + // virtual void bbExecute(bool force = false); typedef WxBlackBoxWindow Window; @@ -107,9 +106,6 @@ namespace bbtk /// Else returns 0; Window* bbGetContainingWindow(); - /// Returns the parent wxWindow that must be used to create the widget - wxWindow* bbGetWxParent(); - /// Returns true iff the 'containing window' exists and is shown /// (see bbGetContainingWindow). bool bbIsShown(); @@ -124,6 +120,11 @@ namespace bbtk virtual void bbUserOnHide() {} //================================================================== + + //================================================================== + void bbCreateWidgetAndEventHandler(wxWindow* parent); + //================================================================== + protected: @@ -131,7 +132,7 @@ namespace bbtk /// User callback called in the box contructor virtual void bbUserConstructor(); /// User callback called in the box copy constructor - virtual void bbUserCopyConstructor(); + virtual void bbUserCopyConstructor(bbtk::BlackBox::Pointer); /// User callback called in the box destructor virtual void bbUserDestructor(); //================================================================== @@ -139,28 +140,24 @@ namespace bbtk //================================================================== /// User callback for creating the widget associated to the box /// ** Must be defined ** - virtual void bbUserCreateWidget() + virtual void bbUserCreateWidget(wxWindow* parent) { bbtkError(bbGetTypeName()<<" is a WxBlackBox whose bbUserCreateWidget methods is not overloaded : is it a feature or a bug ?!?"); } //================================================================== - - - //================================================================== - /// Main processing method of the box. - virtual IOStatus bbBackwardUpdate( Connection::Pointer caller ); - //================================================================== - + //================================================================== + // For layout widgets : creates and returns the widget + // of the box connected to input in + wxWindow* bbCreateWidgetOfInput(const std::string& in, wxWindow* parent); + //================================================================== + //================================================================== - /// Overloaded processing method for WxBlackBoxes : - /// 1) if the widget is null then - /// calls the user defined widget creation method : bbUserCreateWidget() - /// 2) calls the user defined processing method : bbUserProcess() - /// 3) displays the window : bbShowWindow(); + /// Overloaded processing method for WxBlackBoxes which handles + /// the window creation if needed virtual void bbProcess(); //================================================================== @@ -170,7 +167,7 @@ namespace bbtk /// (does nothing if the box output 'Widget' is connected which /// means that the box does not have its own window but is contained /// into another window) - void bbShowWindow(); + // void bbShowWindow(); /// Hides the WxBlackBoxWindow associated to the box (if exists) void bbHideWindow(); /// Closes (destroys) the WxBlackBoxWindow associated to the box (if exists) @@ -208,12 +205,13 @@ namespace bbtk /// on a contained window /// Is set to true before transfering update to parent /// in order to not re-transfer a second time... + /* bool bbmUpdateTransferedToParent; bool bbGetUpdateTransferedToParent() const { return bbmUpdateTransferedToParent; } void bbSetUpdateTransferedToParent(bool b) { bbmUpdateTransferedToParent = b; } - + */ }; //================================================================= @@ -222,11 +220,11 @@ namespace bbtk /// Defines the bbUserCreateWidget method #define BBTK_CREATE_WIDGET(CALLBACK) \ public: \ - inline void bbUserCreateWidget() \ + inline void bbUserCreateWidget(wxWindow* parent) \ { \ bbtkDebugMessageInc("wx",1,"**> Creating widget for [" \ <