From: guigues Date: Mon, 24 Nov 2008 15:45:46 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: v0.9.1~83 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=e4149b56dda0cfb15427533e6f573f09cd3ff74b;p=bbtk.git *** empty log message *** --- diff --git a/kernel/appli/bbfy/bbfy.cpp b/kernel/appli/bbfy/bbfy.cpp index 58407a5..db4161b 100644 --- a/kernel/appli/bbfy/bbfy.cpp +++ b/kernel/appli/bbfy/bbfy.cpp @@ -719,7 +719,7 @@ void bbfy::CreateHeader() if (mIsWidget) { mFile << " BBTK_CREATE_WIDGET(CreateWidget);\n" ; - mFile << " void CreateWidget();\n"; + mFile << " void CreateWidget(wxWindow*);\n"; } @@ -1039,7 +1039,7 @@ void bbfy::CreateCode() // CreateWidget if (mIsWidget) { - mFile << "void "<bbCreateWidgetAndEventHandler(this); wxWindow* widget = bbGetBlackBox()->bbGetOutputWidget(); - widget->Reparent(this); +// old : widget->Reparent(this); sizer->Add( widget, 1, wxALL|wxEXPAND, 2); //SetAutoLayout(true); SetSizer(sizer); @@ -218,9 +220,11 @@ namespace bbtk <bbCreateWidgetAndEventHandler(this); wxWindow* widget = bbGetBlackBox()->bbGetOutputWidget(); wxFrame* frame = (wxFrame*)this; - widget->Reparent(frame); +// old : widget->Reparent(frame); sizer->Add( widget, 1, wxALL|wxGROW, 2); // frame->SetAutoLayout(true); frame->SetSizer(sizer); @@ -553,13 +557,133 @@ namespace bbtk //========================================================================= void WxBlackBox::bbProcess() { - if (bbGetOutputWidget()==0) this->bbUserCreateWidget(); +/* + if (bbGetOutputWidget()==0) this->bbUserCreateWidget(); this->bbUserProcess(); bbShowWindow(); // this->bbUserOnShow(); +*/ + // LG 22/11/08 : new widget pipeline + // If output widget not connected : + if ( (*bbGetOutputConnectorMap().find("Widget")).second + ->GetConnectionVector().size() == 0 ) + { + Window* show = 0; + // If the window already exists : no need creating it + if (bbGetWindow()!=0) + { + bbtkDebugMessage("wx",2, + "-> Window already exists" + < Creating the window" + <(), + // bbGetWxParent(), + // LG 24/11/08 : New widget pipeline + Wx::GetTopWindow(), + std2wx( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN"), + wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) ); + } + // Input WinDialog set to false : creating a Frame + else + { + bbtkDebugMessage("process",2, + " Input WinDialog set to false : creating a Frame" + <(), + // bbGetWxParent(), + // LG 24/11/08 : New widget pipeline + Wx::GetTopWindow(), + std2wx( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN"), + wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) ); + } + + } + + // Show the window + show->bbShow(); + + + } + this->bbUserProcess(); + } //========================================================================= - + + + + // LG 24/11/08 : New widget pipeline + void WxBlackBox::bbCreateWidgetAndEventHandler(wxWindow* parent) + { + if (bbGetOutputWidget()==0) + { + this->bbUserCreateWidget(parent); + } + // If Event Handler for the widget does not exist or is obsolete : create it + if (bbGetOutputWidget()!=0) + { + if (bbGetWidgetEventHandler()==0) + { + bbtkDebugMessage("wx",3, + "-> No widget event handler : creating one" + <(), + bbGetOutputWidget()); + } + else if ( ! bbGetWidgetEventHandler()->IsHandlerOf + ( bbGetOutputWidget() ) ) + { + bbtkDebugMessage("wx",3, + "-> Obsolete widget event handler : re-creating one" + <(), + bbGetOutputWidget()); + } + // Sets the name of the wxWindow to the input WinTitle + bbGetOutputWidget()->SetName(bbtk::std2wx(bbGetInputWinTitle())); + } + + + } + + + + wxWindow* WxBlackBox::bbCreateWidgetOfInput(const std::string& in, wxWindow* parent) + { + wxWindow* w = 0; + // If input is connected + BlackBoxInputConnector* c = bbGetInputConnectorMap().find(in)->second ; + if ( c->IsConnected() ) + { + // Get black box from + BlackBox::Pointer from = + c->GetConnection()->GetBlackBoxFrom(); + // Cast it into a WxBlackBox + WxBlackBox::Pointer wfrom = boost::dynamic_pointer_cast(from); + // Call bbCreateWidgetAndEventHandler + wfrom->bbCreateWidgetAndEventHandler(parent); + // Get the widget created + w = wfrom->bbGetOutputWidget(); + } + return w; + } + + /* //================================================================== /// Specific methods for window creation during pipeline execution /// Shows the window associated to the box @@ -631,7 +755,9 @@ namespace bbtk " Input WinDialog set to true : creating a Dialog" <(), - bbGetWxParent(), + // bbGetWxParent(), + // LG 24/11/08 : New widget pipeline + Wx::GetTopWindow(), std2wx( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN"), wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) ); } @@ -642,7 +768,9 @@ namespace bbtk " Input WinDialog set to false : creating a Frame" <(), - bbGetWxParent(), + // bbGetWxParent(), + // LG 24/11/08 : New widget pipeline + Wx::GetTopWindow(), std2wx( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN"), wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) ); } @@ -673,7 +801,7 @@ namespace bbtk } //================================================================== - +*/ @@ -722,7 +850,8 @@ namespace bbtk //================================================================== - wxWindow* WxBlackBox::bbGetWxParent() { return Wx::GetTopWindow(); } + // LG 24/11/08 : New widget pipeline + // wxWindow* WxBlackBox::bbGetWxParent() { return Wx::GetTopWindow(); } //================================================================== diff --git a/kernel/src/bbtkWxBlackBox.h b/kernel/src/bbtkWxBlackBox.h index bfa37e7..e8acc44 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/11/24 15:45:48 $ + Version: $Revision: 1.20 $ ========================================================================*/ @@ -77,14 +77,13 @@ 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) @@ -108,7 +107,9 @@ namespace bbtk Window* bbGetContainingWindow(); /// Returns the parent wxWindow that must be used to create the widget - wxWindow* bbGetWxParent(); + // + // LG 24/11/08 : New widget pipeline + // wxWindow* bbGetWxParent(); /// Returns true iff the 'containing window' exists and is shown /// (see bbGetContainingWindow). @@ -124,6 +125,10 @@ namespace bbtk virtual void bbUserOnHide() {} //================================================================== + // LG 24/11/08 : New widget pipeline + void bbCreateWidgetAndEventHandler(wxWindow* parent); + + protected: @@ -139,14 +144,16 @@ namespace bbtk //================================================================== /// User callback for creating the widget associated to the box /// ** Must be defined ** - virtual void bbUserCreateWidget() + // LG 24/11/08 : New widget pipeline + virtual void bbUserCreateWidget(wxWindow* parent) { bbtkError(bbGetTypeName()<<" is a WxBlackBox whose bbUserCreateWidget methods is not overloaded : is it a feature or a bug ?!?"); } //================================================================== - + wxWindow* bbCreateWidgetOfInput(const std::string& in, wxWindow* parent); + //================================================================== /// Main processing method of the box. @@ -222,11 +229,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 [" \ <UpdateURL(); + mBrowser->OnLinkClicked2(e); } - //======================================================================== */ - //EED2 BEGIN_EVENT_TABLE(WxHtmlWindow, wxPanel) //EED2 EVT_SIZE(WxHtmlWindow::OnSize) //EED2 END_EVENT_TABLE() @@ -108,7 +100,7 @@ namespace bbtk EVT_BUTTON(reload_id, WxGUIHtmlBrowser::OnReloadButton ) // EVT_BUTTON(include_id, WxGUIHtmlBrowser::OnIncludeFileButton ) EVT_TEXT_ENTER(url_id, WxGUIHtmlBrowser::OnURLEnter ) - EVT_HTML_LINK_CLICKED(html_id, WxGUIHtmlBrowser::OnLinkClicked) + EVT_HTML_LINK_CLICKED(html_id, WxGUIHtmlBrowser::OnLinkClicked) EVT_SIZE(WxGUIHtmlBrowser::OnSize) END_EVENT_TABLE() @@ -161,8 +153,13 @@ namespace bbtk bsizer->Add(mwxURL, 1, wxEXPAND); -// mwxHtmlWindow = new WxHtmlWindow(parent,html_id,this,size); - mwxHtmlWindow = new WxHtmlWindow(this,html_id,this,size); +// mwxHtmlWindow = new WxHtmlWindow(this,html_id,this,size); + + mwxHtmlWindow = new wxHtmlWindow(this,html_id, + wxDefaultPosition, + size, + wxHW_SCROLLBAR_AUTO, + _T("bbtk::WxGUIHtmlBrowser")); /* @@ -180,21 +177,12 @@ namespace bbtk wxDefaultPosition, size ), wxVERTICAL ); -//EED hw->Add ( mwxHtmlWindow, 1, wxGROW ); - hw->Add ( mwxHtmlWindow, 1, wxEXPAND ); - - - - - //sizer->Add ( mwxHtmlWindow, 1, wxGROW ); -//EED sizer->Add ( hw, 1, wxGROW ); // | wxLEFT | wxRIGHT | wxBOTTOM, 10 ); + hw->Add ( mwxHtmlWindow, 1, wxEXPAND ); sizer->Add ( bsizer , 0, wxEXPAND ); sizer->Add ( hw, 1, wxGROW ); // | wxLEFT | wxRIGHT | wxBOTTOM, 10 ); - - panel -> SetSizer(sizer); panel -> SetAutoLayout(true); panel -> Layout(); @@ -299,11 +287,29 @@ namespace bbtk } //======================================================================== - + //======================================================================== + void WxGUIHtmlBrowser::OnLinkClicked2(const wxHtmlLinkInfo& info) + { + std::cout << "OLK2"<WxGUIHtmlBrowserUserOnLinkClicked( wx2std( file ) ); + } + if (go) + { + mwxHtmlWindow->LoadPage( info.GetHref() ); + UpdateURL(); + } + + + } + //======================================================================== void WxGUIHtmlBrowser::OnLinkClicked(wxHtmlLinkEvent& e) { - + std::cout << "OLK"< ColourSelectorButton::CreateWidget()"<GetValue() ); - bbSetOutputOut( w->GetValue() ); - w->SetTitle( bbtk::std2wx ( bbGetInputTitle() ) ); + if (w) + { + bbSetInputIn( w->GetValue() ); + w->SetTitle( bbtk::std2wx ( bbGetInputTitle() ) ); + } + bbSetOutputOut( bbGetInputIn() ); } - void InputText::CreateWidget() + void InputText::CreateWidget(wxWindow* parent) { bbSetOutputWidget - ( (wxWindow*) new InputTextWidget(this, bbGetWxParent(), - bbtk::std2wx ( bbGetInputIn() ) , - bbtk::std2wx ( bbGetInputTitle() ) ) ); + ( (wxWindow*) new InputTextWidget(this, //bbGetWxParent(), + parent, + bbtk::std2wx ( bbGetInputIn() ) , + bbtk::std2wx ( bbGetInputTitle() ) ) ); } diff --git a/packages/wx/src/bbwxInputText.h b/packages/wx/src/bbwxInputText.h index f71adf1..05a330a 100644 --- a/packages/wx/src/bbwxInputText.h +++ b/packages/wx/src/bbwxInputText.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbwxInputText.h,v $ Language: C++ - Date: $Date: 2008/10/17 08:18:32 $ - Version: $Revision: 1.4 $ + Date: $Date: 2008/11/24 15:45:51 $ + Version: $Revision: 1.5 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -100,7 +100,7 @@ namespace bbwx BBTK_PROCESS(Process); void Process(); BBTK_CREATE_WIDGET(CreateWidget); - void CreateWidget(); + void CreateWidget(wxWindow*); protected: virtual void bbUserConstructor(); diff --git a/packages/wx/src/bbwxLayoutLine.cxx b/packages/wx/src/bbwxLayoutLine.cxx index 55be896..22739ba 100644 --- a/packages/wx/src/bbwxLayoutLine.cxx +++ b/packages/wx/src/bbwxLayoutLine.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbwxLayoutLine.cxx,v $ Language: C++ - Date: $Date: 2008/11/13 14:46:46 $ - Version: $Revision: 1.6 $ + Date: $Date: 2008/11/24 15:45:51 $ + Version: $Revision: 1.7 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -65,6 +65,8 @@ namespace bbwx { } + +/* void LayoutLine::TryInsertWindow(wxWindow *parent, wxWindow *w,wxBoxSizer *sizer) { if (w!=NULL) @@ -73,11 +75,13 @@ namespace bbwx sizer->Add(w, 1, wxEXPAND, 0); } } - - void LayoutLine::CreateWidget() + */ + + void LayoutLine::CreateWidget(wxWindow* parent) { wxBoxSizer *sizer; - wxPanel *w=new wxPanel(bbGetWxParent(), -1); + wxPanel *w=new wxPanel(parent, //bbGetWxParent(), + -1); w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) ); int style=0; @@ -89,7 +93,18 @@ namespace bbwx { style=wxVERTICAL; } sizer = new wxBoxSizer(style); - + + wxWindow* cw; + if ((cw=bbCreateWidgetOfInput("Widget1",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0); + if ((cw=bbCreateWidgetOfInput("Widget2",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0); + if ((cw=bbCreateWidgetOfInput("Widget3",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0); + if ((cw=bbCreateWidgetOfInput("Widget4",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0); + if ((cw=bbCreateWidgetOfInput("Widget5",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0); + if ((cw=bbCreateWidgetOfInput("Widget6",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0); + if ((cw=bbCreateWidgetOfInput("Widget7",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0); + if ((cw=bbCreateWidgetOfInput("Widget8",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0); + if ((cw=bbCreateWidgetOfInput("Widget9",w)) != 0) sizer->Add(cw, 1, wxEXPAND, 0); + /* TryInsertWindow(w,bbGetInputWidget1(),sizer); TryInsertWindow(w,bbGetInputWidget2(),sizer); TryInsertWindow(w,bbGetInputWidget3(),sizer); @@ -99,7 +114,7 @@ namespace bbwx TryInsertWindow(w,bbGetInputWidget7(),sizer); TryInsertWindow(w,bbGetInputWidget8(),sizer); TryInsertWindow(w,bbGetInputWidget9(),sizer); - + */ w -> SetSizer(sizer); bbSetOutputWidget( w ); } diff --git a/packages/wx/src/bbwxLayoutLine.h b/packages/wx/src/bbwxLayoutLine.h index 50ee0c0..e58b2c7 100644 --- a/packages/wx/src/bbwxLayoutLine.h +++ b/packages/wx/src/bbwxLayoutLine.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbwxLayoutLine.h,v $ Language: C++ - Date: $Date: 2008/11/13 14:46:46 $ - Version: $Revision: 1.6 $ + Date: $Date: 2008/11/24 15:45:51 $ + Version: $Revision: 1.7 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -80,7 +80,7 @@ namespace bbwx BBTK_ON_SHOW_WIDGET(OnShowWidget); void Process(); - void CreateWidget(); + void CreateWidget(wxWindow*); void OnShowWidget(); protected: diff --git a/packages/wx/src/bbwxLayoutSplit.cxx b/packages/wx/src/bbwxLayoutSplit.cxx index 939355f..c5d6cf9 100644 --- a/packages/wx/src/bbwxLayoutSplit.cxx +++ b/packages/wx/src/bbwxLayoutSplit.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbwxLayoutSplit.cxx,v $ Language: C++ - Date: $Date: 2008/11/13 14:46:46 $ - Version: $Revision: 1.7 $ + Date: $Date: 2008/11/24 15:45:51 $ + Version: $Revision: 1.8 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -58,9 +58,9 @@ namespace bbwx { } - void LayoutSplit::CreateWidget() + void LayoutSplit::CreateWidget(wxWindow* parent) { - wxSplitterWindow* w = new wxSplitterWindow(bbGetWxParent(), + wxSplitterWindow* w = new wxSplitterWindow(parent, //bbGetWxParent(), -1, wxDefaultPosition, wxDefaultSize, @@ -68,20 +68,29 @@ namespace bbwx wxSP_3D | wxSP_LIVE_UPDATE ); w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) ); - wxWindow* w1 = bbGetInputWidget1(); +/* + wxWindow* w1 = bbGetInputWidget1(); wxWindow* w2 = bbGetInputWidget2(); if (w1==NULL) { w1=new wxPanel(bbGetWxParent()); } if (w2==NULL) { w2=new wxPanel(bbGetWxParent()); } w1->Reparent(w); w2->Reparent(w); - int orientation=0; + */ + + wxWindow* w1 = bbCreateWidgetOfInput("Widget1",w); + wxWindow* w2 = bbCreateWidgetOfInput("Widget2",w); + if (w1==NULL) { w1=new wxPanel(parent); } + if (w2==NULL) { w2=new wxPanel(parent); } + + 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==1) { w->SplitHorizontally( w1, w2, 100); } + + if (orientation==1) { w->SplitHorizontally( w1, w2, 100); } else { w->SplitVertically( w1, w2, 100); } - + bbSetOutputWidget( w ); } diff --git a/packages/wx/src/bbwxLayoutSplit.h b/packages/wx/src/bbwxLayoutSplit.h index 0db41d3..2b549b5 100644 --- a/packages/wx/src/bbwxLayoutSplit.h +++ b/packages/wx/src/bbwxLayoutSplit.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbwxLayoutSplit.h,v $ Language: C++ - Date: $Date: 2008/11/13 14:46:46 $ - Version: $Revision: 1.6 $ + Date: $Date: 2008/11/24 15:45:51 $ + Version: $Revision: 1.7 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -71,7 +71,7 @@ namespace bbwx BBTK_ON_SHOW_WIDGET(OnShowWidget); void Process(); - void CreateWidget(); + void CreateWidget(wxWindow*); void OnShowWidget(); protected: diff --git a/packages/wx/src/bbwxLayoutTab.cxx b/packages/wx/src/bbwxLayoutTab.cxx index 71db4f9..3bdfda9 100644 --- a/packages/wx/src/bbwxLayoutTab.cxx +++ b/packages/wx/src/bbwxLayoutTab.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbwxLayoutTab.cxx,v $ Language: C++ - Date: $Date: 2008/11/13 14:46:46 $ - Version: $Revision: 1.6 $ + Date: $Date: 2008/11/24 15:45:51 $ + Version: $Revision: 1.7 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -64,7 +64,7 @@ namespace bbwx bbSetInputWidget8(NULL); bbSetInputWidget9(NULL); } - +/* void LayoutTab::TryInsertWindow(wxNotebook *book, wxWindow *widgetchild ) { if (widgetchild!=NULL) @@ -74,23 +74,24 @@ namespace bbwx widgetchild->Show(); } } - +*/ void LayoutTab::Process() { } - void LayoutTab::CreateWidget() + void LayoutTab::CreateWidget(wxWindow* parent) { long style = wxNB_TOP; if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|T|TOP")==true) { style=wxNB_TOP; } if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|R|RIGHT")==true) { style=wxNB_RIGHT; } if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"2|B|BOTTOM")==true) { style=wxNB_BOTTOM; } if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"3|L|LEFT")==true) { style=wxNB_LEFT; } - wxNotebook *w = new wxNotebook(bbGetWxParent(), -1, wxDefaultPosition,wxDefaultSize,style ); + wxNotebook *w = new wxNotebook(parent, //bbGetWxParent(), + -1, wxDefaultPosition,wxDefaultSize,style ); w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) ); - + /* TryInsertWindow(w,bbGetInputWidget1()); TryInsertWindow(w,bbGetInputWidget2()); TryInsertWindow(w,bbGetInputWidget3()); @@ -100,7 +101,7 @@ namespace bbwx TryInsertWindow(w,bbGetInputWidget7()); TryInsertWindow(w,bbGetInputWidget8()); TryInsertWindow(w,bbGetInputWidget9()); - +*/ bbSetOutputWidget( w ); } diff --git a/packages/wx/src/bbwxLayoutTab.h b/packages/wx/src/bbwxLayoutTab.h index 1f76929..6d97368 100644 --- a/packages/wx/src/bbwxLayoutTab.h +++ b/packages/wx/src/bbwxLayoutTab.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbwxLayoutTab.h,v $ Language: C++ - Date: $Date: 2008/11/13 14:46:46 $ - Version: $Revision: 1.7 $ + Date: $Date: 2008/11/24 15:45:51 $ + Version: $Revision: 1.8 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -80,7 +80,7 @@ namespace bbwx BBTK_ON_SHOW_WIDGET(OnShowWidget); void Process(); - void CreateWidget(); + void CreateWidget(wxWindow*); void OnShowWidget(); protected: diff --git a/packages/wx/src/bbwxOutputText.xml b/packages/wx/src/bbwxOutputText.xml index 7b8af12..c6746aa 100644 --- a/packages/wx/src/bbwxOutputText.xml +++ b/packages/wx/src/bbwxOutputText.xml @@ -10,26 +10,31 @@
-   bbSetOutputWidget( new wxStaticText ( bbGetWxParent() , -1 , _T("") ) );
+   bbSetOutputWidget( new wxStaticText ( parent, /*bbGetWxParent(),*/  -1 , _T("") ) );
    Process();
   
