# DOES THE USER WANT TO BUILD THE PACKAGE ?
OPTION(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME}
"Build the bbtk package ${BBTK_PACKAGE_NAME} ?" OFF)
-SWITCH_ON_IF_BUILD_ALL(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
+IF(NOT ${BBTK_PACKAGE_NAME}_EXCLUDE_FROM_BUILD_ALL)
+ SWITCH_ON_IF_BUILD_ALL(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME})
+ENDIF(NOT ${BBTK_PACKAGE_NAME}_EXCLUDE_FROM_BUILD_ALL)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
SUBDIRS(wx)
SUBDIRS(itk)
SUBDIRS(vtk)
-SUBDIRS(util)
+SUBDIRS(bbtkTools)
+SUBDIRS(test)
#-----------------------------------------------------------------------------
author "laurent.guigues at creatis.insa-lyon.fr"
category "example"
-include util
+include vtk/boxes/bbLoadHola
new LoadHola loader
print "Path to the 'hola' image = '$loader.FileName$'"
print "Image loaded = $loader.Out$"
--- /dev/null
+/*=========================================================================
+
+ Program: bbtk
+ Module: $RCSfile: bbwxCommandButton.cxx,v $
+ Language: C++
+ Date: $Date: 2008/02/15 12:47:17 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+/**
+ * \file
+ * \brief
+ */
+
+
+#ifdef _USE_WXWIDGETS_
+
+
+#include "bbwxCommandButton.h"
+#include "bbwxPackage.h"
+#include "bbtkInterpreter.h"
+
+
+
+namespace bbwx
+{
+ BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,CommandButton);
+
+ CommandButtonWidget::CommandButtonWidget(CommandButton* box,
+ wxWindow *parent,
+ wxString title )
+ : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
+ mBox(box)
+ {
+
+ wxPanel *panel = this;
+
+ mwxCommandButton = new wxButton( panel, -1, title);
+ Connect( mwxCommandButton->GetId(), wxEVT_COMMAND_BUTTON_CLICKED ,
+ (wxObjectEventFunction)
+ (void (wxPanel::*)(wxEvent&))
+ &CommandButtonWidget::OnCommandButton );
+
+ wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
+ sizer -> Add( mwxCommandButton,1,wxGROW );
+ sizer -> AddGrowableCol(0);
+
+ panel -> SetSizer(sizer);
+ panel -> SetAutoLayout(true);
+ panel -> Layout();
+
+ }
+
+ CommandButtonWidget::~CommandButtonWidget()
+ {
+ }
+
+
+ void CommandButtonWidget::OnCommandButton( wxEvent& )
+ {
+ std::string commandstr(mBox->bbGetInputIn());
+
+ // bbtk::Interpreter::mGlobalInterpreter->InterpretLine( commandstr );
+ int i;
+ bool ok=true;
+ int pos1=0,pos2;
+ pos2 = commandstr.find(";",pos1);
+ std::string ccommand;
+ while (ok==true)
+ {
+ if (pos2==-1)
+ {
+ ok=false;
+ ccommand=commandstr.substr(pos1,commandstr.length()-pos1 );
+ }
+ else
+ {
+ ccommand=commandstr.substr(pos1,pos2-pos1);
+ }
+ for ( i=0 ; i < ccommand.length() ; i++)
+ {
+ if (ccommand[i]==39)
+ {
+ ccommand[i]=34;
+ }
+ }
+ bool insideComment = false; // for multiline comment
+ bbtk::Interpreter::mGlobalInterpreter->InterpretLine( ccommand, insideComment );
+ pos1=pos2+1;
+ pos2 = commandstr.find(";",pos2+1);
+
+ }
+
+ mBox->UpdateLabel();
+ mBox->UpdateColour();
+ mBox->bbSignalOutputModification();
+ }
+
+
+ //--------------------------------------------------------------------------
+
+ void CommandButtonWidget::SetLabel(wxString title)
+ {
+ mwxCommandButton->SetLabel(title);
+ }
+ //--------------------------------------------------------------------------
+
+ void CommandButtonWidget::SetColour(wxColour color)
+ {
+ mwxCommandButton->SetBackgroundColour(color);
+ }
+
+
+
+ //--------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ //--------------------------------------------------------------------------
+ //--------------------------------------------------------------------------
+
+
+ BBTK_USER_BLACK_BOX_IMPLEMENTATION(CommandButton,bbtk::WxBlackBox);
+
+ void CommandButton::bbUserConstructor()
+ {
+ bbSetInputIn("");
+ bbSetInputLabel("");
+ std::vector<double> lstColour;
+ lstColour.push_back(-1);
+ lstColour.push_back(-1);
+ lstColour.push_back(-1);
+ bbSetInputColour(lstColour);
+ }
+
+
+ void CommandButton::Process()
+ {
+ UpdateColour();
+ UpdateLabel();
+ }
+
+ void CommandButton::UpdateColour()
+ {
+ CommandButtonWidget* wxwidget = (CommandButtonWidget*)bbGetOutputWidget();
+ if ( (bbGetInputColour()[0]==-1) &&
+ (bbGetInputColour()[1]==-1) &&
+ (bbGetInputColour()[2]==-1) )
+ {
+ wxwidget->SetColour( wxwidget->GetParent()->GetBackgroundColour() );
+ }
+ else
+ {
+ int r=(int) (255*bbGetInputColour()[0]);
+ int g=(int) (255*bbGetInputColour()[1]);
+ int b=(int) (255*bbGetInputColour()[2]);
+ wxwidget->SetColour( wxColour(r,g,b) );
+ }
+
+ }
+ void CommandButton::UpdateLabel()
+ {
+ CommandButtonWidget* wxwidget = (CommandButtonWidget*)bbGetOutputWidget();
+ wxwidget->SetLabel( bbtk::std2wx( bbGetInputLabel() ) );
+ }
+
+ /**
+ * \brief Create wxWidget .
+ *
+ *
+ */
+ void CommandButton::CreateWidget()
+ {
+ bbSetOutputWidget
+ ( new CommandButtonWidget ( this, bbGetWxParent(),
+ bbtk::std2wx(bbGetInputLabel()) ) );
+ UpdateColour();
+ }
+
+
+} //namespace bbwx
+
+#endif // _USE_WXWIDGETS_
+
--- /dev/null
+/*=========================================================================
+
+ Program: bbtk
+ Module: $RCSfile: bbwxCommandButton.h,v $
+ Language: C++
+ Date: $Date: 2008/02/15 12:47:18 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*//**
+ * \brief Short description in one line
+ *
+ * Long description which
+ * can span multiple lines
+ */
+/**
+ * \file
+ * \brief Pattern for the definition of a new type of Node (header)
+ */
+/**
+ * \class bbtk::NodePatern
+ * \brief Pattern for the definition of a new type of Node
+ */
+
+
+#ifdef _USE_WXWIDGETS_
+
+#ifndef __bbwxCommandButton_h_INCLUDED_H__
+#define __bbwxCommandButton_h_INCLUDED_H__
+
+
+#include "bbtkWxBlackBox.h"
+
+
+
+namespace bbwx
+{
+ class CommandButton;
+
+ //--------------------------------------------------------------------------
+ class CommandButtonWidget : public wxPanel
+ {
+ public:
+ CommandButtonWidget(CommandButton* box, wxWindow *parent,
+ wxString title);
+ ~CommandButtonWidget();
+ void OnCommandButton( wxEvent& );
+ void SetLabel(wxString title);
+ void SetColour(wxColour color);
+
+ private:
+ CommandButton* mBox;
+ wxButton *mwxCommandButton;
+ };
+
+ //--------------------------------------------------------------------------
+ //--------------------------------------------------------------------------
+ //--------------------------------------------------------------------------
+
+ class /*BBTK_EXPORT*/ CommandButton : public bbtk::WxBlackBox
+ {
+ friend class CommandButtonWidget;
+ BBTK_USER_BLACK_BOX_INTERFACE(CommandButton,bbtk::WxBlackBox);
+ BBTK_DECLARE_INPUT(In, std::string );
+ BBTK_DECLARE_INPUT(Label, std::string );
+ BBTK_DECLARE_INPUT(Colour, std::vector<double> );
+ // BBTK_DECLARE_OUTPUT(Out,int);
+ BBTK_PROCESS(Process);
+ void Process();
+ BBTK_CREATE_WIDGET(CreateWidget);
+ void CreateWidget();
+ protected:
+ virtual void bbUserConstructor();
+
+
+ private:
+ void UpdateColour();
+ void UpdateLabel();
+ };
+
+ //=================================================================
+ // UserBlackBox description
+ BBTK_BEGIN_DESCRIBE_BLACK_BOX(CommandButton,bbtk::WxBlackBox);
+ BBTK_NAME("CommandButton");
+ BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
+ BBTK_DESCRIPTION("Button which executes bbi commands");
+
+ typedef std::vector<double> vectorcolour;
+
+ BBTK_INPUT(CommandButton,In,"Commands to be executed separated by commas (;). Each single quote (') is replaced by a double quote (\").",std::string);
+ BBTK_INPUT(CommandButton,Label,"Label of the button",std::string);
+ BBTK_INPUT(CommandButton,Colour,"Colour of the button (-1 -1 -1 Background)",vectorcolour);
+ // BBTK_OUTPUT(CommandButton,Out,"..Out..",int);
+ BBTK_END_DESCRIBE_BLACK_BOX(CommandButton);
+ //=================================================================
+
+
+}//namespace bbwx
+
+#endif // __bbwxCommandButton_h_INCLUDED_H__
+
+#endif //_USE_WXWIDGETS_
--- /dev/null
+/*=========================================================================
+
+ Program: bbtk
+ Module: $RCSfile: bbwxDirectorySelector.cxx,v $
+ Language: C++
+ Date: $Date: 2008/02/15 12:47:18 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+/**
+ * \file
+ * \brief
+ */
+
+
+#ifdef _USE_WXWIDGETS_
+
+
+#include "bbwxDirectorySelector.h"
+#include "bbwxPackage.h"
+
+#include <wx/filedlg.h>
+
+
+namespace bbwx
+{
+
+ BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,DirectorySelector);
+
+
+ BBTK_USER_BLACK_BOX_IMPLEMENTATION(DirectorySelector,bbtk::AtomicBlackBox);
+
+
+ void DirectorySelector::Process()
+ {
+ bbtkDebugMessageInc("Core",9,"DirectorySelector::Process() ["
+ <<bbGetFullName()<<"]"<<std::endl);
+
+ wxFileDialog* FD =
+ new wxFileDialog( 0,
+ bbtk::std2wx(bbGetInputMessage()),
+ bbtk::std2wx(bbGetInputDefaultDir()));
+
+ FD->ShowModal();
+
+ if (FD->GetReturnCode()==wxID_OK)
+ {
+ bbSetOutputOut( bbtk::wx2std (FD->GetPath()) );
+ bbSetInputDefaultDir( bbtk::wx2std (FD->GetPath()) );
+ }
+ else
+ {
+ bbSetOutputOut("");
+ bbSetInputDefaultDir("");
+ }
+
+ bbtkDebugDecTab("Core",9);
+ }
+
+
+
+}//namespace bbtk
+
+#endif // _USE_WXWIDGETS_
+
--- /dev/null
+/*=========================================================================
+
+ Program: bbtk
+ Module: $RCSfile: bbwxDirectorySelector.h,v $
+ Language: C++
+ Date: $Date: 2008/02/15 12:47:18 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*//**
+ * \brief Short description in one line
+ *
+ * Long description which
+ * can span multiple lines
+ */
+/**
+ * \file
+ * \brief Pattern for the definition of a new type of Node (header)
+ */
+/**
+ * \class bbtk::NodePatern
+ * \brief Pattern for the definition of a new type of Node
+ */
+
+
+#ifdef _USE_WXWIDGETS_
+
+
+#ifndef __bbWxDirectorySelector_h__
+#define __bbWxDirectorySelector_h__
+
+#include "bbtkAtomicBlackBox.h"
+
+
+
+namespace bbwx
+{
+
+
+
+
+ //=================================================================
+ class /*BBTK_EXPORT*/ DirectorySelector : public bbtk::AtomicBlackBox
+ {
+ BBTK_USER_BLACK_BOX_INTERFACE(DirectorySelector,bbtk::AtomicBlackBox);
+ BBTK_DECLARE_INPUT(Title,std::string);
+ BBTK_DECLARE_INPUT(Message,std::string);
+ BBTK_DECLARE_INPUT(DefaultDir,std::string);
+ BBTK_DECLARE_INPUT(DefaultDirectory,std::string);
+ BBTK_DECLARE_INPUT(Wildcard,std::string);
+ BBTK_DECLARE_INPUT(OpenSave,std::string);
+ BBTK_DECLARE_OUTPUT(Out,std::string);
+ BBTK_PROCESS(Process);
+ void Process();
+ };
+ //=================================================================
+
+
+ //=================================================================
+ // AtomicBlackBox description
+ BBTK_BEGIN_DESCRIBE_BLACK_BOX(DirectorySelector,bbtk::AtomicBlackBox);
+ BBTK_NAME("DirectorySelector");
+ BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
+ BBTK_CATEGORY("widget");
+ BBTK_DESCRIPTION("Pops up a directory selection dialog (wxDirDialog)");
+ BBTK_INPUT(DirectorySelector,Title,"Title of the dialog",std::string);
+ BBTK_INPUT(DirectorySelector,Message,"Message to show on the dialog",std::string);
+ BBTK_INPUT(DirectorySelector,DefaultDir,"The default directory",std::string);
+ BBTK_OUTPUT(DirectorySelector,Out,"The directory selected by the user",std::string);
+ BBTK_END_DESCRIBE_BLACK_BOX(DirectorySelector);
+ //=================================================================
+
+
+
+}
+
+
+
+//namespace bbtk
+#endif //__bbtkWxDirectorySelector_h__
+
+#endif //_USE_WXWIDGETS_
--- /dev/null
+/*=========================================================================
+
+ Program: bbtk
+ Module: $RCSfile: bbwxFileSelector.cxx,v $
+ Language: C++
+ Date: $Date: 2008/02/15 12:47:18 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+/**
+ * \file
+ * \brief
+ */
+
+
+#ifdef _USE_WXWIDGETS_
+
+
+#include "bbwxFileSelector.h"
+#include "bbwxPackage.h"
+
+#include <wx/filedlg.h>
+
+
+namespace bbwx
+{
+
+ BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,FileSelector);
+
+
+ BBTK_USER_BLACK_BOX_IMPLEMENTATION(FileSelector,bbtk::AtomicBlackBox);
+
+
+ void FileSelector::Process()
+ {
+ bbtkDebugMessageInc("Core",9,"FileSelector::Process() ["
+ <<bbGetFullName()<<"]"<<std::endl);
+
+ long style;
+ if (bbGetInputOpenSave()=="Save")
+ {
+ style = wxSAVE | wxOVERWRITE_PROMPT;
+ }
+ else
+ {
+ style = wxOPEN | wxFILE_MUST_EXIST;
+ }
+
+ std::string wc(bbGetInputWildcard());
+ if (wc=="")
+ {
+ wc = "*.*";
+ }
+
+
+ wxFileDialog* FD = new wxFileDialog( 0,
+ bbtk::std2wx(bbGetInputMessage()),
+ bbtk::std2wx(bbGetInputDefaultDir()),
+ bbtk::std2wx(bbGetInputDefaultFile()),
+ bbtk::std2wx(wc),
+ style,
+ wxDefaultPosition);
+
+ FD->ShowModal();
+
+ if (FD->GetReturnCode()==wxID_OK)
+ {
+ bbSetOutputOut( bbtk::wx2std (FD->GetPath()) );
+ }
+ else
+ {
+ bbSetOutputOut("");
+ }
+
+ bbtkDebugDecTab("Core",9);
+ }
+
+
+
+}//namespace bbtk
+
+#endif // _USE_WXWIDGETS_
+
--- /dev/null
+/*=========================================================================
+
+ Program: bbtk
+ Module: $RCSfile: bbwxFileSelector.h,v $
+ Language: C++
+ Date: $Date: 2008/02/15 12:47:18 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*//**
+ * \brief Short description in one line
+ *
+ * Long description which
+ * can span multiple lines
+ */
+/**
+ * \file
+ * \brief Pattern for the definition of a new type of Node (header)
+ */
+/**
+ * \class bbtk::NodePatern
+ * \brief Pattern for the definition of a new type of Node
+ */
+
+
+#ifdef _USE_WXWIDGETS_
+
+
+#ifndef __bbWxFileSelector_h__
+#define __bbWxFileSelector_h__
+
+#include "bbtkAtomicBlackBox.h"
+
+
+
+namespace bbwx
+{
+
+
+
+
+ //=================================================================
+ class /*BBTK_EXPORT*/ FileSelector : public bbtk::AtomicBlackBox
+ {
+ BBTK_USER_BLACK_BOX_INTERFACE(FileSelector,bbtk::AtomicBlackBox);
+ BBTK_DECLARE_INPUT(Title,std::string);
+ BBTK_DECLARE_INPUT(Message,std::string);
+ BBTK_DECLARE_INPUT(DefaultDir,std::string);
+ BBTK_DECLARE_INPUT(DefaultFile,std::string);
+ BBTK_DECLARE_INPUT(Wildcard,std::string);
+ BBTK_DECLARE_INPUT(OpenSave,std::string);
+ BBTK_DECLARE_OUTPUT(Out,std::string);
+ BBTK_PROCESS(Process);
+ void Process();
+ };
+ //=================================================================
+
+
+ //=================================================================
+ // AtomicBlackBox description
+ BBTK_BEGIN_DESCRIBE_BLACK_BOX(FileSelector,bbtk::AtomicBlackBox);
+ BBTK_NAME("FileSelector");
+ BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
+ BBTK_CATEGORY("widget");
+ BBTK_DESCRIPTION("Pops up a file selection dialog for reading or saving (wxFileDialog)");
+ BBTK_INPUT(FileSelector,Title,"Title of the dialog",std::string);
+ BBTK_INPUT(FileSelector,Message,"Message to show on the dialog",std::string);
+ BBTK_INPUT(FileSelector,DefaultDir,"The default directory",std::string);
+ BBTK_INPUT(FileSelector,DefaultFile,"The default filename",std::string);
+ BBTK_INPUT(FileSelector,Wildcard,"A wildcard, such as \"*.*\" or \"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif\"",std::string);
+ BBTK_INPUT(FileSelector,OpenSave,"Open for an open dialog (default) / Save for a save dialog",std::string);
+ BBTK_OUTPUT(FileSelector,Out,"The file selected by the user",std::string);
+ BBTK_END_DESCRIBE_BLACK_BOX(FileSelector);
+ //=================================================================
+
+
+
+}
+
+
+
+//namespace bbtk
+#endif //__bbtkWxFileSelector_h__
+
+#endif //_USE_WXWIDGETS_
--- /dev/null
+/*=========================================================================
+
+ Program: bbtk
+ Module: $RCSfile: bbwxInputText.cxx,v $
+ Language: C++
+ Date: $Date: 2008/02/15 12:47:18 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+/**
+ * \file
+ * \brief
+ */
+
+
+#ifdef _USE_WXWIDGETS_
+
+
+#include "bbwxInputText.h"
+#include "bbwxPackage.h"
+//#include <wx/dialog.h>
+
+
+
+
+
+namespace bbwx
+{
+ BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,InputText);
+
+
+ InputTextWidget::InputTextWidget(InputText* box,
+ wxWindow *parent,
+ wxString In,
+ wxString title)
+ : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL),
+ mBox(box)
+ {
+ wxPanel *panel = this;
+
+ mwxTextCtrl = new wxTextCtrl( panel, -1, In,
+ wxDefaultPosition, wxSize(800,20));
+ Connect( mwxTextCtrl->GetId(), wxEVT_COMMAND_TEXT_UPDATED,
+ (wxObjectEventFunction)
+ (wxEventFunction)
+ (wxCommandEventFunction)
+ (void (wxPanel::*)(wxCommandEvent&))
+ &InputTextWidget::OnTextUpdate );
+
+
+ wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
+ /*
+ if (title!=_T(""))
+ {
+ */
+ mwxTitle = new wxStaticText(panel,-1, title );
+ sizer -> Add( mwxTitle );
+ // }
+ sizer -> Add( mwxTextCtrl,1,wxGROW );
+ sizer -> AddGrowableCol(0);
+
+ panel -> SetSizer(sizer);
+ panel -> SetAutoLayout(true);
+ panel -> Layout();
+
+ }
+ //-------------------------------------------------------------------------
+
+ InputTextWidget::~InputTextWidget()
+ {
+ }
+
+ //-------------------------------------------------------------------------
+
+
+ void InputTextWidget::SetTitle(wxString s)
+ {
+ mwxTitle->SetLabel(s);
+ }
+
+ //-------------------------------------------------------------------------
+ std::string InputTextWidget::GetValue()
+ {
+ return bbtk::wx2std ( mwxTextCtrl->GetValue() );
+ }
+
+ //--------------------------------------------------------------------------
+ void InputTextWidget::OnTextUpdate(wxCommandEvent& event)
+ {
+ mBox->bbSetOutputOut( GetValue() );
+ mBox->bbSetInputIn( GetValue() );
+ mBox->bbSignalOutputModification("Out");
+ }
+
+ //--------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ //--------------------------------------------------------------------------
+ //--------------------------------------------------------------------------
+
+
+ BBTK_USER_BLACK_BOX_IMPLEMENTATION(InputText,bbtk::WxBlackBox);
+
+
+
+ void InputText::bbUserConstructor()
+ {
+ bbSetInputTitle("");
+ bbSetInputIn("");
+ }
+
+
+ void InputText::Process()
+ {
+ InputTextWidget *w=(InputTextWidget *)bbGetOutputWidget();
+ bbSetInputIn( w->GetValue() );
+ bbSetOutputOut( w->GetValue() );
+ w->SetTitle( bbtk::std2wx ( bbGetInputTitle() ) );
+ }
+
+
+
+ void InputText::CreateWidget()
+ {
+ bbSetOutputWidget
+ ( (wxWindow*) new InputTextWidget(this, bbGetWxParent(),
+ bbtk::std2wx ( bbGetInputIn() ) ,
+ bbtk::std2wx ( bbGetInputTitle() ) ) );
+
+ }
+
+
+
+
+}//namespace bbtk
+
+#endif // _USE_WXWIDGETS_
+
--- /dev/null
+/*=========================================================================
+
+ Program: bbtk
+ Module: $RCSfile: bbwxInputText.h,v $
+ Language: C++
+ Date: $Date: 2008/02/15 12:47:18 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*//**
+ * \brief Short description in one line
+ *
+ * Long description which
+ * can span multiple lines
+ */
+/**
+ * \file
+ * \brief Pattern for the definition of a new type of Node (header)
+ */
+/**
+ * \class bbtk::NodePatern
+ * \brief Pattern for the definition of a new type of Node
+ */
+
+
+#ifdef _USE_WXWIDGETS_
+
+
+#ifndef __bbWxInputText_h__
+#define __bbWxInputText_h__
+
+#include "bbtkWxBlackBox.h"
+
+
+
+namespace bbwx
+{
+
+
+
+
+ class InputText;
+
+ //--------------------------------------------------------------------------
+ class InputTextWidget : wxPanel
+ {
+ public:
+ InputTextWidget(InputText* box, wxWindow *parent,
+ wxString In, wxString title);
+ ~InputTextWidget();
+
+ std::string GetValue();
+ void OnTextUpdate(wxCommandEvent& event);
+
+ void SetTitle(wxString);
+
+ private:
+ InputText *mBox;
+ wxTextCtrl *mwxTextCtrl;
+ wxStaticText *mwxTitle;
+ };
+
+ //------------------------------------------------------------------------
+ //------------------------------------------------------------------------
+ //------------------------------------------------------------------------
+
+
+
+
+
+ class /*BBTK_EXPORT*/ InputText : public bbtk::WxBlackBox
+ {
+
+ BBTK_USER_BLACK_BOX_INTERFACE(InputText,bbtk::WxBlackBox);
+ BBTK_DECLARE_INPUT(In,std::string);
+ BBTK_DECLARE_INPUT(Title,std::string);
+ BBTK_DECLARE_OUTPUT(Out,std::string);
+ BBTK_PROCESS(Process);
+ void Process();
+ BBTK_CREATE_WIDGET(CreateWidget);
+ void CreateWidget();
+
+ protected:
+ virtual void bbUserConstructor();
+ };
+
+
+ //=================================================================
+ // UserBlackBox description
+ BBTK_BEGIN_DESCRIBE_BLACK_BOX(InputText,bbtk::WxBlackBox);
+ BBTK_NAME("InputText");
+ BBTK_AUTHOR("laurent guigues at creatis.insa-lyon.fr");
+ BBTK_DESCRIPTION("A zone in which the user can enter a text (wxTextCtrl)");
+ BBTK_INPUT(InputText,In,"Initial text (default '')",std::string);
+
+ BBTK_INPUT(InputText,Title,"Title of the input zone (default '') ",std::string);
+
+ BBTK_OUTPUT(InputText,Out,"Current text",std::string);
+ BBTK_END_DESCRIBE_BLACK_BOX(InputText);
+ //=================================================================
+
+
+
+}
+
+
+
+//namespace bbtk
+#endif //__bbWxInputText_h__
+
+#endif //_USE_WXWIDGETS_
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<blackbox name="OutputText" widget>
+
+ <author>laurent.guigues at creatis.insa-lyon.fr</author>
+ <description>Text zone to be inserted into a window (wxStaticText)</description>
+ <category></category>
+
+ <input name="Title" type="std::string" description="Title prepended to the text"/>
+ <input name="In" type="std::string" description="Text"/>
+
+ <createwidget><PRE>
+ bbSetOutputWidget( new wxStaticText ( bbGetWxParent() , -1 , _T("") ) );
+ Process();
+ </PRE></createwidget>
+
+ <process><PRE>
+ std::string msg;
+ if (bbGetInputTitle()!="")
+ {
+ msg = bbGetInputTitle()+": " + bbGetInputIn();
+ }
+ else
+ {
+ msg = bbGetInputIn();
+ }
+ ((wxStaticText*)bbGetOutputWidget())->SetLabel( bbtk::std2wx( msg ) );
+ </PRE></process>
+
+ <constructor><PRE>
+ bbSetInputIn("");
+ bbSetInputTitle("");
+ </PRE></constructor>
+
+
+</blackbox>
+