#-----------------------------------------------------------------------------
# The samples
+
+#----JFGA ---- Por default.
+SET(USE_WT OFF)
+
+
# WARNING
# Install the creaTools first
# then build the 'samples' as a separate project
ADD_CUSTOM_COMMAND(
OUTPUT ${BBFY_CXX_OUT}
COMMAND
- export LD_LIBRARY_PATH=${LD_LIBRARY_PATH} && ${BBTK_BBFY} ${xmlfile} ${BBTK_PACKAGE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/ -q
+ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH} && echo $ENV{LD_LIBRARY_PATH} && ${BBTK_BBFY} ${xmlfile} ${BBTK_PACKAGE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/ -q
DEPENDS ${xmlfile}
${BBTK_BBFY_DEPENDENCY}
)
)
SET(SOURCES ${SOURCES} ${MOC_SOURCES} ${UI_SOURCES})
ENDIF(QT_FOUND)
+
+# JFGA 03/12/2014 -- Temporal configuration of WT
+# *********Missing if conditional Wt********
+ #find_package(Boost COMPONENTS system thread signals)
+ #find_library(wt wt)
+ #find_library(wthttp wthttp)
+ INCLUDE_DIRECTORIES(/usr/local/include/Wt)
+
+
ENDIF(BBTK_USE_QT)
#-----------------------------------------------------------------------------
# lib definition
ADD_LIBRARY(bbtk SHARED ${SOURCES} ${SOURCES_H})
#-----------------------------------------------------------------------------
-TARGET_LINK_LIBRARIES(bbtk ${BBTK_LINK_LIBRARIES} ${BOOST_LIBRARIES} ${crea_LIBRARIES})
+TARGET_LINK_LIBRARIES(bbtk ${BBTK_LINK_LIBRARIES} ${BOOST_LIBRARIES} ${crea_LIBRARIES} ${WT_LIBRARIES})
#-----------------------------------------------------------------------------
IF(UNIX)
SET_TARGET_PROPERTIES(bbtk PROPERTIES COMPILE_FLAGS -Wall)
#include "bbtkUtilities.h"
#include "bbtkAtomicBlackBoxDescriptor.h"
#include "bbtkWxBlackBox.h"
+// JFGA 12/12/2014 Adding libraries for Wt
+//#include "bbtkWtBlackBox.h"
namespace bbtk
{
std::string usercol("#FFFFFF");
std::string ubbcol("#DDFFFF");
std::string wxbbcol("#EEFFFF");
-
+// JFGA 12/12/2014 Adding new variable
+// std::string wtbbcol("#CCFFFF");
// (s) << "<h3 class=\"subsection\">Inputs</h3>\n";
(s) << "<p><TABLE border=1 cellspacing=0 cellpadding=3>\n";
( d->GetCreatorTypeInfo() == typeid(WxBlackBoxDescriptor)) )
continue;
#else
+// JFGA 12/12/2014 Adding WT options for compile with it.
+
+/*#if USE_WT
+
+ if ( ( d->GetCreatorTypeInfo() == typeid(AtomicBlackBoxDescriptor)) ||
+ ( d->GetCreatorTypeInfo() == typeid(WtBlackBoxDescriptor)) )
+ continue;
+
+
+#else
+*/
if ( ( d->GetCreatorTypeInfo() == typeid(AtomicBlackBoxDescriptor)) )
continue;
+//#endif
+
#endif
bool widok = true;
std::string widget,adaptor;
--- /dev/null
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ # pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ # This software is governed by the CeCILL-B license under French law and
+ # abiding by the rules of distribution of free software. You can use,
+ # modify and/ or redistribute the software under the terms of the CeCILL-B
+ # license as circulated by CEA, CNRS and INRIA at the following URL
+ # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ # or in the file LICENSE.txt.
+ #
+ # As a counterpart to the access to the source code and rights to copy,
+ # modify and redistribute granted by the license, users are provided only
+ # with a limited warranty and the software's author, the holder of the
+ # economic rights, and the successive licensors have only limited
+ # liability.
+ #
+ # The fact that you are presently reading this means that you have had
+ # knowledge of the CeCILL-B license and that you accept its
+ terms.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
+ Program: bbtk
+ Module: $RCSfile: bbtkQt.cxx,v $
+ Language: C++
+ Date: $Date: 2012/11/16 08:49:01 $
+ Version: $Revision: 1.4 $
+=========================================================================*/
+
+
+#include "bbtkWt.h"
+#include "bbtkMessageManager.h"
+
+#ifdef USE_WT
+
+
+
+
+namespace bbtk
+{
+ //=========================================================================
+ class WtApp;
+ Wt::WApplication *createApplication(const Wt::WEnvironment& env);
+ //=========================================================================
+
+ //=========================================================================
+ static WtApp* mgWtApp = 0;
+ static Wt::WContainerWidget* mgTopWindow = 0;
+ static int mgNbWindowsAlive = 0;
+ //=========================================================================
+
+ //=========================================================================
+ // BBTKWXSIG
+ static WWt::Signal_type mgWtSignal;
+ // \BBTKWXSIG
+ //=========================================================================
+
+
+ //=========================================================================
+ // The wxApp class which is used when no user wxApp was created
+ // The application creates itself completly empty.
+// The default values for the port and address are port:8080 address 0.0.0.0
+ class WtApp : public Wt::WApplication
+ {
+ public:
+ WtApp(const Wt::WEnvironment& env);
+ ~WtApp();
+ static int WtWRun();
+ //WtWApplication *createApplication(const WtWEnvironment& env);
+
+ };
+
+ WtApp::WtApp(const Wt::WEnvironment& env):
+ Wt::WApplication(env)
+ {
+ Wt::WApplication::root()->addWidget(WWt::GetTopWindow());
+ // There is not additional configuration. The new WtApp must have the same behavior that one Wt::WApplication.
+
+ }
+
+ WtApp::~WtApp()
+ {
+
+ }
+
+ int WtApp::WtWRun()
+ {
+ char *argv[7] = {"./WtTest","--docroot",".","--http-address","0.0.0.0","--http-port","8080"};
+ int argc = 7;
+ return Wt::WRun(argc,argv,&createApplication);
+ }
+
+
+ Wt::WApplication *createApplication(const Wt::WEnvironment& env)
+ {
+ return new WtApp(env);
+ }
+
+
+
+
+ //=========================================================================
+
+ //=========================================================================
+ void WWt::CreateWtAppIfNeeded()
+ {
+ std::cout<<"CREATING APP IF NEEDED --------- DELETE ME ------- bbtkWt.cxx"<<std::endl;
+ if(Wt::WApplication::instance()==0)
+ {
+ if (mgWtApp != 0)
+ {
+ bbtkGlobalError("Wt::CreateWtAppIfNeeded() : INTERNAL ERROR ! (Wt::WApplication::instance()==0) && (mgWtApp != 0)");
+ }
+ bbtkDebugMessage("wt",1," --> Creating bbtk WtApp"<<std::endl);
+ WtApp::WtWRun();
+ }
+ bbtkDebugMessage("process",2,"Create WtApp If needed debuging");
+ }
+ //=========================================================================
+
+ //=========================================================================
+ void WWt::DestroyWtAppIfNeeded()
+ {
+ if (mgWtApp!= 0)
+ {
+ // bbtkDebugMessage("wx",1," --> Destructing bbtk WxApp"<<std::endl);
+ //delete mgWxApp;
+ // mgWxApp = 0;
+ // Uninit wx
+ // wxUninitialize();
+ }
+ }
+ //=========================================================================
+
+
+ //=========================================================================
+ void WWt::ProcessPendingEvents()
+ {
+ /*
+ if (Wx::GetTopWindow() != 0)
+ {
+ Wx::GetTopWindow()->DestroyChildren();
+ }
+ */
+
+ /*
+ wxApp* a = (wxApp*)wxApp::GetInstance();
+ if (a==0) return;
+
+ std::cout << "$$$$$$$$$$$$$$ PROCESS PENDING "<<std::endl;
+ while (a->Pending())
+ a->Dispatch();
+ std::cout << "$$$$$$$$$$$$$$ PROCESS PENDING DONE"<<std::endl;
+ */
+ }
+
+
+ //=========================================================================
+ Wt::WContainerWidget* WWt::GetTopWindow()
+ {
+ return mgTopWindow;
+ }
+ //=========================================================================
+
+
+ // BBTKWXSIG
+ //=========================================================================
+ void WWt::AddSignalObserver(Slot_function_type f)
+ {
+ mgWtSignal.connect(f);
+ }
+ //=========================================================================
+ // \BBTKWXSIG
+
+
+ //=========================================================================
+ void WWt::SetTopWindow(Wt::WContainerWidget* w)
+ {
+ if ( mgTopWindow )
+ {
+ bbtkGlobalError("Wt::SetTopWindow : top window already set !");
+ }
+ //mgTopWindow = w;
+ }
+ //=========================================================================
+
+
+ //=========================================================================
+ void WWt::IncNbWindowsAlive()
+ {
+ mgNbWindowsAlive++;
+ bbtkDebugMessage("wt",2,"* Number of windows alive = "<<mgNbWindowsAlive
+ <<std::endl);
+ // BBTKWXSIG
+ mgWtSignal();
+ // \BBTKWXSIG
+ }
+ //=========================================================================
+
+ //=========================================================================
+ void WWt::DecNbWindowsAlive()
+ {
+ mgNbWindowsAlive--;
+ bbtkDebugMessage("wt",2,"* Number of windows alive = "<<mgNbWindowsAlive
+ <<std::endl);
+
+ // BBTKWXSIG
+ mgWtSignal();
+ // \BBTKWXSIG
+ }
+ //=========================================================================
+
+ //=========================================================================
+ int WWt::GetNbWindowsAlive()
+ {
+ return mgNbWindowsAlive;
+ }
+ //=========================================================================
+
+ //=========================================================================
+ bool WWt::IsSomeWindowAlive()
+ {
+ return (mgNbWindowsAlive!=0);
+ }
+ //=========================================================================
+
+
+ //=========================================================================
+ WWt::BusyCursor::BusyCursor()
+ {
+ // mCursor = 0;
+ if (Wt::WApplication::instance()!=0)
+ {
+ bbtkDebugMessage("wt",2,
+ "Wt::BusyCursor::BusyCursor() : creating new cursor"
+ <<std::endl);
+ //mCursor = new wxBusyCursor;
+ }
+ }
+ //=========================================================================
+ //=========================================================================
+ WWt::BusyCursor::~BusyCursor()
+ {
+ // if (mCursor)
+ // {
+ //delete mCursor;
+ //bbtkDebugMessage("wt",2,
+ // "Wt::BusyCursor::~BusyCursor() : deleting cursor"<<std::endl);
+ //}
+ }
+ //=========================================================================
+
+
+
+} // namespace bbtk
+
+#else
+//=======================================================================
+// WITHOUT WX
+//=========================================================================
+namespace bbtk
+{
+ //=========================================================================
+ WWt::BusyCursor::BusyCursor()
+ {
+ }
+ WWt::BusyCursor::~BusyCursor()
+ {
+ }
+ //=========================================================================
+
+} // namespace bbtk
+#endif
+
+
--- /dev/null
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ # pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ # This software is governed by the CeCILL-B license under French law and
+ # abiding by the rules of distribution of free software. You can use,
+ # modify and/ or redistribute the software under the terms of the CeCILL-B
+ # license as circulated by CEA, CNRS and INRIA at the following URL
+ # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ # or in the file LICENSE.txt.
+ #
+ # As a counterpart to the access to the source code and rights to copy,
+ # modify and redistribute granted by the license, users are provided only
+ # with a limited warranty and the software's author, the holder of the
+ # economic rights, and the successive licensors have only limited
+ # liability.
+ #
+ # The fact that you are presently reading this means that you have had
+ # knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
+ Program: bbtk
+ Module: $RCSfile: bbtkQt.h,v $
+ Language: C++
+ Date: $Date: 2012/11/16 08:49:01 $
+ Version: $Revision: 1.3 $
+=========================================================================*/
+
+
+
+#ifndef __bbtkWt_h_INCLUDED__
+#define __bbtkWt_h_INCLUDED__
+
+//===========================================================================
+// SIGNAL/SLOT MECHANISM
+// FOR bbtk WINDOWS CREATION/DESTRUCTION OBSERVATION
+// BBTKWXSIG
+#include <boost/signal.hpp>
+#include <boost/bind.hpp>
+
+
+//TODO Include libs in the CMake escription
+#include <Wt/WApplication>
+#include <Wt/WEnvironment>
+#include <Wt/WContainerWidget>
+#include <Wt/WWidget>
+#include <Wt/WCheckBox>
+//typedef boost::signals::trackable SignalObserver;
+// \BBTKWXSIG
+//===========================================================================
+
+
+//===========================================================================
+// Qt headers
+// DEFINIR LOS HEADERS Wt que se necesitan *-*-*-*-*-*-*-*-*-*
+/*
+#ifdef USE_WT
+#include "qwidget.h"
+// EO Qt headers
+
+#else //USE_QT
+
+// define QWidget
+typedef void QWidget;
+typedef void QBusyCursor;
+
+#endif // EO USE_WXWIDGETS
+
+//-*-*-*-* JFGA
+
+*/
+#ifdef USE_WT
+
+
+// Definition of some classes used in tehe code
+typedef Wt::WEnvironment WtWEnvironment;
+typedef Wt::WWidget WtWWidget;
+//typedef Wt::WContainerWidget WtWContainerWidget;
+typedef Wt::WApplication WtWApplication;
+typedef Wt::WString WtWString;
+
+
+
+#else // EO_USE_WT
+
+
+typedef void WtWidget;
+typedef void WtWContainerWidget;
+typedef void WtWApplication;
+typedef void WtBusyCursor;
+
+#endif // EO USE_WT
+
+
+//==========================================================================
+
+//===========================================================================
+#include "bbtkSystem.h"
+//===========================================================================
+
+
+
+
+
+namespace bbtk
+{
+
+ //==================================================================
+ /// Global wt handlers (cursor...)
+
+
+// BBTKWXSIG BBTK_ADD_BLACK_BOX_TO_PACKAGE(MyProjectWT,Testing)
+
+#define bbtkAddWtSignalObserver(METHOD) \
+ WWt::AddSignalObserver(boost::bind(&METHOD, this))
+// \BBTKWXSIG
+
+#define BBTK_BUSY_CURSOR bbtk::WWt::BusyCursor __bbtk_dummy_busy_cursor;
+
+ struct BBTK_EXPORT WWt
+ {
+ public:
+ // BBTKWXSIG
+ // The keyword 'signals' is also a macro in qt
+ // typedef boost::signals::trackable SignalObserver;
+ typedef boost::signals::trackable SignalObserver;
+ typedef boost::signal<void ()> Signal_type;
+ typedef Signal_type::slot_function_type Slot_function_type;
+ // \BBTKWXSIG
+
+ /*
+ static void ResetCursor();
+ static void BeginBusyCursor();
+ static void EndBusyCursor();
+ */
+
+ static void LoopUntilAllWindowsClose();
+
+ class BusyCursor
+ {
+ public:
+ BusyCursor();
+ ~BusyCursor();
+ //wxBusyCursor* mCursor; The wxBusyCursor is only for comunicate to the client/user that the program is busy.
+ };
+
+
+ static void ProcessPendingEvents();
+ /// Sets the parent of all bbtk windows
+ static void SetTopWindow(Wt::WContainerWidget*);
+ /// Returns the parent of all bbtk windows
+ static Wt::WContainerWidget* GetTopWindow();
+
+
+ static void IncNbWindowsAlive();
+ static void DecNbWindowsAlive();
+ static int GetNbWindowsAlive();
+ static bool IsSomeWindowAlive();
+
+
+ // BBTKWXSIG
+ static void AddSignalObserver(Slot_function_type);
+ // \BBTKWXSIG
+
+
+
+
+ //private:
+ static void CreateWtAppIfNeeded();
+ static void DestroyWtAppIfNeeded();
+
+ }; // struct Wt
+ //==================================================================
+
+#ifdef USE_WT
+ //==================================================================
+ /// Conversion std::string to wxString
+ inline Wt::WString std2wt(const std::string& s)
+ {
+ // Wt::WString wt;
+/*
+ const char* my_string=s.c_str();
+ wxMBConvUTF8 *wxconv= new wxMBConvUTF8();
+ wx=wxString(wxconv->cMB2WC(my_string),wxConvUTF8);
+ delete wxconv;
+ // test if conversion works of not. In case it fails convert from Ascii
+ if(wx.length()==0)
+ wx=wxString(wxString::FromAscii(s.c_str()));
+*/
+ return Wt::WString::fromUTF8(s,false);
+ //return new Wt::WString(s);//wt;
+ }
+ //==================================================================
+
+ //==================================================================
+ /// Conversion wxString to std::string
+ inline std::string wt2std(const Wt::WString& s){
+ /* std::string s2;
+ if(s.wxString::IsAscii()) {
+ s2=s.wxString::ToAscii();
+ } else {
+ const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(s);
+ const char *tmp_str = (const char*) tmp_buf;
+ s2=std::string(tmp_str, strlen(tmp_str));
+ }
+
+ return s2;*/
+ return s.toUTF8();
+ }
+ //==================================================================
+#endif // EO _USE_WXWIDGETS
+
+
+
+
+
+} // namespace bbtk
+
+
+#endif // EO __bbtkWt_h_INCLUDED__
--- /dev/null
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ # pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ # This software is governed by the CeCILL-B license under French law and
+ # abiding by the rules of distribution of free software. You can use,
+ # modify and/ or redistribute the software under the terms of the CeCILL-B
+ # license as circulated by CEA, CNRS and INRIA at the following URL
+ # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ # or in the file LICENSE.txt.
+ #
+ # As a counterpart to the access to the source code and rights to copy,
+ # modify and redistribute granted by the license, users are provided only
+ # with a limited warranty and the software's author, the holder of the
+ # economic rights, and the successive licensors have only limited
+ # liability.
+ #
+ # The fact that you are presently reading this means that you have had
+ # knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
+ Program: bbtk
+ Module: $RCSfile: bbtkWxBlackBox.cxx,v $
+ Language: C++
+ Date: $Date: 2012/11/16 08:49:01 $
+ Version: $Revision: 1.45 $
+=========================================================================*/
+
+
+
+#ifdef _USE_WT_
+
+/**
+ * \file
+ * \brief
+ */
+
+#include "bbtkWtBlackBox.h"
+#include "bbtkBlackBoxOutputConnector.h"
+//DELETE ME
+#include <Wt/WContainerWidget>
+
+//#include "bbtkWxContainerBlackBox.h"
+//#include <wx/dialog.h>
+
+//#include "bbtkData.h"
+//#include "bbtkFactory.h"
+
+namespace bbtk
+{
+ //=========================================================================
+ // WxFrame
+ //=========================================================================
+
+ //==================================================================
+ class WtWContainer : public Wt::WContainerWidget
+ {
+ public:
+ WtWContainer(WtBlackBox::Pointer b,
+ Wt::WContainerWidget *parent,
+ Wt::WString title/*,
+ wxSize size);*/
+ );
+ ~WtWContainer();
+ // void OnCloseWindow(wxCloseEvent& event);
+
+
+ WtBlackBox::WeakPointer mBox;
+ // DECLARE_EVENT_TABLE();
+
+ };
+
+ // BEGIN_EVENT_TABLE(WxFrame, wxFrame)
+ // EVT_CLOSE(WxFrame::OnCloseWindow)
+ //END_EVENT_TABLE();
+ //==================================================================
+
+ //==================================================================
+
+ WtWContainer::WtWContainer(WtBlackBox::Pointer b,
+ Wt::WContainerWidget *parent,
+ Wt::WString title/*,
+ wxSize size) */
+ )
+ :
+ Wt::WContainerWidget( parent),
+ mBox(b)
+ {
+ bbtkDebugMessage("widget",9,"["<<b->bbGetName()<<"] Wt::Widget()"
+ <<std::endl);
+ Wt::WObject::setObjectName(bbtk::wt2std(title));
+ WWt::IncNbWindowsAlive();
+ b->bbSetWindow(this);
+ // Insert the widget into the window
+ //wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+ std::cout<<"Creando WebWIDGET DELETE ME ---- bbtkWtBlackBox.cxx.................30%"<<std::endl;
+ std::cout<<"NAME : "<<bbtk::wt2std(title);
+ if(parent)
+ std::cout<<" CON PADRE "<<parent->objectName()<<std::endl;
+ else
+ std::cout<<" SIN PADRE "<<std::endl;
+ std::cout<<"Creando WebWIDGET DELETE ME ---- bbtkWtBlackBox.cxx.................50%"<<std::endl;
+ std::cout<<"Creando WebWIDGET DELETE ME ---- bbtkWtBlackBox.cxx.................55%"<<std::endl;
+ //this->addWidget(new Wt::WContainerWidget());
+ std::cout<<"Creando WebWIDGET DELETE ME ---- bbtkWtBlackBox.cxx.................58%"<<std::endl;
+ b->bbUserCreateWidget(this);
+ Wt::WContainerWidget* widget = b->bbGetOutputWidget();
+ this->addWidget(widget);
+ /* Wt::WWidget* widget = b->bbGetOutputWidget();
+ sizer->Add( widget, 1, wxALL|wxGROW, 2);
+ SetSizer(sizer);
+ Layout();
+*/
+ }
+ //==================================================================
+ //==================================================================
+ WtWContainer::~WtWContainer()
+ {
+ if (mBox.lock())
+ bbtkDebugMessage("widget",9,"["<<mBox.lock()->bbGetName()
+ <<"] $$$$$$$$$$$$$$$$$$$ ~W()"
+ <<std::endl);
+ else
+ bbtkDebugMessage("widget",9,"[DEAD] $$$$$$$$$$$$$$$$$$$$$ ~WtContainer()"<<std::endl);
+ //bbtkDebugMessage("widget",9,"WxFrame::~WxFrame()"<<std::endl);
+ if (mBox.lock()) mBox.lock()->bbSetWindow(0);
+ WWt::DecNbWindowsAlive();
+ }
+
+
+
+ //==================================================================
+
+ //=========================================================================
+ // WxDialog
+ //=========================================================================
+
+ //==================================================================
+ // Dialog window which is modal
+ /* class BBTK_EXPORT WxDialog : public wxDialog
+ {
+ public:
+ WxDialog(WxBlackBox::Pointer box,
+ wxWindow *parent,
+ wxString title,
+ wxSize size);
+ ~WxDialog();
+ void OnCloseWindow(wxCloseEvent& event);
+
+
+ WxBlackBox::WeakPointer mBox;
+ DECLARE_EVENT_TABLE();
+
+ };
+
+ BEGIN_EVENT_TABLE(WxDialog, wxDialog)
+ EVT_CLOSE(WxDialog::OnCloseWindow)
+ END_EVENT_TABLE();
+ //=========================================================================
+
+ //=========================================================================
+ WxDialog::WxDialog(WxBlackBox::Pointer b,
+ wxWindow *parent,
+ wxString title,
+ wxSize size)
+ :
+ wxDialog( parent,
+ -1,
+ title,
+ wxDefaultPosition,
+ size,
+ wxRESIZE_BORDER |
+ wxSYSTEM_MENU |
+ wxCLOSE_BOX |
+ wxMAXIMIZE_BOX |
+ wxMINIMIZE_BOX |
+ wxCAPTION
+ ),
+ mBox(b)
+ {
+ bbtkDebugMessage("widget",9,"WxDialog::WxDialog ["<<b->bbGetName()<<"]"
+ <<std::endl);
+ Wx::IncNbWindowsAlive();
+ b->bbSetWindow(this);
+ // Insert the widget into the window
+ wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+ b->bbUserCreateWidget(this);
+ wxWindow* widget = b->bbGetOutputWidget();
+ sizer->Add( widget, 1, wxALL|wxGROW, 2);
+ SetSizer(sizer);
+ Layout();
+ }
+ //==================================================================
+ //==================================================================
+ WxDialog::~WxDialog()
+ {
+ bbtkDebugMessage("widget",9,"WxDialog::~WxDialog()"<<std::endl);
+ //bbtkDebugMessage("widget",9,"WxFrame::~WxFrame()"<<std::endl);
+ // if (mBox.lock()) mBox.lock()->bbSetWindow(0);
+ // Wx::DecNbWindowsAlive();
+ }
+ //==================================================================
+ //==================================================================
+ void WxDialog::OnCloseWindow(wxCloseEvent& event)
+ {
+ bbtkDebugMessage("widget",9,"WxDialog::OnCloseWindow()"<<std::endl);
+ if (mBox.lock()) mBox.lock()->bbSetWindow(0);
+ Wx::DecNbWindowsAlive();
+ this->Destroy();
+ }
+ //==================================================================
+
+*/
+ //=========================================================================
+ // WxBlackBox
+ //=========================================================================
+
+ //=========================================================================
+ //=========================================================================
+ //=========================================================================
+ //=========================================================================
+ BBTK_BLACK_BOX_IMPLEMENTATION(WtBlackBox,WidgetBlackBox<Wt::WContainerWidget>);
+ //=========================================================================
+
+ //=========================================================================
+ void WtBlackBox::bbUserSetDefaultValues()
+ {
+ bbtkBlackBoxDebugMessage("widget",5,"WtBlackBox::bbUserSetDefaultValues()"<<std::endl);
+ bbmWindow = 0;
+ }
+ //=========================================================================
+
+ //=========================================================================
+ void WtBlackBox::bbUserInitializeProcessing()
+ {
+ //TODO delete this commment
+ std::cout<<"Initializing WT BlackBox --- DELETE this message bbtkWtBlackBox.cxx"<<std::endl;
+ }
+ //==================================================================
+
+ //=========================================================================
+ void WtBlackBox::bbUserFinalizeProcessing()
+ {
+ bbtkBlackBoxDebugMessage("widget",5,"==> WtBlackBox::bbUserFinalizeProcessing()"<<std::endl);
+ bbDestroyWindow();
+ bbtkBlackBoxDebugMessage("widget",5,"<== WtBlackBox::bbUserFinalizeProcessing()"<<std::endl);
+ }
+ //==================================================================
+
+ //==================================================================
+ /// Callback for creating a Dialog window (modal)
+ void WtBlackBox::bbCreateDialogWindow()
+ {
+ bbtkBlackBoxDebugMessage("widget",3,
+ "==> WtBlackBox::bbCreateDialogWindow() - No Dialog must be created, it is a web app"
+ <<std::endl);
+ /* WxDialog* w = 0;
+ w = new WxDialog( GetThisPointer<WxBlackBox>(),
+ Wx::GetTopWindow(),
+ std2wx( bbGetInputWinTitle()
+ + " - bbtk (c) CREATIS"),
+ wxSize( bbGetInputWinWidth() ,
+ bbGetInputWinHeight() ) );
+ w->Show(false);
+ // w->ShowModal();
+*/
+ }
+ //=========================================================================
+
+ //==================================================================
+
+ //==================================================================
+ /// Callback for creating a Frame window
+ void WtBlackBox::bbCreateFrameWindow()
+ {
+
+ std::cout<<"Creating Container WT -- DELETE THIS MESSAGE bbtkWTBlackBox.cxx"<<std::endl;
+ bbtkBlackBoxDebugMessage("widget",3,
+ "==> WtBlackBox::bbCreateFrameWindow() - parent = "
+ <<WWt::GetTopWindow()
+ <<std::endl);
+ WtWContainer* w = 0;
+// WxFrame* w = 0;
+ w = new WtWContainer( GetThisPointer<WtBlackBox>(),
+ WWt::GetTopWindow(),
+ std2wt( bbGetInputWinTitle()
+ + " - bbtk (c) CREATIS")
+ );
+ std::cout<<"Container created succesfully -- DELETE THIS MESSAGE bbtkWTBlackBox.cxx"<<std::endl;
+ bbmWindow = w;
+
+/*
+ w = new WxFrame( GetThisPointer<WxBlackBox>(),
+ Wx::GetTopWindow(),
+ std2wx( bbGetInputWinTitle()
+ + " - bbtk (c) CREATIS"),
+ wxSize( bbGetInputWinWidth() ,
+ bbGetInputWinHeight() ) );
+
+ w->Show();
+*/
+ WWt::CreateWtAppIfNeeded();
+ }
+
+ //==================================================================
+
+ //==================================================================
+ void WtBlackBox::bbSetWindow(Wt::WContainerWidget* w)
+ {
+ bbtkBlackBoxDebugMessage("widget",9,"==> WtBlackBox::bbSetWindow("<<w<<")"<<std::endl);
+ if ((bbmWindow != 0)&&(w!=0))
+ {
+ std::cout << "ERRRRRRRROOOOR"<<std::endl;
+ }
+ bbmWindow = w;
+ }
+ //==================================================================
+
+ //==================================================================
+ void WtBlackBox::bbShowWindow()
+ {
+ if ((bbmWindow) && (!bbIsShown()))
+ {
+ bbtkBlackBoxDebugMessage("widget",3,"==> WtBlackBox::bbShowWindow()"
+ <<std::endl);
+ if (bbGetInputWinDialog())
+ {
+ // ((WxDialog*)bbmWindow)->ShowModal();
+ }
+ else
+ {
+ // There is not such a thing like show becouse it is a webapp
+ // bbGetWindow()->Show();
+ WWt::CreateWtAppIfNeeded();
+ bbSetShown(true);
+ }
+ }
+ }
+ //==================================================================
+
+ //==================================================================
+ void WtBlackBox::bbDestroyWindow()
+ {
+ bbtkBlackBoxDebugMessage("widget",3,"==> WtBlackBox::bbDestroyWindow("<<bbmWindow<<")"<<std::endl);
+ if (bbGetWindow()!=NULL)
+ {
+ // wxWindow* w = bbGetWindow();
+ //bbSetWindow(0);
+ // WE SHOULD DESTROY THE WINDOW WITH THE Close METHOD
+ // HOWEVER I
+ //w->Close(true);
+ //
+ delete bbGetWindow();
+ bbSetShown(false);
+ }
+ bbtkBlackBoxDebugMessage("widget",3,"<== WtBlackBox::bbDestroyWindow("<<bbmWindow<<")"<<std::endl);
+
+ }
+ //==================================================================
+
+}//namespace bbtk
+
+#endif
+
+
--- /dev/null
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ # pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ # This software is governed by the CeCILL-B license under French law and
+ # abiding by the rules of distribution of free software. You can use,
+ # modify and/ or redistribute the software under the terms of the CeCILL-B
+ # license as circulated by CEA, CNRS and INRIA at the following URL
+ # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ # or in the file LICENSE.txt.
+ #
+ # As a counterpart to the access to the source code and rights to copy,
+ # modify and redistribute granted by the license, users are provided only
+ # with a limited warranty and the software's author, the holder of the
+ # economic rights, and the successive licensors have only limited
+ # liability.
+ #
+ # The fact that you are presently reading this means that you have had
+ # knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
+ Program: bbtk
+ Module: $RCSfile: bbtkWxBlackBox.h,v $
+ Language: C++
+ Date: $Date: 2012/11/16 08:49:01 $
+ Version: $Revision: 1.33 $
+========================================================================*/
+
+
+
+/**
+ * \brief Short description in one line
+ *
+ * Long description which
+ * can span multiple lines
+ */
+/**
+ * \file
+ * \brief
+ */
+/**
+ * \class bbtk::
+ * \brief
+ */
+
+
+#ifdef USE_WT
+
+
+#ifndef __bbtkWtBlackBox_h__
+#define __bbtkWtBlackBox_h__
+
+
+
+#include "bbtkWidgetBlackBox.h"
+#include "bbtkWt.h"
+
+
+namespace bbtk
+{
+
+
+
+ //==================================================================
+ /// Widget black boxes
+//EED 10/06/2009 /*BBTK_EXPORT*/
+ class BBTK_EXPORT WtBlackBox : public bbtk::WidgetBlackBox<Wt::WContainerWidget>
+ {
+ public:
+ BBTK_BLACK_BOX_INTERFACE(WtBlackBox,bbtk::WidgetBlackBox<Wt::WContainerWidget>);
+
+
+ // protected:
+
+ public:
+
+ //==================================================================
+ /// Callback for creating a Dialog window (modal)
+ /// ** Must be defined ** in toolkit specific descendants
+ virtual void bbCreateDialogWindow();
+ //==================================================================
+
+ //==================================================================
+ /// Callback for creating a Frame window
+ /// ** Must be defined ** in toolkit specific descendants
+ virtual void bbCreateFrameWindow();
+ //==================================================================
+
+
+ //==================================================================
+ Wt::WContainerWidget* bbGetWindow() { return bbmWindow; }
+ void bbSetWindow(Wt::WContainerWidget*) ;
+ bool bbWindowIsCreated() { return (bbGetWindow() != 0); }
+ //==================================================================
+
+
+ //==================================================================
+ virtual void bbShowWindow();
+ //==================================================================
+
+ //==================================================================
+ virtual void bbDestroyWindow();
+ //==================================================================
+
+ private:
+
+ Wt::WContainerWidget* bbmWindow;
+
+ };
+ //=================================================================
+
+
+ //=================================================================
+ // WxBlackBoxDescriptor declaration
+ class WtBlackBoxDescriptor : public WidgetBlackBoxDescriptor<Wt::WContainerWidget>
+ BBTK_BEGIN_DESCRIBE_BLACK_BOX_BODY(WtBlackBox);
+ BBTK_NAME("WtBlackBox");
+ BBTK_END_DESCRIBE_BLACK_BOX(WtBlackBox);
+ //=================================================================
+
+
+} //namespace bbtk
+
+#endif //__bbtkWxBlackBox_h__
+
+#endif //USE_WXWIDGETS
IMPLEMENT_APP_NO_MAIN(WxApp);
//=========================================================================
bool WxApp::OnInit( )
- {
+ {
+ std::cout<<"Testing OnINIT Wx ---- JFGA !!!DELETE ME!!! bbtkWx"<<std::endl;
wxApp::OnInit();
#ifdef __WXGTK__
//See http://www.wxwindows.org/faqgtk.htm#locale
//=========================================================================
void Wx::CreateWxAppIfNeeded()
{
+
+ std::cout<<"Testing CreateWxAppIfNeeded --- DELETE ME ----"<<std::endl;
if (wxApp::GetInstance()==0)
{
if (mgWxApp != 0)
),
mBox(b)
{
+ std::cout<<"Creando Widget DELETE ME bbtkWxBlackBox.cxx--"<<std::endl;
+ std::cout<<"NAME : "<<bbtk::wx2std(title);
+ if(parent)
+ std::cout<<"PARENT : "<<bbtk::wx2std(parent->GetName())<<std::endl;
+ else
+ std::cout<<" SIN PADRE "<<std::endl;
bbtkDebugMessage("widget",9,"["<<b->bbGetName()<<"] WxFrame()"
<<std::endl);
Wx::IncNbWindowsAlive();
),
mBox(b)
{
+
bbtkDebugMessage("widget",9,"WxDialog::WxDialog ["<<b->bbGetName()<<"]"
<<std::endl);
Wx::IncNbWindowsAlive();
+ " - bbtk (c) CREATIS"),
wxSize( bbGetInputWinWidth() ,
bbGetInputWinHeight() ) );
+ std::cout<<"--!!--JFGA Testing bbCreateFrameWindow "<<bbGetInputWinTitle()<<"......!! D E L E T M E !! bbtkWxBlackBox.cxx"<<std::endl;
w->Show();
}
{
std::cout << "ERRRRRRRROOOOR"<<std::endl;
}
+ std::cout<<"SetWindow DELETE ME bbtkWxBlackBox.cxx ------"<<std::endl;
+ std::cout<<"WINDOW : "<<bbtk::wx2std(w->GetName())<<std::endl;
bbmWindow = w;
}
//==================================================================
//==================================================================
void WxBlackBox::bbShowWindow()
{
+ std::cout<<"--!!--JFGA Testing bbShowWindow PRE IF "<<bbGetInputWinTitle()<<"......!! D E L E T M E !! bbtkWxBlackBox.cxx"<<std::endl;
if ((bbmWindow) && (!bbIsShown()))
{
bbtkBlackBoxDebugMessage("widget",3,"==> WxBlackBox::bbShowWindow()"
{
((WxDialog*)bbmWindow)->ShowModal();
}
- else
+ else
{
+ std::cout<<"--!!--JFGA Testing bbShowWindow "<<bbGetInputWinTitle()<<"......!! D E L E T M E !! bbtkWxBlackBox.cxx"<<std::endl;
bbGetWindow()->Show();
bbSetShown(true);
}
ADD_SUBDIRECTORY(gdcmvtk)
+
+
+
+IF(BBTK_USE_WT)
+ ADD_SUBDIRECTORY(wt)
+ENDIF(BBTK_USE_WT)
+
IF(BBTK_USE_KWWIDGETS)
ADD_SUBDIRECTORY(kw)
ENDIF(BBTK_USE_KWWIDGETS)
bbGetInputReactiveOnKeystroke()
);
bbSetOutputWidget( w );
+//GetName
+ std::cout<<"TESTING.... DELETE ME!!!!! bbwxCheckBox.cxx ---- PARENT : "<<bbtk::wx2std(parent->GetName())<<std::endl;
+ std::cout<<"TESTING.... DELETE ME!!!!! bbwxCheckBox.cxx"<<std::endl;
}