-   std::string msg;
-    if (bbGetInputTitle()!="")
-      {
-	msg = bbGetInputTitle()+": " + bbGetInputIn();
-      }  
-    else 
-      {
-	msg = bbGetInputIn();
-      }
-   ((wxStaticText*)bbGetOutputWidget())->SetLabel( bbtk::std2wx( msg ) ); 
+	wxStaticText* w = (wxStaticText*)bbGetOutputWidget();
+	if (w) 
+	{
+		std::string msg;
+		if (bbGetInputTitle()!="")
+		{
+			msg = bbGetInputTitle()+": " + bbGetInputIn();
+		}  
+		else 
+		{
+			msg = bbGetInputIn();
+		}
+		w->SetLabel( bbtk::std2wx( msg ) ); 
+	}
   
 
     bbSetInputIn("");
     bbSetInputTitle("");
+	bbSetOutputWidget(0);
   
diff --git a/packages/wx/src/bbwxRadioButton.cxx b/packages/wx/src/bbwxRadioButton.cxx index ae79162..6975509 100644 --- a/packages/wx/src/bbwxRadioButton.cxx +++ b/packages/wx/src/bbwxRadioButton.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbwxRadioButton.cxx,v $ Language: C++ - Date: $Date: 2008/10/17 08:18:32 $ - Version: $Revision: 1.6 $ + Date: $Date: 2008/11/24 15:45:51 $ + Version: $Revision: 1.7 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -183,7 +183,7 @@ namespace bbwx * * */ - void RadioButton::CreateWidget() + void RadioButton::CreateWidget(wxWindow* parent) { std::vector lstIn; @@ -200,7 +200,8 @@ namespace bbwx RadioButtonWidget *w = new RadioButtonWidget( this, - bbGetWxParent(), +// bbGetWxParent(), + parent, bbGetInputIn() , bbtk::std2wx(bbGetInputTitle()), lstIn ); diff --git a/packages/wx/src/bbwxRadioButton.h b/packages/wx/src/bbwxRadioButton.h index 8889dc0..79bcb63 100644 --- a/packages/wx/src/bbwxRadioButton.h +++ b/packages/wx/src/bbwxRadioButton.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbwxRadioButton.h,v $ Language: C++ - Date: $Date: 2008/10/17 08:18:32 $ - Version: $Revision: 1.5 $ + Date: $Date: 2008/11/24 15:45:51 $ + Version: $Revision: 1.6 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -111,7 +111,7 @@ namespace bbwx BBTK_CREATE_WIDGET(CreateWidget); BBTK_PROCESS(Process); void Process(); - void CreateWidget(); + void CreateWidget(wxWindow*); protected: virtual void bbUserConstructor(); diff --git a/packages/wx/src/bbwxSlider.cxx b/packages/wx/src/bbwxSlider.cxx index 0636b5e..49d0595 100644 --- a/packages/wx/src/bbwxSlider.cxx +++ b/packages/wx/src/bbwxSlider.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbwxSlider.cxx,v $ Language: C++ - Date: $Date: 2008/10/17 08:18:32 $ - Version: $Revision: 1.14 $ + Date: $Date: 2008/11/24 15:45:51 $ + Version: $Revision: 1.15 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -368,7 +368,7 @@ namespace bbwx bbSetOutputOut( bbGetInputIn() ); } - void Slider::CreateWidget() + void Slider::CreateWidget(wxWindow* parent) { int orientation=0; @@ -378,7 +378,7 @@ namespace bbwx // std::cout << "bbGetWxParent = "<UpdateView(); - bbSetOutputOut( bbGetInputSlice() ); - bbSetOutputRenderer( ((Viewer2DWidget*)bbGetOutputWidget())->GetRenderer() ); - + Viewer2DWidget* w = (Viewer2DWidget*)bbGetOutputWidget(); + if (w) + { + w->UpdateView(); + bbSetOutputRenderer( ((Viewer2DWidget*)bbGetOutputWidget())->GetRenderer() ); + } + bbSetOutputOut( bbGetInputSlice() ); + } @@ -272,6 +275,7 @@ namespace bbwxvtk { bbSetInputIn(NULL); bbSetInputSlice(0); + bbSetOutputWidget(0); bbSetInputOrientation(0); } @@ -280,11 +284,11 @@ namespace bbwxvtk * * */ - void Viewer2D::CreateWidget() + void Viewer2D::CreateWidget(wxWindow* parent) { bbtkDebugMessageInc("Core",9,"Viewer2D::CreateWidget()"<Update(); diff --git a/packages/wxvtk/src/bbwxvtkViewer3D.h b/packages/wxvtk/src/bbwxvtkViewer3D.h index a493efb..cb5e5b9 100644 --- a/packages/wxvtk/src/bbwxvtkViewer3D.h +++ b/packages/wxvtk/src/bbwxvtkViewer3D.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbwxvtkViewer3D.h,v $ Language: C++ - Date: $Date: 2008/11/13 14:46:48 $ - Version: $Revision: 1.10 $ + Date: $Date: 2008/11/24 15:45:54 $ + Version: $Revision: 1.11 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -95,7 +95,7 @@ namespace bbwxvtk BBTK_ON_SHOW_WIDGET(OnShowWidget); void Process(); - void CreateWidget(); + void CreateWidget(wxWindow*); void OnShowWidget(); protected: