From: guigues Date: Wed, 8 Apr 2009 07:56:03 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: EED.02Oct2009~64 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=038dbbd7dd8b34107ec932a34170a4625368eb25;p=bbtk.git *** empty log message *** --- diff --git a/kernel/appli/bbStudio/bbStudio.cxx b/kernel/appli/bbStudio/bbStudio.cxx index 7e06626..2acaa14 100644 --- a/kernel/appli/bbStudio/bbStudio.cxx +++ b/kernel/appli/bbStudio/bbStudio.cxx @@ -115,6 +115,7 @@ int main(int argc, char* argv[]) //========================================================================== // WITHOUT WX //========================================================================== +#include int main(int argc, char* argv[]) { std::cout << "bbStudio was not compiled with wxWidgets : ciao !" <InterpretFile(f); } - bbtk::Wx::LoopUntilAllWindowsClose(); + // bbtk::Wx::LoopUntilAllWindowsClose(); return 0; diff --git a/kernel/cmake/BBTKConfigurePackage.cmake b/kernel/cmake/BBTKConfigurePackage.cmake index ac1298e..f92766f 100644 --- a/kernel/cmake/BBTKConfigurePackage.cmake +++ b/kernel/cmake/BBTKConfigurePackage.cmake @@ -107,6 +107,14 @@ IF(${BBTK_PACKAGE_NAME}_USE_ITK) ) ENDIF(${BBTK_PACKAGE_NAME}_USE_ITK) +IF(${BBTK_PACKAGE_NAME}_USE_QT) + SET(USE_QT4 ON CACHE BOOL "Use QT" FORCE) + SET(${BBTK_PACKAGE_NAME}_LIBS + ${${BBTK_PACKAGE_NAME}_LIBS} + ${QT_LIBRARIES} + ) +ENDIF(${BBTK_PACKAGE_NAME}_USE_QT) + IF(${BBTK_PACKAGE_NAME}_USE_GDCM) SET(USE_GDCM ON CACHE BOOL "Use GDCM" FORCE) SET(USE_GDCM_VTK ON CACHE BOOL "Use GDCM_VTK" FORCE) diff --git a/kernel/cmake/BBTKConfigurePackage_src.cmake b/kernel/cmake/BBTKConfigurePackage_src.cmake index b16e0fa..f736364 100644 --- a/kernel/cmake/BBTKConfigurePackage_src.cmake +++ b/kernel/cmake/BBTKConfigurePackage_src.cmake @@ -53,6 +53,7 @@ IF(${BBTK_PACKAGE_NAME}_COMPILE_ALL_CXX) SET(${BBTK_PACKAGE_NAME}_CXX_SOURCES ${${BBTK_PACKAGE_NAME}_CXX_SOURCES} ${${BBTK_PACKAGE_NAME}_CPP_SOURCES}) FILE(GLOB ${BBTK_PACKAGE_NAME}_H_SOURCES "." "*.h") ENDIF(${BBTK_PACKAGE_NAME}_COMPILE_ALL_CXX) + IF(NOT PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR}) SET(${BBTK_PACKAGE_NAME}_CXX_SOURCES ${${BBTK_PACKAGE_NAME}_CXX_SOURCES} @@ -210,6 +211,7 @@ SET(${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_LIBRARY_PATHS ${BBTK_PACKAGE_LIB_PATH} # Prepare for configure SET(BBTK_PACKAGE_USE_VTK ${${BBTK_PACKAGE_NAME}_USE_VTK}) SET(BBTK_PACKAGE_USE_ITK ${${BBTK_PACKAGE_NAME}_USE_ITK}) +SET(BBTK_PACKAGE_USE_QT ${${BBTK_PACKAGE_NAME}_USE_QT}) SET(BBTK_PACKAGE_USE_GDCM ${${BBTK_PACKAGE_NAME}_USE_GDCM}) SET(BBTK_PACKAGE_USE_GSMIS ${${BBTK_PACKAGE_NAME}_USE_GSMIS}) SET(BBTK_PACKAGE_USE_WXWIDGETS ${${BBTK_PACKAGE_NAME}_USE_WXWIDGETS}) diff --git a/kernel/cmake/BBTKDefineOptions.cmake b/kernel/cmake/BBTKDefineOptions.cmake index 7c521fc..34c0a77 100644 --- a/kernel/cmake/BBTKDefineOptions.cmake +++ b/kernel/cmake/BBTKDefineOptions.cmake @@ -74,9 +74,19 @@ IF (BBTK_USE_KWWIDGETS) ELSE (BBTK_USE_KWWIDGETS) SET(USE_KWWIDGETS OFF CACHE BOOL "Use KWWidgets" FORCE) ENDIF (BBTK_USE_KWWIDGETS) +SWITCH_ON_IF_BUILD_ALL(BBTK_USE_KWWIDGETS) +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- +OPTION(BBTK_USE_QT "Build bbtk with QT ?" OFF) +IF (BBTK_USE_QT) + SET(USE_QT4 ON CACHE BOOL "Use QT" FORCE) +ELSE (BBTK_USE_QT) + SET(USE_QT4 OFF CACHE BOOL "Use QT" FORCE) +ENDIF (BBTK_USE_QT) +SWITCH_ON_IF_BUILD_ALL(BBTK_USE_QT) #----------------------------------------------------------------------------- -#SWITCH_ON_IF_BUILD_ALL(BUILD_KWWIDGETS) #----------------------------------------------------------------------------- IF(USE_ITK) diff --git a/kernel/cmake/BBTKFindLibraries.cmake b/kernel/cmake/BBTKFindLibraries.cmake index 463a773..9947b1c 100644 --- a/kernel/cmake/BBTKFindLibraries.cmake +++ b/kernel/cmake/BBTKFindLibraries.cmake @@ -85,6 +85,16 @@ IF(BBTK_USE_KWWIDGETS) ENDIF(BBTK_USE_KWWIDGETS) #----------------------------------------------------------------------------- +#----------------------------------------------------------------------------- +# QT +IF(BBTK_USE_QT) + SET(BBTK_LINK_LIBRARIES + ${BBTK_LINK_LIBRARIES} + ${QT_LIBRARIES} + ) +ENDIF(BBTK_USE_QT) +#----------------------------------------------------------------------------- + #----------------------------------------------------------------------------- # BOOST SET(BBTK_LINK_LIBRARIES diff --git a/kernel/src/CMakeLists.txt b/kernel/src/CMakeLists.txt index 5c7ca31..f9ee9f8 100644 --- a/kernel/src/CMakeLists.txt +++ b/kernel/src/CMakeLists.txt @@ -128,6 +128,7 @@ FILE(GLOB SOURCES "." "*.cxx" "*.cpp") # "ThirdParty/wx/treemultictrl/*.cpp") FILE(GLOB SOURCES_H "." "*.h" ) +#----------------------------------------------------------------------------- IF(BBTK_USE_KWWIDGETS) IF(KWWidgets_FOUND) include("${KWWidgets_CMAKE_DIR}/KWWidgetsWrappingMacros.cmake") @@ -135,6 +136,25 @@ IF(BBTK_USE_KWWIDGETS) SET(SOURCES ${SOURCES} ${LIB_TCL_SRCS}) ENDIF(KWWidgets_FOUND) ENDIF(BBTK_USE_KWWIDGETS) +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- +IF(BBTK_USE_QT) + #--------------------------------------------------------------------------- + # MOC + SET(QT4_HEADERS_TO_WRAP + bbtkQtBlackBoxDialog.h + ) + QT4_WRAP_CPP(MOC_SOURCES ${QT4_HEADERS_TO_WRAP}) + #--------------------------------------------------------------------------- + # UI + QT4_WRAP_UI(UI_SOURCES + bbtkQtBlackBoxDialog.ui + ) + SET(SOURCES ${SOURCES} ${MOC_SOURCES} ${UI_SOURCES}) +ENDIF(BBTK_USE_QT) +#----------------------------------------------------------------------------- + #----------------------------------------------------------------------------- # lib definition diff --git a/kernel/src/bbtkAtomicBlackBoxMacros.h b/kernel/src/bbtkAtomicBlackBoxMacros.h index 69bcc7c..8d8df46 100644 --- a/kernel/src/bbtkAtomicBlackBoxMacros.h +++ b/kernel/src/bbtkAtomicBlackBoxMacros.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkAtomicBlackBoxMacros.h,v $ Language: C++ - Date: $Date: 2008/11/25 11:17:13 $ - Version: $Revision: 1.13 $ + Date: $Date: 2009/04/08 07:56:11 $ + Version: $Revision: 1.14 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -259,8 +259,7 @@ //============================================================================ /// Begins the AtomicBlackBox description block -#define BBTK_BEGIN_DESCRIBE_BLACK_BOX(CLASS,PARENT) \ - class /*BBTK_EXPORT*/ CLASS ## Descriptor : public PARENT ## Descriptor \ +#define BBTK_BEGIN_DESCRIBE_BLACK_BOX_BODY(CLASS) \ { \ public: typedef CLASS ## Descriptor Self; \ BBTK_OBJECT_MINIMAL_INTERFACE; \ @@ -304,6 +303,12 @@ <<#CLASS<<"Descriptor()"< //#include @@ -770,9 +771,10 @@ namespace bbtk bbSetExecuting(true); bool wasExecuting = bbGlobalGetSomeBoxExecuting(); bbGlobalSetSomeBoxExecuting(true); - - this->bbCreateWidget(); - + + // Creates the window if the black box has one + this->bbCreateWindow(); + // Updates its inputs IOStatus s = bbUpdateInputs(); @@ -809,7 +811,8 @@ namespace bbtk <bbShowWidget(); + // Shows the window if the black box has one + this->bbShowWindow(); bbtkDebugMessage("process",3, diff --git a/kernel/src/bbtkBlackBox.h b/kernel/src/bbtkBlackBox.h index c9a6395..6e44fde 100644 --- a/kernel/src/bbtkBlackBox.h +++ b/kernel/src/bbtkBlackBox.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkBlackBox.h,v $ Language: C++ - Date: $Date: 2009/03/23 13:06:41 $ - Version: $Revision: 1.22 $ + Date: $Date: 2009/04/08 07:56:11 $ + Version: $Revision: 1.23 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -379,24 +379,24 @@ namespace bbtk //================================================================== - //================================================================== - /// Actual CreateWidget method (vitual) - /// Overloaded in AtomicBlacBox and descendants - virtual void bbCreateWidget() - { - // bbtkError("BlackBox::bbCreateWidget called : how can this happen ?"); - } - //================================================================== - - //================================================================== - /// Actual ShowWidget method (vitual) - /// Overloaded in AtomicBlacBox and descendants - virtual void bbShowWidget() - { - // bbtkError("BlackBox::bbShowWidget called : how can this happen ?"); - } - //================================================================== - + //================================================================== + /// Actual CreateWindow method (vitual) + /// Overloaded in AtomicBlacBox and descendants + virtual void bbCreateWindow() + { + // bbtkError("BlackBox::bbCreateWidget called : how can this happen ?"); + } + //================================================================== + + //================================================================== + /// Actual ShowWindow method (vitual) + /// Overloaded in AtomicBlacBox and descendants + virtual void bbShowWindow() + { + // bbtkError("BlackBox::bbShowWidget called : how can this happen ?"); + } + //================================================================== + //================================================================== /// Actual processing method (vitual) diff --git a/kernel/src/bbtkBlackBoxDescriptor.cxx b/kernel/src/bbtkBlackBoxDescriptor.cxx index 4fba943..00127c1 100644 --- a/kernel/src/bbtkBlackBoxDescriptor.cxx +++ b/kernel/src/bbtkBlackBoxDescriptor.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkBlackBoxDescriptor.cxx,v $ Language: C++ - Date: $Date: 2008/10/17 08:18:12 $ - Version: $Revision: 1.19 $ + Date: $Date: 2009/04/08 07:56:11 $ + Version: $Revision: 1.20 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -390,12 +390,14 @@ namespace bbtk col = ubbcol; iotype = 1; } +#ifdef USE_WXWIDGETS else if (in->second->GetCreatorTypeInfo() == typeid(WxBlackBoxDescriptor)) { col = wxbbcol; iotype = 2; } +#endif std::string name(in->second->GetName()); Utilities::html_format(name); @@ -453,12 +455,14 @@ namespace bbtk col = ubbcol; iotype = 1; } +#ifdef USE_WXWIDGETS else if (o->second->GetCreatorTypeInfo() == typeid(WxBlackBoxDescriptor)) { col = wxbbcol; iotype = 2; } +#endif std::string name(o->second->GetName()); Utilities::html_format(name); diff --git a/kernel/src/bbtkInterpreter.cxx b/kernel/src/bbtkInterpreter.cxx index afa2373..ef8be1b 100644 --- a/kernel/src/bbtkInterpreter.cxx +++ b/kernel/src/bbtkInterpreter.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkInterpreter.cxx,v $ Language: C++ - Date: $Date: 2009/01/27 14:22:57 $ - Version: $Revision: 1.82 $ + Date: $Date: 2009/04/08 07:56:11 $ + Version: $Revision: 1.83 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -39,6 +39,7 @@ #include "bbtkMessageManager.h" #include "bbtkConfigurationFile.h" #include "bbtkUtilities.h" +#include "bbtkAtomicBlackBox.h" #include "bbtkWxBlackBox.h" #include #include @@ -2128,9 +2129,14 @@ void Interpreter::NewGUI(const std::string& boxname, // Get the input descriptor const BlackBoxInputDescriptor* d = box->bbGetDescriptor()->GetInputDescriptor(i->first); // If it is a "system" input : skip it +#ifdef USE_WXWIDGETS if ( ( d->GetCreatorTypeInfo() == typeid(AtomicBlackBoxDescriptor)) || ( d->GetCreatorTypeInfo() == typeid(WxBlackBoxDescriptor)) ) continue; +#else + if ( ( d->GetCreatorTypeInfo() == typeid(AtomicBlackBoxDescriptor)) ) + continue; +#endif bool widok = true; std::string widget,adaptor; // try to find a widget adaptor diff --git a/kernel/src/bbtkKWBlackBox.cxx b/kernel/src/bbtkKWBlackBox.cxx index 0867936..ea7f31f 100644 --- a/kernel/src/bbtkKWBlackBox.cxx +++ b/kernel/src/bbtkKWBlackBox.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkKWBlackBox.cxx,v $ Language: C++ - Date: $Date: 2008/12/18 11:54:44 $ - Version: $Revision: 1.8 $ + Date: $Date: 2009/04/08 07:56:11 $ + Version: $Revision: 1.9 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -54,172 +54,50 @@ namespace bbtk //========================================================================= //========================================================================= //========================================================================= - BBTK_BLACK_BOX_IMPLEMENTATION(KWBlackBox,AtomicBlackBox); + BBTK_BLACK_BOX_IMPLEMENTATION(KWBlackBox,WidgetBlackBox); //========================================================================= - //========================================================================= - void KWBlackBox::bbUserConstructor() - { - bbtkDebugMessage("Kernel",9,"KWBlackBox::bbUserConstructor()"<bbSetBlackBox( GetThisPointer()); + KW::GetApplication()->AddWindow((vtkKWWindowBase*)win); + win->Create(); + win->SetResizable(0,0); + + bbUserCreateWidget(win->GetFrame()); + /* + KW::GetApplication()->Script + ("pack %s -expand yes -fill both", + bbGetOutputWidget()->GetWidgetName()); + */ + + KW::GetApplication()->Script("place %s -x 0 -y 0 -width %d -height %d", + bbGetOutputWidget()->GetWidgetName(), + bbGetInputWinWidth(), + bbGetInputWinHeight()); + - //========================================================================= - void KWBlackBox::bbUserDestructor() - { - bbtkDebugMessage("kw",9,"==> KWBlackBox::bbUserDestructor() ["<bbClose(); - bbSetWindow(0); - } - bbtkDebugMessage("kw",9,"<== KWBlackBox::bbUserDestructor() ["<bbUserProcess(); - - // If output widget not connected create the window - if ( (*bbGetOutputConnectorMap().find("Widget")).second - ->GetConnectionVector().size() == 0 ) - { - Window* show = 0; - // If the window already exists : no need creating it - if (bbGetWindow()!=0) - { - bbtkDebugMessage("kw",2, - "-> Window already exists" - < Creating the window" - <bbSetBlackBox( GetThisPointer()); - KW::GetApplication()->AddWindow((vtkKWWindowBase*)win); - win->Create(); - win->SetResizable(0,0); - - bbUserCreateWidget(win->GetFrame()); - /* - KW::GetApplication()->Script - ("pack %s -expand yes -fill both", - bbGetOutputWidget()->GetWidgetName()); - */ - - KW::GetApplication()->Script("place %s -x 0 -y 0 -width %d -height %d", - bbGetOutputWidget()->GetWidgetName(), - bbGetInputWinWidth(), - bbGetInputWinHeight()); - - - + //================================================================== - /* - bbGetOutputWidget()->SetParent(win); - bbGetOutputWidget()->Create(); - KW::GetApplication()->Script("pack %s -side left -anchor c -expand y", - - //"pack %s -side top -anchor nw -expand y -fill none -padx 2 -pady 2", - bbGetOutputWidget()->GetWidgetName()); - */ - /* - } - - // Input WinDialog set to false : creating a Frame - else - { - bbtkDebugMessage("process",2, - " Input WinDialog set to false : creating a Frame" - <bbSetBlackBox( GetThisPointer()); - // win->SetName( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN" ); - // win->SetWidth( bbGetInputWinWidth() ); - // win->SetHeight( bbGetInputWinHeight() ); - KW::GetApplication()->AddWindow((vtkKWWindowBase*)win); - win->Create(); - - bbGetOutputWidget()->SetParent(win); - bbGetOutputWidget()->Create(); - KW::GetApplication()->Script("pack %s -side top -anchor nw -expand y -fill none -padx 2 -pady 2", - bbGetOutputWidget()->GetWidgetName()); } - */ - - // win->Invoke(); - } - - // Show the window - - show->bbShow(); - // std::cout << "KW::GetApplication()->Start();"<Start(); - // std::cout << "AFTER KW::GetApplication()->Start();"< KWBlackBox::bbHideWindow() [" - <bbHide(); - - bbtkDebugMessageDec("kw",2,"<= KWBlackBox::bbHideWindow() [" - < KWBlackBox::bbCloseWindow() [" - <bbClose(); - - bbtkDebugMessageDec("kw",2,"<= KWBlackBox::bbCloseWindow() [" - <second->GetConnectionVector().size() != 0 ) - { - return boost::static_pointer_cast - (i->second->GetConnectionVector().front() //.lock() - ->GetBlackBoxTo())->bbGetContainingWindow(); - } - return 0; - } - //================================================================== - - - //================================================================== - bool KWBlackBox::bbIsShown() - { - if (bbGetContainingWindow()!=0) - return bbGetContainingWindow()->bbIsShown(); - return false; - } + // void KWBlackBox::InitWindowManagerIfNeeded() { KW:: + void KWBlackBox::IncNbWindowsAlive() { KW::IncNbWindowsAlive(); } + void KWBlackBox::DecNbWindowsAlive() { KW::DecNbWindowsAlive(); } + int KWBlackBox::GetNbWindowsAlive() { return KW::GetNbWindowsAlive(); } + bool KWBlackBox::IsSomeWindowAlive() { return KW::IsSomeWindowAlive(); } + + void KWBlackBox::IncNbWindowsShown() { KW::IncNbWindowsShown(); } + void KWBlackBox::DecNbWindowsShown() { KW::DecNbWindowsShown(); } + int KWBlackBox::GetNbWindowsShown() { return KW::GetNbWindowsShown(); } + bool KWBlackBox::IsSomeWindowShown() { return KW::GetNbWindowsShown(); } //================================================================== - - + }//namespace bbtk diff --git a/kernel/src/bbtkKWBlackBox.h b/kernel/src/bbtkKWBlackBox.h index 6a2eb35..470c286 100644 --- a/kernel/src/bbtkKWBlackBox.h +++ b/kernel/src/bbtkKWBlackBox.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkKWBlackBox.h,v $ Language: C++ - Date: $Date: 2008/12/11 09:50:35 $ - Version: $Revision: 1.5 $ + Date: $Date: 2009/04/08 07:56:11 $ + Version: $Revision: 1.6 $ ========================================================================*/ @@ -48,189 +48,64 @@ #ifdef USE_KWWIDGETS -#include "bbtkAtomicBlackBox.h" +#include "bbtkWidgetBlackBox.h" #include "bbtkKW.h" -//================================================================== -// Forward declaration of the class of window associated to a KWBlackBox -class vtkKWBlackBoxWindow; -class vtkKWBlackBoxDialog; -class vtkKWFrame; -//================================================================== - namespace bbtk { - - //================================================================== /// Widget black boxes - class BBTK_EXPORT KWBlackBox : public bbtk::AtomicBlackBox + class BBTK_EXPORT KWBlackBox : public bbtk::WidgetBlackBox { - BBTK_BLACK_BOX_INTERFACE(KWBlackBox,bbtk::AtomicBlackBox); - 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, vtkKWWidget*); - + BBTK_BLACK_BOX_INTERFACE(KWBlackBox,bbtk::WidgetBlackBox); public: - - typedef vtkKWBlackBoxDialog Window; - - /// Returns the **OWN** window associated to the box - /// If 0 returned = no window - Window* bbGetWindow() { return bbmWindow; } - - /// Returns the window containing the widget associated to the box - /// Which can be the own window of **ANOTHER** box in case of - /// a hierarchy of widgets. - /// More precisely : - /// If bbGetWindow() != 0 then returns bbGetWindow() - /// Else if the output 'Widget' is connected - /// then returns bbGetContainingWindow() of the box connected to 'Widget' - /// Else returns 0; - Window* bbGetContainingWindow(); - - - /// Returns true iff the 'containing window' exists and is shown - /// (see bbGetContainingWindow). - bool bbIsShown(); - - //================================================================== - /// User callback invoked when the containing window is shown - virtual void bbUserOnShow() {} + //================================================================== + /// Callback for creating a Dialog window (modal) + virtual void bbCreateDialogWindow(); //================================================================== - + //================================================================== - /// User callback invoked when the containing window is hidden - virtual void bbUserOnHide() {} + /// Callback for creating a Frame window + virtual void bbCreateFrameWindow(); //================================================================== - /// Sets the window - inline void bbSetWindow(Window* w) { bbmWindow=w; } - - - protected: + //================================================================== + // virtual void InitWindowManagerIfNeeded(); + virtual void IncNbWindowsAlive(); + virtual void DecNbWindowsAlive(); + virtual int GetNbWindowsAlive(); + virtual bool IsSomeWindowAlive(); - + virtual void IncNbWindowsShown(); + virtual void DecNbWindowsShown(); + virtual int GetNbWindowsShown(); + virtual bool IsSomeWindowShown(); //================================================================== - /// User callback called in the box contructor - virtual void bbUserConstructor(); - /// User callback called in the box copy constructor - virtual void bbUserCopyConstructor(bbtk::BlackBox::Pointer); - /// User callback called in the box destructor - virtual void bbUserDestructor(); - //================================================================== - - //================================================================== - /// User callback for creating the widget associated to the box - /// ** Must be defined ** - // LG 24/11/08 : New widget pipeline - virtual void bbUserCreateWidget(vtkKWFrame* parent) - { - bbtkError(bbGetTypeName()<<" is a KWBlackBox whose bbUserCreateWidget methods is not overloaded : is it a feature or a bug ?!?"); - } - //================================================================== + //================================================================== vtkKWWidget* bbCreateWidgetOfInput(const std::string& in, vtkKWFrame* parent); //================================================================== - //================================================================== - /// Overloaded processing method for KWBlackBoxes - virtual void bbProcess(); - //================================================================== - - //================================================================== - /// If necessary creates the KWBlackBoxWindow associated to the box - /// and shows it - /// (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(); - /// Hides the KWBlackBoxWindow associated to the box (if exists) - void bbHideWindow(); - /// Closes (destroys) the KWBlackBoxWindow associated to the box (if exists) - void bbCloseWindow(); - //================================================================== - - private: - /// friendship - friend class vtkKWBlackBoxWindow; - // friend class KWBlackBoxWidgetEventHandler; - - /// The KWBlackBoxWindow associated to the box - Window* bbmWindow; - - - void bbInitAttributes(); - }; //================================================================= - //====================================================================== - /// Defines the bbUserCreateWidget method -#define BBTK_CREATE_KWWIDGET(CALLBACK) \ - public: \ - inline void bbUserCreateWidget(vtkKWFrame* parent) \ - { \ - bbtkDebugMessageInc("kw",1,"**> Creating widget for [" \ - < Showing [" \ - < + BBTK_BEGIN_DESCRIBE_BLACK_BOX_BODY(KWBlackBox); BBTK_NAME("KWBlackBox"); - // BBTK_DESCRIPTION("Widget box. The inputs marked with (*) are only used if the widget is not inserted in another widget.\n"); - BBTK_CATEGORY("widget"); - BBTK_INPUT(KWBlackBox,WinTitle, - "Title of the window (*)", - std::string,""); - BBTK_INPUT(KWBlackBox,WinWidth, - "Width of the window (* : only used if the widget is not connected to a Layout box)",int,""); - BBTK_INPUT(KWBlackBox,WinHeight, - "Height of the window (*)",int,""); - BBTK_INPUT(KWBlackBox,WinDialog, - "Set to 'true' to create a dialog window, i.e. which blocks the pipeline until it is closed (modal) (*)",bool,""); - BBTK_INPUT(KWBlackBox,WinHide, - "Any signal received hides the window (*)",Void,"signal"); - BBTK_INPUT(KWBlackBox,WinClose, - "Any signal received closes the window (*)",Void,"signal"); - BBTK_OUTPUT(KWBlackBox,Widget,"Output widget",vtkKWWidget*,""); BBTK_END_DESCRIBE_BLACK_BOX(KWBlackBox); //================================================================= @@ -241,34 +116,6 @@ namespace bbtk - /* - //================================================================= - // Handles the destroy events of a widget associated to a KWBlackBox - // in order to signal the widget death to its associated box - class BBTK_EXPORT KWBlackBoxWidgetEventHandler : public wxEvtHandler - { - public: - /// Ctor with the box and widget - KWBlackBoxWidgetEventHandler( KWBlackBox::Pointer box, wxWindow *widget ); - /// Dtor - ~KWBlackBoxWidgetEventHandler(); - /// Returns true iff is the handler for that window - bool IsHandlerOf( wxWindow* w ) { return mWindow == w; } - // wxWindow* GetKWWindow() { return mWindow; } - /// Method processing the destroy event of the widget - void OnWindowDestroy(wxWindowDestroyEvent&); - // - //bool IsDead() { return mDead; } - - private: - KWBlackBox::WeakPointer mBox; - wxWindow* mWindow; - //bool mDead; - }; - //================================================================= - */ - - } //namespace bbtk diff --git a/kernel/src/bbtkQt.cxx b/kernel/src/bbtkQt.cxx new file mode 100644 index 0000000..e12409e --- /dev/null +++ b/kernel/src/bbtkQt.cxx @@ -0,0 +1,406 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbtkQt.cxx,v $ + Language: C++ + Date: $Date: 2009/04/08 07:56:11 $ + Version: $Revision: 1.1 $ +=========================================================================*/ + +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* 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. +* ------------------------------------------------------------------------ */ +#include "bbtkQt.h" +#include "bbtkMessageManager.h" + +#ifdef USE_QT + +#include + + +namespace bbtk +{ + //========================================================================= + // class QtApp; + //========================================================================= + + //========================================================================= + static QApplication* mgQtApp = 0; + // static wxWindow* mgTopWindow = 0; + // static wxWindow* mgTopWindowParent = 0; + // static bool mgAutoDestroyTopWindow = true; + static int mgNbWindowsAlive = 0; + static int mgNbWindowsShown = 0; + //========================================================================= + + //========================================================================= + // BBTKWXSIG + static Qt::Signal_type mgQtSignal; + // \BBTKWXSIG + //========================================================================= + + + //========================================================================= + // The wxApp class which is used when no user wxApp was created + /* + class QtApp : public wxApp + { + public: + bool OnInit( ); + int OnExit() { return true; } + }; + //========================================================================= + IMPLEMENT_APP_NO_MAIN(QtApp); + //========================================================================= + bool QtApp::OnInit( ) + { + wxApp::OnInit(); +#ifdef __WXGTK__ + //See http://www.wxwindows.org/faqgtk.htm#locale + setlocale(LC_NUMERIC, "C"); +#endif + return true; + } + */ + //========================================================================= + + int argc = 1; + char* argv = "QApp"; + + //========================================================================= + void Qt::CreateQtAppIfNeeded() + { + + if (QApplication::instance()==0) + { + if (mgQtApp != 0) + { + bbtkGlobalError("Qt::CreateQtAppIfNeeded() : INTERNAL ERROR ! (QCoreApplication::instance()==0) && (mgQtApp != 0)"); + } + bbtkDebugMessage("qt",1," --> Creating bbtk QApplication"<>>> mgQtApp.exec()"<exec(); + + // std::cout << "<<<< mgQtApp.exec()"< Destructing bbtk QApplication"< Creating bbtk top window"<Hide(); + + Qt::SetTopWindow(top); + */ + } + //========================================================================= + + //========================================================================= + void Qt::DestroyTopWindowIfNeeded() + { + /* + if ( (mgNbWindowsAlive==0) && + (mgAutoDestroyTopWindow) ) + { + bbtkDebugMessage("wx",1," --> Destructing bbtk top window"<Close(); + mgTopWindow = 0; + + DestroyQtAppIfNeeded(); + } + */ + } + //========================================================================= + + //========================================================================= + void Qt::LoopUntilAllWindowsClose() + { + /* + int i = 0; + while (mgTopWindow != 0) + { + if (i % 100 == 0) + { + bbtkDebugMessage("wx",2,"Qt::Loop "< +#include +typedef boost::signals::trackable SignalObserver; +// \BBTKWXSIG +//=========================================================================== + + +//=========================================================================== +// Qt headers +#ifdef USE_QT +#include "qwidget.h" +// EO Qt headers + +#else //USE_QT + +// define QWidget +typedef void QWidget; +typedef void QBusyCursor; + +#endif // EO USE_WXWIDGETS +//=========================================================================== + +//=========================================================================== +#include "bbtkSystem.h" +//=========================================================================== + + +namespace bbtk +{ + + //================================================================== + /// Global qt handlers (cursor...) + +// BBTKWXSIG +#define bbtkAddQtSignalObserver(METHOD) \ + Qt::AddSignalObserver(boost::bind(&METHOD, this)) +// \BBTKWXSIG + +#define BBTK_BUSY_CURSOR bbtk::Qt::BusyCursor __bbtk_dummy_busy_cursor; + + struct BBTK_EXPORT Qt + { + public: + // BBTKWXSIG + // The keyword 'signals' is also a macro in qt + // typedef boost::signals::trackable SignalObserver; + typedef boost::signal 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; + }; + + static void SetTopWindowParent(QWidget*); + static void SetAutoDestroyTopWindow(bool); + + /// Returns the creation time parent of all bbtk windows + /// (window can be reparented after creation) + static QWidget* GetTopWindow(); + static bool TopWindowExists(); + + static void IncNbWindowsAlive(); + static void DecNbWindowsAlive(); + static int GetNbWindowsAlive(); + static bool IsSomeWindowAlive(); + + static void IncNbWindowsShown(); + static void DecNbWindowsShown(); + static int GetNbWindowsShown(); + static bool IsSomeWindowShown(); + + // BBTKWXSIG + static void AddSignalObserver(Slot_function_type); + // \BBTKWXSIG + + + + static void CreateQtAppIfNeeded(); + static void DestroyQtAppIfNeeded(); + + private: + static void CreateTopWindowIfNeeded(); + static void DestroyTopWindowIfNeeded(); + + /// Sets the creation time parent of all bbtk windows + static void SetTopWindow(QWidget*); + }; // struct Qt + //================================================================== + + + + + + +} // namespace bbtk + + +#endif // EO __bbtkQt_h_INCLUDED__ diff --git a/kernel/src/bbtkQtBlackBox.cxx b/kernel/src/bbtkQtBlackBox.cxx new file mode 100644 index 0000000..7534fd6 --- /dev/null +++ b/kernel/src/bbtkQtBlackBox.cxx @@ -0,0 +1,107 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbtkQtBlackBox.cxx,v $ + Language: C++ + Date: $Date: 2009/04/08 07:56:11 $ + Version: $Revision: 1.1 $ +=========================================================================*/ + +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* 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. +* ------------------------------------------------------------------------ */ +/** + * \file + * \brief + */ + +#ifdef USE_QT + + +#include "bbtkQtBlackBox.h" +//#include "bbtkBlackBoxOutputConnector.h" +//#include "bbtkQtBlackBoxDialog.h" +#include "bbtkQtBlackBoxDialog.h" + + +namespace bbtk +{ + + + + //========================================================================= + // QtBlackBox + //========================================================================= + + //========================================================================= + //========================================================================= + //========================================================================= + //========================================================================= + BBTK_BLACK_BOX_IMPLEMENTATION(QtBlackBox,WidgetBlackBox); + //========================================================================= + + //================================================================== + /// Callback for creating a Dialog window (modal) + void QtBlackBox::bbCreateDialogWindow() + { + Qt::CreateQtAppIfNeeded(); + QtBlackBoxDialog* w = 0; + w = new QtBlackBoxDialog( GetThisPointer(), + 0, + bbGetInputWinTitle() + + " - bbtk (c) CREATIS LRMN", + bbGetInputWinWidth() , + bbGetInputWinHeight() ); + } + //================================================================== + + //================================================================== + /// Callback for creating a Frame window + void QtBlackBox::bbCreateFrameWindow() + { + + this->bbCreateDialogWindow(); + + } + //================================================================== + + + + //================================================================== + // void QtBlackBox::InitWindowManagerIfNeeded() { Qt:: + void QtBlackBox::IncNbWindowsAlive() { Qt::IncNbWindowsAlive(); } + void QtBlackBox::DecNbWindowsAlive() { Qt::DecNbWindowsAlive(); } + int QtBlackBox::GetNbWindowsAlive() { return Qt::GetNbWindowsAlive(); } + bool QtBlackBox::IsSomeWindowAlive() { return Qt::IsSomeWindowAlive(); } + + void QtBlackBox::IncNbWindowsShown() { Qt::IncNbWindowsShown(); } + void QtBlackBox::DecNbWindowsShown() { Qt::DecNbWindowsShown(); } + int QtBlackBox::GetNbWindowsShown() { return Qt::GetNbWindowsShown(); } + bool QtBlackBox::IsSomeWindowShown() { return Qt::GetNbWindowsShown(); } + //================================================================== + + + + +}//namespace bbtk + + +#endif + diff --git a/kernel/src/bbtkQtBlackBox.h b/kernel/src/bbtkQtBlackBox.h new file mode 100644 index 0000000..5cee0ba --- /dev/null +++ b/kernel/src/bbtkQtBlackBox.h @@ -0,0 +1,122 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbtkQtBlackBox.h,v $ + Language: C++ + Date: $Date: 2009/04/08 07:56:11 $ + Version: $Revision: 1.1 $ +========================================================================*/ + + +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* 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. +* ------------------------------------------------------------------------ */ +/** + * \brief Short description in one line + * + * Long description which + * can span multiple lines + */ +/** + * \file + * \brief + */ +/** + * \class bbtk:: + * \brief + */ +#ifndef __bbtkQtBlackBox_h_INCLUDED__ +#define __bbtkQtBlackBox_h_INCLUDED__ + + +#ifdef USE_QT + + +#include "bbtkWidgetBlackBox.h" + + +#include "bbtkQt.h" + + +//================================================================== +class QWidget; +//================================================================== + + +namespace bbtk +{ + + + + + + //================================================================== + /// Widget black boxes + class BBTK_EXPORT QtBlackBox : public bbtk::WidgetBlackBox + { + BBTK_BLACK_BOX_INTERFACE(QtBlackBox,bbtk::WidgetBlackBox); + 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(); + //================================================================== + + + //================================================================== + // virtual void InitWindowManagerIfNeeded(); + virtual void IncNbWindowsAlive(); + virtual void DecNbWindowsAlive(); + virtual int GetNbWindowsAlive(); + virtual bool IsSomeWindowAlive(); + + virtual void IncNbWindowsShown(); + virtual void DecNbWindowsShown(); + virtual int GetNbWindowsShown(); + virtual bool IsSomeWindowShown(); + //================================================================== + + }; + //================================================================= + + + //================================================================= + // QtBlackBoxDescriptor declaration + // + class QtBlackBoxDescriptor : public WidgetBlackBoxDescriptor + BBTK_BEGIN_DESCRIBE_BLACK_BOX_BODY(QtBlackBox); + BBTK_NAME("QtBlackBox"); + BBTK_END_DESCRIBE_BLACK_BOX(QtBlackBox); + //================================================================= + + + +} //namespace bbtk + + + +#endif // USE_QT +#endif //__bbtkQtBlackBox_h__ diff --git a/kernel/src/bbtkQtBlackBoxDialog.cxx b/kernel/src/bbtkQtBlackBoxDialog.cxx new file mode 100644 index 0000000..06189d5 --- /dev/null +++ b/kernel/src/bbtkQtBlackBoxDialog.cxx @@ -0,0 +1,82 @@ +#ifdef USE_QT + +#include "bbtkQtBlackBoxDialog.h" +#include "bbtkQtBlackBox.h" + +namespace bbtk +{ + + + //========================================================================= + QtBlackBoxDialog::QtBlackBoxDialog(QtBlackBox::Pointer box, + QWidget *parent, + const std::string& title, + int width, int height) + + : + QtBlackBoxDialogParent(box,parent) + // QDialog( parent ) + { + bbtkDebugMessage("qt",9,"QtBlackBoxDialog::QtBlackBoxDialog("<< + bbGetBlackBox()->bbGetFullName()<<","<bbUserCreateWidget(widget); + + // Insert into the layout + horizontalLayout->addWidget(box->bbGetOutputWidget()); + + + // updateGeometry(); + + } + //========================================================================= + + //========================================================================= + void QtBlackBoxDialog::bbShow() + { + if (bbIsShown()) return; + bbtkDebugMessage("qt",5,"QtBlackBoxDialog::bbShow() [" + <bbGetFullName()<<"]"<, + // public QDialog, + private Ui::bbtkQtBlackBoxDialog + { + Q_OBJECT + public: + typedef QtBlackBoxDialogParent Parent; + // typedef WidgetBlackBoxWindow Parent; + //QtBlackBoxDialog() : Parent(QtBlackBox::Pointer()) {} + QtBlackBoxDialog(QtBlackBox::Pointer box, + QWidget *parent, + const std::string& title, + int width, int height); + ~QtBlackBoxDialog(); + void bbShow(); + void bbHide(); + void bbClose(); + bool bbIsDialog() { return true; } + }; + //========================================================================= + +} + +#endif +#endif + diff --git a/kernel/src/bbtkQtBlackBoxDialog.ui b/kernel/src/bbtkQtBlackBoxDialog.ui new file mode 100644 index 0000000..98ec27f --- /dev/null +++ b/kernel/src/bbtkQtBlackBoxDialog.ui @@ -0,0 +1,37 @@ + + bbtkQtBlackBoxDialog + + + + 0 + 0 + 143 + 603 + + + + + 1 + 1 + + + + Dialog + + + + + + + 1 + 1 + + + + + + + + + + diff --git a/kernel/src/bbtkQtBlackBoxDialogParent.h b/kernel/src/bbtkQtBlackBoxDialogParent.h new file mode 100644 index 0000000..95f5a87 --- /dev/null +++ b/kernel/src/bbtkQtBlackBoxDialogParent.h @@ -0,0 +1,20 @@ +#include + +namespace bbtk +{ + class QtBlackBoxDialogParent : public WidgetBlackBoxWindow, + public QDialog + { + public: + QtBlackBoxDialogParent(QtBlackBox::Pointer box, + QWidget *parent) + : + WidgetBlackBoxWindow(box), + QDialog( parent ) + { + + } + + }; + +} diff --git a/kernel/src/bbtkWidgetBlackBox.h b/kernel/src/bbtkWidgetBlackBox.h new file mode 100644 index 0000000..deed3f7 --- /dev/null +++ b/kernel/src/bbtkWidgetBlackBox.h @@ -0,0 +1,292 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbtkWidgetBlackBox.h,v $ + Language: C++ + Date: $Date: 2009/04/08 07:56:11 $ + Version: $Revision: 1.1 $ +========================================================================*/ + + +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* 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. +* ------------------------------------------------------------------------ */ +/** + * \brief Short description in one line + * + * Long description which + * can span multiple lines + */ +/** + * \file + * \brief + */ +/** + * \class bbtk:: + * \brief + */ +#ifndef __bbtkWidgetBlackBox_h_INCLUDED__ +#define __bbtkWidgetBlackBox_h_INCLUDED__ + +#include "bbtkAtomicBlackBox.h" + +namespace bbtk +{ + + + template class WidgetBlackBoxWindow; + + + //================================================================== + /// Generic (template) Widget black box from which all + /// widget black boxes for a specific GUI toolkit inherit with + /// apropriate traits. + /// Declares the common inputs / outputs and interface to all widget boxes + template + class BBTK_EXPORT WidgetBlackBox : public bbtk::AtomicBlackBox + { + public: + // typedef WidgetTraits Traits; + typedef W Widget; + typedef Widget* WidgetPointer; + typedef WidgetBlackBoxWindow Window; + + + BBTK_BLACK_BOX_INTERFACE(WidgetBlackBox,bbtk::AtomicBlackBox); + 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,Widget*); + + //================================================================== + /// Overloaded bbCreateWindow method for WidgetBlackBoxes which handles + /// the window creation if needed + virtual void bbCreateWindow(); + //================================================================== + + //================================================================== + /// Overloaded bbShowWindow method for WidgetBlackBoxes which handles + /// the window creation if needed + virtual void bbShowWindow(); + //================================================================== + + //================================================================== + /// Returns the **OWN** window associated to the box + /// If 0 returned = no window + Window* bbGetWindow() { return bbmWindow; } + /// Returns the window containing the widget associated to the box + /// Which can be the own window of **ANOTHER** box in case of + /// a hierarchy of widgets (layouts) + /// More precisely : + /// If bbGetWindow() != 0 then returns bbGetWindow() + /// Else if the output 'Widget' is connected + /// then returns bbGetContainingWindow() of the box connected to 'Widget' + /// Else returns 0; + Window* bbGetContainingWindow(); + + + /// Returns true iff the 'containing window' exists and is shown + /// (see bbGetContainingWindow). + bool bbIsShown(); + + /// Convenient method which returns true iff the output Widget is connected + bool bbIsOutputWidgetConnected(); + + //================================================================== + /// User callback invoked when the containing window is shown + virtual void bbUserOnShow() {} + //================================================================== + + //================================================================== + /// User callback invoked when the containing window is hidden + virtual void bbUserOnHide() {} + //================================================================== + + /// Sets the window + inline void bbSetWindow(Window* w) { bbmWindow=w; } + + //================================================================== + /// User callback for creating the widget associated to the box + /// ** Must be defined ** in user classes + virtual void bbUserCreateWidget(Widget* parent) + { + bbtkError(bbGetTypeName()<<" is a WidgetBlackBox whose bbUserCreateWidget methods is not overloaded : is it a feature or a bug ?!?"); + } + //================================================================== + + + protected: + + + //================================================================== + /// User callback called in the box contructor + virtual void bbUserConstructor(); + /// User callback called in the box copy constructor + virtual void bbUserCopyConstructor(bbtk::BlackBox::Pointer); + /// User callback called in the box destructor + virtual void bbUserDestructor(); + //================================================================== + + + + + //================================================================== + /// Convenient method for layout widgets which creates and returns + /// (calls bbUserCreateWidget) + /// the widget of the box connected to the input in. + /// Returns NULL if the input is not connected + Widget* bbCreateWidgetOfInput(const std::string& in, + Widget* parent); + //================================================================== + + //================================================================== + /// Callback for creating a Dialog window (modal) + /// ** Must be defined ** in toolkit specific descendants + virtual void bbCreateDialogWindow() + { + bbtkError(bbGetTypeName()<<" is a WidgetBlackBox whose bbCreateDialogWindow method is not overloaded ?!?"); + } + //================================================================== + + //================================================================== + /// Callback for creating a Frame window + /// ** Must be defined ** in toolkit specific descendants + virtual void bbCreateFrameWindow() + { + bbtkError(bbGetTypeName()<<" is a WidgetBlackBox whose bbCreateFrameWindow method is not overloaded ?!?"); + } + //================================================================== + //================================================================== + /// Overloaded processing method for WidgetBlackBoxes + virtual void bbProcess(); + //================================================================== + + //================================================================== + /// Hides the WidgetBlackBoxWindow associated to the box (if exists) + void bbHideWindow(); + /// Closes (destroys) the WidgetBlackBoxWindow associated to the box + /// (if exists) + void bbCloseWindow(); + //================================================================== + + + //================================================================== + // virtual void InitWindowManagerIfNeeded(); + virtual void IncNbWindowsAlive() {} + virtual void DecNbWindowsAlive() {} + virtual int GetNbWindowsAlive() { return 0; } + virtual bool IsSomeWindowAlive() { return false; } + + virtual void IncNbWindowsShown() {} + virtual void DecNbWindowsShown() {} + virtual int GetNbWindowsShown() { return 0; } + virtual bool IsSomeWindowShown() { return false; } + //================================================================== + + + private: + /// friendship + friend class WidgetBlackBoxWindow; + // friend class WidgetBlackBoxWidgetEventHandler; + + /// The WidgetBlackBoxWindow associated to the box + Window* bbmWindow; + + + void bbInitAttributes(); + + }; + //================================================================= + + + //====================================================================== + /// Defines the bbUserCreateWidget method +#define BBTK_CREATE_WIDGET(CALLBACK) \ + public: \ + inline void bbUserCreateWidget(Widget* parent) \ + { \ + bbtkDebugMessageInc("kw",1,"**> Creating widget for [" \ + < Showing [" \ + <()); + // BBTK_DESCRIPTION("Widget box. The inputs marked with (*) are only used if the widget is not inserted in another widget.\n"); + BBTK_CATEGORY("widget"); + BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinTitle, + "Title of the window (*)", + std::string); + BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinWidth, + "Width of the window (* : only used if the widget is not connected to a Layout box)",int); + BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinHeight, + "Height of the window (*)",int); + BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinDialog, + "Set to 'true' to create a dialog window, i.e. which blocks the pipeline until it is closed (modal) (*)",bool); + BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinHide, + "Any signal received hides the window (*)",Void); + BBTK_TEMPLATE_INPUT(WidgetBlackBox,WinClose, + "Any signal received closes the window (*)",Void); + typedef typename WidgetBlackBox::WidgetPointer WidgetPointer; + BBTK_TEMPLATE_OUTPUT(WidgetBlackBox,Widget,"Output widget",WidgetPointer); + BBTK_END_DESCRIBE_BLACK_BOX(WidgetBlackBox); + //================================================================= + + + + + + + + + +} //namespace bbtk + +// template code inclusion +#include "bbtkWidgetBlackBox.txx" + +// WidgetBlackBoxWindow interface + code inclusion +#include "bbtkWidgetBlackBoxWindow.h" + +#endif //__bbtkWidgetBlackBox_h__ diff --git a/kernel/src/bbtkWidgetBlackBox.txx b/kernel/src/bbtkWidgetBlackBox.txx new file mode 100644 index 0000000..7413e8c --- /dev/null +++ b/kernel/src/bbtkWidgetBlackBox.txx @@ -0,0 +1,278 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbtkWidgetBlackBox.txx,v $ + Language: C++ + Date: $Date: 2009/04/08 07:56:11 $ + Version: $Revision: 1.1 $ +=========================================================================*/ + +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* 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. +* ------------------------------------------------------------------------ */ +/** + * \file + * \brief + */ + + + +#include "bbtkWidgetBlackBoxWindow.h" +#include "bbtkBlackBoxOutputConnector.h" + + +namespace bbtk +{ + + //========================================================================= + // WidgetBlackBox + //========================================================================= + + //========================================================================= + //========================================================================= + //========================================================================= + //========================================================================= + BBTK_BLACK_BOX_TEMPLATE_IMPLEMENTATION(WidgetBlackBox,AtomicBlackBox); + //========================================================================= + +//========================================================================= + template + void WidgetBlackBox::bbUserConstructor() + { + bbtkDebugMessage("widget",9,"WidgetBlackBox::bbUserConstructor()"< + void WidgetBlackBox::bbUserCopyConstructor(bbtk::BlackBox::Pointer) + { + bbtkDebugMessage("widget",9,"WidgetBlackBox::bbUserCopyConstructor()" + < + void WidgetBlackBox::bbUserDestructor() + { + bbtkDebugMessage("widget",9,"==> WidgetBlackBox::bbUserDestructor() ["<bbClose(); + bbSetWindow(0); + } + bbtkDebugMessage("widget",9,"<== WidgetBlackBox::bbUserDestructor() ["< + void WidgetBlackBox::bbInitAttributes() + { + bbmWindow = 0; + bbSetInputWinTitle(bbGetName()); + bbSetInputWinWidth(800); + bbSetInputWinHeight(800); + bbSetInputWinDialog(false); + bbSetOutputWidget(0); + } + //========================================================================= + + + //========================================================================= + template + void WidgetBlackBox::bbProcess() + { + // TODO : update the window size and title + this->bbUserProcess(); + } + //========================================================================= + + //========================================================================= + template + void WidgetBlackBox::bbCreateWindow() + { + + + // If output 'Widget' not connected then + // it is a top level Widget have to create and show the Window + if ( ! bbIsOutputWidgetConnected() ) + { + // create the Window if does not exist + if ( bbGetWindow() == 0) + { + bbtkDebugMessage("widget",2, + "-> Creating the window" + <InitWindowManagerIfNeeded(); + // If is a Dialog requested + if ( bbGetInputWinDialog() ) + { + bbtkDebugMessage("process",2, + " Input WinDialog set to true : creating a Dialog" + <bbCreateDialogWindow(); + } + // Input WinDialog set to false : creating a Frame + else + { + bbtkDebugMessage("process",2, + " Input WinDialog set to false : creating a Frame" + <bbCreateFrameWindow(); + } + } + // Show the window + if ( !bbGetWindow() ) + { + bbtkInternalError("Need to show the Window of widget "< Showing the window" + <bbShow(); + } + // + } + //========================================================================= + + + //================================================================== + template + typename WidgetBlackBox::WidgetPointer + WidgetBlackBox::bbCreateWidgetOfInput + (const std::string& in, WidgetBlackBox::WidgetPointer parent) + { + Widget* 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 WidgetBlackBox + typename WidgetBlackBox::Pointer wfrom + = boost::dynamic_pointer_cast >(from); + // Call bbCreateWidget + wfrom->bbUserCreateWidget(parent); + // Get the widget created + w = wfrom->bbGetOutputWidget(); + } + return w; + } + //================================================================== + + //========================================================================= + template + bool WidgetBlackBox::bbIsOutputWidgetConnected() + { + return ((*bbGetOutputConnectorMap().find("Widget")).second->GetConnectionVector().size() != 0 ); + } + //================================================================== + + //================================================================== + template + void WidgetBlackBox::bbShowWindow() + { + bbtkDebugMessageInc("widget",1,"=> WidgetBlackBox::bbShowWindow() [" + <bbShow(); + + bbtkDebugMessageDec("widget",2,"<= WidgetBlackBox::bbShowWindow() [" + < + void WidgetBlackBox::bbHideWindow() + { + bbtkDebugMessageInc("widget",1,"=> WidgetBlackBox::bbHideWindow() [" + <bbHide(); + + bbtkDebugMessageDec("widget",2,"<= WidgetBlackBox::bbHideWindow() [" + < + void WidgetBlackBox::bbCloseWindow() + { + bbtkDebugMessageInc("widget",1,"=> WidgetBlackBox::bbCloseWindow() [" + <bbClose(); + + bbtkDebugMessageDec("widget",2,"<= WidgetBlackBox::bbCloseWindow() [" + < + typename WidgetBlackBox::Window* + WidgetBlackBox::bbGetContainingWindow() + { + if (bbGetWindow()!=0) return bbGetWindow(); + BlackBox::OutputConnectorMapType::const_iterator i + = bbGetOutputConnectorMap().find("Widget"); + if ( i->second->GetConnectionVector().size() != 0 ) + { + return boost::static_pointer_cast + (i->second->GetConnectionVector().front() //.lock() + ->GetBlackBoxTo())->bbGetContainingWindow(); + } + return 0; + } + //================================================================== + + + //================================================================== + template + bool WidgetBlackBox::bbIsShown() + { + if (bbGetContainingWindow()!=0) + return bbGetContainingWindow()->bbIsShown(); + return false; + } + //================================================================== + + +}//namespace bbtk + + + + diff --git a/kernel/src/bbtkWidgetBlackBoxWindow.h b/kernel/src/bbtkWidgetBlackBoxWindow.h new file mode 100644 index 0000000..5fea07c --- /dev/null +++ b/kernel/src/bbtkWidgetBlackBoxWindow.h @@ -0,0 +1,90 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbtkWidgetBlackBoxWindow.h,v $ + Language: C++ + Date: $Date: 2009/04/08 07:56:11 $ + Version: $Revision: 1.1 $ +========================================================================*/ + + +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* 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. +* ------------------------------------------------------------------------ */ +/** + * \brief Short description in one line + * + * Long description which + * can span multiple lines + */ +/** + * \file + * \brief + */ +/** + * \class bbtk:: + * \brief + */ + + + +#ifndef __bbtkWidgetBlackBoxWindow_h__ +#define __bbtkWidgetBlackBoxWindow_h__ + + +#include "bbtkWidgetBlackBox.h" + +namespace bbtk +{ + + + //================================================================== + // The base of the hierarchy of windows associated to a WidgetBlackBox + template + class BBTK_EXPORT WidgetBlackBoxWindow + { + public: + typedef typename WidgetBlackBox::Pointer WidgetBlackBoxPointer; + typedef typename WidgetBlackBox::WeakPointer WidgetBlackBoxWeakPointer; + + WidgetBlackBoxWindow(WidgetBlackBoxPointer box); + virtual ~WidgetBlackBoxWindow(); + virtual void bbShow(); + virtual void bbHide(); + virtual void bbClose(); + bool bbIsShown() { return mShown; } + virtual WidgetBlackBoxPointer bbGetBlackBox() { return mBox.lock(); } + //virtual wxDialog* bbGetDialog() { return 0; } + //virtual wxFrame* bbGetFrame() { return 0; } + virtual bool bbIsDialog() { return false; } + virtual bool bbIsFrame() { return false; } + private: + WidgetBlackBoxWeakPointer mBox; + bool mShown; + }; + //================================================================== + + +} //namespace bbtk + +#include "bbtkWidgetBlackBoxWindow.txx" + +#endif //__bbtkWidgetBlackBoxWindow_h__ + diff --git a/kernel/src/bbtkWidgetBlackBoxWindow.txx b/kernel/src/bbtkWidgetBlackBoxWindow.txx new file mode 100644 index 0000000..2c7c266 --- /dev/null +++ b/kernel/src/bbtkWidgetBlackBoxWindow.txx @@ -0,0 +1,118 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbtkWidgetBlackBoxWindow.txx,v $ + Language: C++ + Date: $Date: 2009/04/08 07:56:11 $ + Version: $Revision: 1.1 $ +=========================================================================*/ + +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* 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. +* ------------------------------------------------------------------------ */ + +/** + * \file + * \brief + */ + + +namespace bbtk +{ + + + + + //========================================================================= + // WidgetBlackBoxWindow + //========================================================================= + + + + //========================================================================= + template + WidgetBlackBoxWindow::WidgetBlackBoxWindow + (typename WidgetBlackBox::Pointer box) + : mBox(box), mShown(false) + { + bbtkDebugMessage("widget",9,"WidgetBlackBoxWindow::WidgetBlackBoxWindow(" + <bbGetName()<<")"<bbSetWindow(this); + mBox.lock()->IncNbWindowsAlive(); + } + //========================================================================= + + //========================================================================= + template + WidgetBlackBoxWindow::~WidgetBlackBoxWindow() + { + bbtkDebugMessage("widget",9, + "WidgetBlackBoxWindow::~WidgetBlackBoxWindow() " + <DecNbWindowsAlive(); + if (!mBox.expired()) + { + mBox.lock()->bbSetWindow(0); + } + } + //========================================================================= + + + //========================================================================= + template + void WidgetBlackBoxWindow::bbShow() + { + if (bbIsShown()) return; + bbtkDebugMessage("widget",9,"WidgetBlackBoxWindow::bbShow() [" + <bbGetName()<<"]"<IncNbWindowsShown(); + mShown = true; + if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnShow(); + } + //========================================================================= + + //========================================================================= + template + void WidgetBlackBoxWindow::bbHide() + { + if (!bbIsShown()) return; + bbtkDebugMessage("widget",9,"WidgetBlackBoxWindow::bbHide() [" + <bbGetName()<<"]"<DecNbWindowsShown(); + mShown = false; + } + //========================================================================= + + //========================================================================= + template + void WidgetBlackBoxWindow::bbClose() + { + bbtkDebugMessage("widget",9,"WidgetBlackBoxWindow::bbClose() [" + <bbGetName()<<"]"<bbGetFullName()<<")"<bbSetWindow(this); - Wx::IncNbWindowsAlive(); - } - //========================================================================= - - //========================================================================= - WxBlackBoxWindow::~WxBlackBoxWindow() - { - bbtkDebugMessage("wx",9,"WxBlackBoxWindow::~WxBlackBoxWindow() " - <bbSetWindow(0); - } - } - //========================================================================= - - - //========================================================================= - void WxBlackBoxWindow::bbShow() - { - if (bbIsShown()) return; - bbtkDebugMessage("wx",9,"WxBlackBoxWindow::bbShow()"<bbUserOnShow(); - } - //========================================================================= - - //========================================================================= - void WxBlackBoxWindow::bbHide() - { - if (!bbIsShown()) return; - bbtkDebugMessage("wx",9,"WxBlackBoxWindow::bbHide()"<bbGetFullName()<<","<bbCreateWidgetAndEventHandler(this); + // Create the widget + box->bbCreateWidgetAndEventHandler(this); wxWindow* widget = bbGetBlackBox()->bbGetOutputWidget(); -// old : widget->Reparent(this); sizer->Add( widget, 1, wxALL|wxEXPAND, 2); //SetAutoLayout(true); SetSizer(sizer); @@ -162,8 +102,8 @@ namespace bbtk if (bbIsShown()) return; bbtkDebugMessage("wx",5,"WxBlackBoxDialog::bbShow() [" <bbGetFullName()<<"]"<bbGetFullName()<<","<bbCreateWidgetAndEventHandler(this); + box->bbCreateWidgetAndEventHandler(this); wxWindow* widget = bbGetBlackBox()->bbGetOutputWidget(); wxFrame* frame = (wxFrame*)this; -// old : widget->Reparent(frame); sizer->Add( widget, 1, wxALL|wxGROW, 2); // frame->SetAutoLayout(true); frame->SetSizer(sizer); @@ -249,7 +187,7 @@ namespace bbtk if (bbIsShown()) return; bbtkDebugMessage("wx",5,"WxBlackBoxFrame::bbShow(" <bbGetFullName()<<")"<bbUserOnHide(); } @@ -350,7 +288,7 @@ namespace bbtk //========================================================================= //========================================================================= //========================================================================= - BBTK_BLACK_BOX_IMPLEMENTATION(WxBlackBox,AtomicBlackBox); + BBTK_BLACK_BOX_IMPLEMENTATION(WxBlackBox,WidgetBlackBox); //========================================================================= //========================================================================= @@ -371,186 +309,47 @@ namespace bbtk //========================================================================= - //========================================================================= - void WxBlackBox::bbUserDestructor() - { - bbtkDebugMessage("wx",9,"==> WxBlackBox::bbUserDestructor() ["<(), + Wx::GetTopWindow(), + std2wx( bbGetInputWinTitle() + + " - bbtk (c) CREATIS LRMN"), + wxSize( bbGetInputWinWidth() , + bbGetInputWinHeight() )); + w->Show(true); + } + //================================================================== - //========================================================================= - void WxBlackBox::bbCreateWidget() - { - // If output widget not connected : have to create and show the window - 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" - <(), - Wx::GetTopWindow(), - std2wx( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN"), - wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() )); - //bbGetInputWinWidth() , bbGetInputWinHeight() ) ); -// show->bbGetDialog()->Update(); -// show->bbGetDialog()->Refresh(); - - //show->bbGetDialog()->Iconize(true); - show->bbGetDialog()->Show(true); -// show->bbGetDialog()->Show(false); -// show->bbGetDialog()->SetSize(wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() )); - - } - // Input WinDialog set to false : creating a Frame - else - { - bbtkDebugMessage("process",2, - " Input WinDialog set to false : creating a Frame" - <(), - Wx::GetTopWindow(), - std2wx( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN"), - wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) ); -// show->bbGetFrame()->Update(); -// show->bbGetFrame()->Refresh(); - show->bbGetFrame()->Show(); - } - - } // else bbGetWindow -// show->bbShow(); - - } // bbGetOutputConnectorMap().find("Widget")).second->GetConnectionVector().size() - } - //========================================================================= - - - //========================================================================= - void WxBlackBox::bbShowWidget() - { - // Show the window - Window *show = bbGetWindow(); - if (show!=NULL) - { - show->bbShow(); - } - } - //========================================================================= - - - //========================================================================= - void WxBlackBox::bbProcess() - { - // TODO : update the window size and title - this->bbUserProcess(); - } - //========================================================================= - - /* EED BORRAME original 18 mars 2009 - //========================================================================= - void WxBlackBox::bbProcess() - { - // If output widget not connected : have to create and show the window - 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" - <(), - 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" - <(), - Wx::GetTopWindow(), - std2wx( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN"), - wxSize( bbGetInputWinWidth() , bbGetInputWinHeight() ) ); - } - - } - - // Show the window - show->bbShow(); - - - } - this->bbUserProcess(); - + //================================================================== + /// Callback for creating a Frame window + void WxBlackBox::bbCreateFrameWindow() + { + WxBlackBoxFrame* w = 0; + w = new WxBlackBoxFrame( GetThisPointer(), + Wx::GetTopWindow(), + std2wx( bbGetInputWinTitle() + + " - bbtk (c) CREATIS LRMN"), + wxSize( bbGetInputWinWidth() , + bbGetInputWinHeight() ) ); + w->Show(); } - //========================================================================= -*/ - + //================================================================== + + + //========================================================================= void WxBlackBox::bbCreateWidgetAndEventHandler(wxWindow* parent) @@ -559,7 +358,8 @@ namespace bbtk { this->bbUserCreateWidget(parent); } - // If Event Handler for the widget does not exist or is obsolete : create it + // If Event Handler for the widget does not exist or is obsolete: + // create it if (bbGetOutputWidget()!=0) { if (bbGetWidgetEventHandler()==0) @@ -589,83 +389,19 @@ namespace bbtk //========================================================================= - //========================================================================= - 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; - } - //================================================================== - - - //================================================================== - void WxBlackBox::bbHideWindow() - { - bbtkDebugMessageInc("wx",1,"=> WxBlackBox::bbHideWindow() [" - <bbHide(); - - bbtkDebugMessageDec("wx",2,"<= WxBlackBox::bbHideWindow() [" - < WxBlackBox::bbCloseWindow() [" - <bbClose(); - - bbtkDebugMessageDec("wx",2,"<= WxBlackBox::bbCloseWindow() [" - <second->GetConnectionVector().size() != 0 ) - { - return boost::static_pointer_cast - (i->second->GetConnectionVector().front() //.lock() - ->GetBlackBoxTo())->bbGetContainingWindow(); - } - return 0; - } - //================================================================== - - - //================================================================== - bool WxBlackBox::bbIsShown() - { - if (bbGetContainingWindow()!=0) - return bbGetContainingWindow()->bbIsShown(); - return false; - } + // void WxBlackBox::InitWindowManagerIfNeeded() { Wx:: + void WxBlackBox::IncNbWindowsAlive() { Wx::IncNbWindowsAlive(); } + void WxBlackBox::DecNbWindowsAlive() { Wx::DecNbWindowsAlive(); } + int WxBlackBox::GetNbWindowsAlive() { return Wx::GetNbWindowsAlive(); } + bool WxBlackBox::IsSomeWindowAlive() { return Wx::IsSomeWindowAlive(); } + + void WxBlackBox::IncNbWindowsShown() { Wx::IncNbWindowsShown(); } + void WxBlackBox::DecNbWindowsShown() { Wx::DecNbWindowsShown(); } + int WxBlackBox::GetNbWindowsShown() { return Wx::GetNbWindowsShown(); } + bool WxBlackBox::IsSomeWindowShown() { return Wx::GetNbWindowsShown(); } //================================================================== - + }//namespace bbtk diff --git a/kernel/src/bbtkWxBlackBox.h b/kernel/src/bbtkWxBlackBox.h index 0acfbf8..3684918 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: 2009/03/23 13:06:41 $ - Version: $Revision: 1.25 $ + Date: $Date: 2009/04/08 07:56:11 $ + Version: $Revision: 1.26 $ ========================================================================*/ @@ -52,7 +52,7 @@ #include "bbtkWx.h" -#include "bbtkAtomicBlackBox.h" +#include "bbtkWidgetBlackBox.h" namespace bbtk @@ -61,10 +61,6 @@ namespace bbtk - //================================================================== - // Forward declaration of the class of window associated to a WxBlackBox - class WxBlackBoxWindow; - //================================================================== //================================================================== // Forward declaration of the widget event handler class @@ -74,215 +70,80 @@ namespace bbtk //================================================================== /// Widget black boxes - class BBTK_EXPORT WxBlackBox : public bbtk::AtomicBlackBox + class BBTK_EXPORT WxBlackBox : public bbtk::WidgetBlackBox { - BBTK_BLACK_BOX_INTERFACE(WxBlackBox,bbtk::AtomicBlackBox); - 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*); - 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); - + BBTK_BLACK_BOX_INTERFACE(WxBlackBox,bbtk::WidgetBlackBox); - typedef WxBlackBoxWindow Window; + + // protected: - /// Returns the **OWN** window associated to the box - /// If 0 returned = no window - Window* bbGetWindow() { return bbmWindow; } - - /// Returns the window containing the widget associated to the box - /// Which can be the own window of **ANOTHER** box in case of - /// a hierarchy of widgets. - /// More precisely : - /// If bbGetWindow() != 0 then returns bbGetWindow() - /// Else if the output 'Widget' is connected - /// then returns bbGetContainingWindow() of the box connected to 'Widget' - /// Else returns 0; - Window* bbGetContainingWindow(); - - /// Returns true iff the 'containing window' exists and is shown - /// (see bbGetContainingWindow). - bool bbIsShown(); - - //================================================================== - /// User callback invoked when the containing window is shown - virtual void bbUserOnShow() {} - //================================================================== - - //================================================================== - /// User callback invoked when the containing window is hidden - virtual void bbUserOnHide() {} + public: + + //================================================================== + /// Callback for creating a Dialog window (modal) + /// ** Must be defined ** in toolkit specific descendants + virtual void bbCreateDialogWindow(); //================================================================== - //================================================================== - void bbCreateWidgetAndEventHandler(wxWindow* parent); + /// Callback for creating a Frame window + /// ** Must be defined ** in toolkit specific descendants + virtual void bbCreateFrameWindow(); //================================================================== - - protected: - - + //================================================================== /// User callback called in the box contructor virtual void bbUserConstructor(); /// User callback called in the box copy constructor virtual void bbUserCopyConstructor(bbtk::BlackBox::Pointer); - /// User callback called in the box destructor - virtual void bbUserDestructor(); //================================================================== - //================================================================== - /// User callback for creating the widget associated to the box - /// ** Must be defined ** - virtual void bbUserCreateWidget(wxWindow* parent) - { - bbtkError(bbGetTypeName()<<" is a WxBlackBox whose bbUserCreateWidget methods is not overloaded : is it a feature or a bug ?!?"); - } - //================================================================== + + //================================================================== + // virtual void InitWindowManagerIfNeeded(); + virtual void IncNbWindowsAlive(); + virtual void DecNbWindowsAlive(); + virtual int GetNbWindowsAlive(); + virtual bool IsSomeWindowAlive(); + + virtual void IncNbWindowsShown(); + virtual void DecNbWindowsShown(); + virtual int GetNbWindowsShown(); + virtual bool IsSomeWindowShown(); + //================================================================== + //================================================================== - // For layout widgets : creates and returns the widget - // of the box connected to input in - wxWindow* bbCreateWidgetOfInput(const std::string& in, wxWindow* parent); + void bbCreateWidgetAndEventHandler(wxWindow* parent); + //================================================================== + //================================================================== - - - - //================================================================== - /// Overloaded bbCreateWidget method for WxBlackBoxes which handles - /// the window creation if needed - virtual void bbCreateWidget(); - //================================================================== - - //================================================================== - /// Overloaded bbShowWidget method for WxBlackBoxes which handles - /// the window creation if needed - virtual void bbShowWidget(); - //================================================================== - - //================================================================== - /// Overloaded processing method for WxBlackBoxes which handles - /// the window creation if needed - virtual void bbProcess(); - //================================================================== - - - - - - //================================================================== - /// If necessary creates the WxBlackBoxWindow associated to the box - /// and shows it - /// (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(); - /// Hides the WxBlackBoxWindow associated to the box (if exists) - void bbHideWindow(); - /// Closes (destroys) the WxBlackBoxWindow associated to the box (if exists) - void bbCloseWindow(); - //================================================================== private: /// friendship - friend class WxBlackBoxWindow; friend class WxBlackBoxWidgetEventHandler; - - /// Sets the window - inline void bbSetWindow(Window* w) { bbmWindow=w; } - /// Sets the Widget Event Handler inline void bbSetWidgetEventHandler(WxBlackBoxWidgetEventHandler* w) { bbmWidgetEventHandler = w; } /// Gets the Widget Event Handler inline WxBlackBoxWidgetEventHandler* bbGetWidgetEventHandler() { return bbmWidgetEventHandler; } - - - /// The WxBlackBoxWindow associated to the box - Window* bbmWindow; - /// The WxBlackBoxWidgetEventHandler associated to the box WxBlackBoxWidgetEventHandler* bbmWidgetEventHandler; - - + /// Init the attributes void bbInitAttributes(); - - protected : - - - /// For Forward update mechanism when execution is called - /// 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; } - */ }; //================================================================= - //====================================================================== - /// Defines the bbUserCreateWidget method -#define BBTK_CREATE_WIDGET(CALLBACK) \ - public: \ - inline void bbUserCreateWidget(wxWindow* parent) \ - { \ - bbtkDebugMessageInc("wx",1,"**> Creating widget for [" \ - < Showing [" \ - < + BBTK_BEGIN_DESCRIBE_BLACK_BOX_BODY(WxBlackBox); BBTK_NAME("WxBlackBox"); - // BBTK_DESCRIPTION("Widget box. The inputs marked with (*) are only used if the widget is not inserted in another widget.\n"); - BBTK_CATEGORY("widget"); - BBTK_INPUT(WxBlackBox,WinTitle, - "Title of the window (*)", - std::string,""); - BBTK_INPUT(WxBlackBox,WinWidth, - "Width of the window (* : only used if the widget is not connected to a Layout box)",int,""); - BBTK_INPUT(WxBlackBox,WinHeight, - "Height of the window (*)",int,""); - BBTK_INPUT(WxBlackBox,WinDialog, - "Set to 'true' to create a dialog window, i.e. which blocks the pipeline until it is closed (modal) (*)",bool,""); - BBTK_INPUT(WxBlackBox,WinHide, - "Any signal received hides the window (*)",Void,"signal"); - BBTK_INPUT(WxBlackBox,WinClose, - "Any signal received closes the window (*)",Void,"signal"); - BBTK_OUTPUT(WxBlackBox,Widget,"Output widget",wxWindow*,""); BBTK_END_DESCRIBE_BLACK_BOX(WxBlackBox); //================================================================= @@ -294,52 +155,41 @@ namespace bbtk - //================================================================== - // The base of the hierarchy of windows associated to a WxBlackBox - class BBTK_EXPORT WxBlackBoxWindow //: public wxWindow - { - public: - WxBlackBoxWindow(WxBlackBox::Pointer box); - virtual ~WxBlackBoxWindow(); - virtual void bbShow(); - virtual void bbHide(); - virtual void bbClose(); - bool bbIsShown() { return mShown; } - virtual WxBlackBox::Pointer bbGetBlackBox() { return mBox.lock(); } - virtual wxDialog* bbGetDialog() { return 0; } - virtual wxFrame* bbGetFrame() { return 0; } - private: - WxBlackBox::WeakPointer mBox; - bool mShown; - }; - //================================================================== //================================================================== // Dialog window which is modal - class BBTK_EXPORT WxBlackBoxDialog : public wxDialog, public WxBlackBoxWindow + class BBTK_EXPORT WxBlackBoxDialog : public wxDialog, + public WidgetBlackBoxWindow { public: + typedef WidgetBlackBoxWindow Parent; WxBlackBoxDialog(WxBlackBox::Pointer box, wxWindow *parent, wxString title, wxSize size); ~WxBlackBoxDialog(); void bbShow(); void bbHide(); void bbClose(); + bool IsDialog() { return true; } + bool IsFrame() { return false; } wxDialog* bbGetDialog() { return this; } }; //================================================================== //================================================================== // Frame window which is not modal - class BBTK_EXPORT WxBlackBoxFrame : public wxFrame, public WxBlackBoxWindow + class BBTK_EXPORT WxBlackBoxFrame : public wxFrame, + public WidgetBlackBoxWindow { public: + typedef WidgetBlackBoxWindow Parent; WxBlackBoxFrame(WxBlackBox::Pointer box, wxWindow *parent, wxString title, wxSize size); ~WxBlackBoxFrame(); void bbShow(); void bbHide(); void bbClose(); + bool IsDialog() { return false; } + bool IsFrame() { return true; } wxFrame* bbGetFrame() { return this; } }; //================================================================== diff --git a/kernel/src/vtkKWBlackBoxDialog.h b/kernel/src/vtkKWBlackBoxDialog.h index 00588ff..03a2b07 100644 --- a/kernel/src/vtkKWBlackBoxDialog.h +++ b/kernel/src/vtkKWBlackBoxDialog.h @@ -11,8 +11,8 @@ typedef bbtk::KWBlackBox::Pointer BBPointer; typedef bbtk::KWBlackBox::WeakPointer BBWeakPointer; -class BBTK_EXPORT vtkKWBlackBoxDialog : public vtkKWDialog - //public vtkKWBlackBoxWindow +class BBTK_EXPORT vtkKWBlackBoxDialog : public vtkKWDialog, + public WidgetBlackBoxWindow { public: diff --git a/packages/CMakeLists.txt b/packages/CMakeLists.txt index c4d750e..211a1f8 100644 --- a/packages/CMakeLists.txt +++ b/packages/CMakeLists.txt @@ -17,6 +17,9 @@ IF(BBTK_USE_KWWIDGETS) SUBDIRS(kw) ENDIF(BBTK_USE_KWWIDGETS) +IF(BBTK_USE_QT) + SUBDIRS(qt) +ENDIF(BBTK_USE_QT) #----------------------------------------------------------------------------- diff --git a/packages/qt/CMakeLists.txt b/packages/qt/CMakeLists.txt new file mode 100644 index 0000000..f9f9d75 --- /dev/null +++ b/packages/qt/CMakeLists.txt @@ -0,0 +1,160 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +#=========================================================================== +# CMAKE SETTINGS FOR BUILDING A BBTK PACKAGE +#=========================================================================== + +#=========================================================================== +# THE NAME OF THE BBTK PACKAGE +SET(BBTK_PACKAGE_NAME qt) +#=========================================================================== + + + +#=========================================================================== +# IF IT IS A STANDALONE PROJECT UNCOMMENT NEXT LINE TO DECLARE YOUR PROJECT +# PROJECT(bb${BBTK_PACKAGE_NAME}) +#=========================================================================== + +#=========================================================================== +# PACKAGE AUTHOR +# !!! NO COMMA ALLOWED !!! +SET(${BBTK_PACKAGE_NAME}_AUTHOR "laurent.guigues@creatis.insa-lyon.fr") +#=========================================================================== + +#=========================================================================== +# PACKAGE DESCRIPTION +SET(${BBTK_PACKAGE_NAME}_DESCRIPTION "Qt boxes") +#=========================================================================== + +#=========================================================================== +# PACKAGE VERSION NUMBER +SET(${BBTK_PACKAGE_NAME}_MAJOR_VERSION 1) +SET(${BBTK_PACKAGE_NAME}_MINOR_VERSION 0) +SET(${BBTK_PACKAGE_NAME}_BUILD_VERSION 0) +#=========================================================================== + + +#=========================================================================== +# UNCOMMENT EACH LIBRARY NEEDED (WILL BE FOUND AND USED AUTOMATICALLY) +# SET(${BBTK_PACKAGE_NAME}_USE_VTK ON) +SET(${BBTK_PACKAGE_NAME}_USE_QT ON) +# SET(${BBTK_PACKAGE_NAME}_USE_ITK ON) +# SET(${BBTK_PACKAGE_NAME}_USE_GDCM ON) +# SET(${BBTK_PACKAGE_NAME}_USE_GDCM_VTK ON) +# SET(${BBTK_PACKAGE_NAME}_USE_GSMIS ON) +# SET(${BBTK_PACKAGE_NAME}_USE_WXWIDGETS ON) +# SET(${BBTK_PACKAGE_NAME}_USE_KWWIDGETS ON) +#=========================================================================== + +#=========================================================================== +# LIST HERE THE OTHER bbtk PACKAGES NEEDED +# (WILL BE FOUND AND USED AUTOMATICALLY) +SET(${BBTK_PACKAGE_NAME}_USE_PACKAGES + # std + # wx + # itk + # vtk + # ... + ) +#=========================================================================== + +#=========================================================================== +# THE SOURCES OF THE PACKAGE +# EITHER UNCOMMENT NEXT LINE TO COMPILE ALL .cxx OF THE src DIRECTORY : +SET(${BBTK_PACKAGE_NAME}_COMPILE_ALL_CXX OFF) +# ... OR LIST THE FILES TO COMPILE MANUALLY : +SET(${BBTK_PACKAGE_NAME}_CXX_SOURCES +# LIST HERE THE FILES TO COMPILE TO BUILD THE LIB +# E.G. TO COMPILE "toto.cxx" ADD "toto" (NO EXTENSION) +# THE PATH MUST BE RELATIVE TO THE src FOLDER +bbqtQOutputText +bbqtQSlider +bbqtQLayoutLine + ) +#=========================================================================== + +#=========================================================================== +# THE xml SOURCES OF THE PACKAGE +# EITHER UNCOMMENT NEXT LINE TO bbfy ALL .xml OF THE src DIRECTORY : +SET(${BBTK_PACKAGE_NAME}_COMPILE_ALL_XML ON) +# ... OR LIST THE FILES TO COMPILE MANUALLY : +#SET(${BBTK_PACKAGE_NAME}_XML_SOURCES +# LIST HERE THE FILES TO bbfy TO BUILD THE LIB +# E.G. TO bbfy "toto.xml" ADD "toto" (NO EXTENSION) +# THE PATH MUST BE RELATIVE TO THE src FOLDER +# ) +#=========================================================================== + +#=========================================================================== +# THE SCRIPT-DEFINED BOXES OF THE PACKAGE (bbs) +# EITHER UNCOMMENT NEXT LINE TO INCLUDE ALL .bbs OF THE bbs/boxes DIRECTORY : +SET(${BBTK_PACKAGE_NAME}_INCLUDE_ALL_BBS_BOXES ON) +# ... OR LIST THE FILES TO INCLUDE MANUALLY : +# SET(${BBTK_PACKAGE_NAME}_BBS_BOXES +# LIST HERE THE bbs FILES TO INCLUDE +# E.G. TO INCLUDE "boxes/bbtoto.bbs" ADD "boxes/bbtoto" (NO EXTENSION) +# !! THE PATH MUST BE RELATIVE TO THE bbs FOLDER !! +#) +#=========================================================================== + +#=========================================================================== +# THE SCRIPT-DEFINED APPLICATIONS OF THE PACKAGE (bbs) +# EITHER UNCOMMENT NEXT LINE TO INCLUDE ALL .bbs OF THE bbs/appli DIRECTORY : +SET(${BBTK_PACKAGE_NAME}_INCLUDE_ALL_BBS_APPLI ON) +# ... OR LIST THE FILES TO INCLUDE MANUALLY : +# SET(${BBTK_PACKAGE_NAME}_BBS_APPLI +# LIST HERE THE bbs FILES TO INCLUDE +# E.G. TO INCLUDE "appli/testToto.bbs" ADD "appli/testToto" (NO EXTENSION) +# !! THE PATH MUST BE RELATIVE TO THE bbs FOLDER !! +#) +#=========================================================================== + +#=========================================================================== +SET(${BBTK_PACKAGE_NAME}_INCLUDE_DIRS + # LIST HERE YOUR ADDITIONAL INCLUDE DIRECTORIES + # EXCEPT : + # - src + # - bbtk dirs + # - automatically handled libraries or packages : wx, vtk... (see above) + # - the dirs automatically set by other libraries found by FIND_PACKAGE + ) +#=========================================================================== + +#=========================================================================== +SET(${BBTK_PACKAGE_NAME}_LIBS + # LIST HERE THE ADDITIONAL LIBS TO LINK AGAINST + # EXCEPT : the same libs than for INCLUDE_DIRS + ) +#=========================================================================== + + +#=========================================================================== +# IF NEEDED : UNCOMMENT NEXT LINE +# AND LIST ADDITIONNAL DIRECTORIES +# IN WHICH TO LOOK FOR LIBRARIES TO LINK AGAINST +# LINK_DIRECTORIES() +#=========================================================================== + +#=========================================================================== +# SET TO TRUE TO HAVE INFORMATION ON LIBRARIES FOUND DURING CMAKE CONFIGURE +SET(FIND_PACKAGE_VERBOSE TRUE) +#=========================================================================== + +#=========================================================================== +# END OF USER SECTION +#=========================================================================== + + + + + +#=========================================================================== +# Include configuration script +INCLUDE(Configure.cmake) +#=========================================================================== + +#=========================================================================== +# EOF +#=========================================================================== + diff --git a/packages/qt/Configure.cmake b/packages/qt/Configure.cmake new file mode 100644 index 0000000..58c09d5 --- /dev/null +++ b/packages/qt/Configure.cmake @@ -0,0 +1,35 @@ +#=========================================================================== +# DOES THE USER WANT TO BUILD THE PACKAGE ? +OPTION(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME} + "Build the bbtk package ${BBTK_PACKAGE_NAME} ?" OFF) +#=========================================================================== + +IF(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME}) + #=========================================================================== + # THE USER HAS CHOSEN TO BUILD THE PACKAGE + #=========================================================================== + + #=========================================================================== + # If the package is not a "core" bbtk package (included into the toolkit) + # then we have to find and use bbtk + IF(NOT BBTK_CORE_PACKAGE) + FIND_PACKAGE(BBTK REQUIRED) + INCLUDE(${BBTK_USE_FILE}) + ENDIF(NOT BBTK_CORE_PACKAGE) + #=========================================================================== + + #=========================================================================== + # Include package configuration cmake script from bbtk cmake dir + INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage.cmake) + #=========================================================================== + +ELSE(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME}) + + #=========================================================================== + # Else if it is a core package we have to reset some things... + IF(BBTK_CORE_PACKAGE) + INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_BuildOff.cmake) + ENDIF(BBTK_CORE_PACKAGE) + #=========================================================================== + +ENDIF(BUILD_BBTK_PACKAGE_${BBTK_PACKAGE_NAME}) diff --git a/packages/qt/PackageConfig.cmake.in b/packages/qt/PackageConfig.cmake.in new file mode 100644 index 0000000..0ade94b --- /dev/null +++ b/packages/qt/PackageConfig.cmake.in @@ -0,0 +1,27 @@ +#======================================================================== +# BBTK package configuration +# ** DO NOT REMOVE ** +SET(BBTK_PACKAGE_NAME @BBTK_PACKAGE_NAME@) +SET(@BBTK_PACKAGE_NAME@_USE_VTK @BBTK_PACKAGE_USE_VTK@) +SET(@BBTK_PACKAGE_NAME@_USE_ITK @BBTK_PACKAGE_USE_ITK@) +SET(@BBTK_PACKAGE_NAME@_USE_GDCM @BBTK_PACKAGE_USE_GDCM@) +SET(@BBTK_PACKAGE_NAME@_USE_GSMIS @BBTK_PACKAGE_USE_GSMIS@) +SET(@BBTK_PACKAGE_NAME@_USE_WXWIDGETS @BBTK_PACKAGE_USE_WXWIDGETS@) +SET(@BBTK_PACKAGE_NAME@_USE_PACKAGES @BBTK_PACKAGE_USE_PACKAGES@) +SET(@BBTK_PACKAGE_NAME@_AUTHOR "@BBTK_PACKAGE_AUTHOR@") +SET(@BBTK_PACKAGE_NAME@_DESCRIPTION "@BBTK_PACKAGE_DESCRIPTION@") +SET(@BBTK_PACKAGE_NAME@_MAJOR_VERSION @BBTK_PACKAGE_MAJOR_VERSION@) +SET(@BBTK_PACKAGE_NAME@_MINOR_VERSION @BBTK_PACKAGE_MINOR_VERSION@) +SET(@BBTK_PACKAGE_NAME@_BUILD_VERSION @BBTK_PACKAGE_BUILD_VERSION@) +SET(@BBTK_PACKAGE_NAME@_INCLUDE_DIRS @BBTK_PACKAGE_INCLUDE_DIRS@) +SET(@BBTK_PACKAGE_NAME@_LIBS @BBTK_PACKAGE_LIBS@) +# A BBTK PACKAGE NEEDS BBTK +FIND_PACKAGE(BBTK REQUIRED) +# BBTK Package configuration file inclusion +INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_PackageConfig.cmake) +# End of BBTK package configuration +#======================================================================== + +#======================================================================== +# INSERT YOUR CUSTOM CONFIG HERE +#======================================================================== diff --git a/packages/qt/UsePackage.cmake.in b/packages/qt/UsePackage.cmake.in new file mode 100644 index 0000000..2ecb206 --- /dev/null +++ b/packages/qt/UsePackage.cmake.in @@ -0,0 +1,4 @@ +# DO NOT REMOVE : +INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_UsePackage.cmake) + +# INSERT YOUR CUSTOM USE HERE diff --git a/packages/qt/bbs/CMakeLists.txt b/packages/qt/bbs/CMakeLists.txt new file mode 100644 index 0000000..2c0eb7c --- /dev/null +++ b/packages/qt/bbs/CMakeLists.txt @@ -0,0 +1,4 @@ + +INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_bbs.cmake) + + diff --git a/packages/qt/data/CMakeLists.txt b/packages/qt/data/CMakeLists.txt new file mode 100644 index 0000000..eb2556d --- /dev/null +++ b/packages/qt/data/CMakeLists.txt @@ -0,0 +1,4 @@ +#=========================================================================== +# Include package data configuration cmake script from bbtk dir +INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_data.cmake) +#=========================================================================== diff --git a/packages/qt/doc/CMakeLists.txt b/packages/qt/doc/CMakeLists.txt new file mode 100644 index 0000000..033496e --- /dev/null +++ b/packages/qt/doc/CMakeLists.txt @@ -0,0 +1,5 @@ +#=========================================================================== +# Include package doc configuration cmake script +INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_doc.cmake) +#=========================================================================== + diff --git a/packages/qt/doc/bbdoc/CMakeLists.txt b/packages/qt/doc/bbdoc/CMakeLists.txt new file mode 100644 index 0000000..86ca574 --- /dev/null +++ b/packages/qt/doc/bbdoc/CMakeLists.txt @@ -0,0 +1,2 @@ +INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_doc_bbdoc.cmake) + diff --git a/packages/qt/doc/bbdoc/header.html.in b/packages/qt/doc/bbdoc/header.html.in new file mode 100644 index 0000000..28c72c2 --- /dev/null +++ b/packages/qt/doc/bbdoc/header.html.in @@ -0,0 +1,12 @@ + +

bbtk package @BBTK_PACKAGE_NAME@

+ +

+Version @BBTK_PACKAGE_MAJOR_VERSION@.@BBTK_PACKAGE_MINOR_VERSION@.@BBTK_PACKAGE_BUILD_VERSION@ - +by @BBTK_PACKAGE_AUTHOR@ + +

+@BBTK_PACKAGE_DESCRIPTION@ + +

+ Doxygen documentation of the source code diff --git a/packages/qt/doc/doxygen/CMakeLists.txt b/packages/qt/doc/doxygen/CMakeLists.txt new file mode 100644 index 0000000..0194111 --- /dev/null +++ b/packages/qt/doc/doxygen/CMakeLists.txt @@ -0,0 +1 @@ +INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_doc_doxygen.cmake) diff --git a/packages/qt/doc/doxygen/DoxyMainPage.txt.in b/packages/qt/doc/doxygen/DoxyMainPage.txt.in new file mode 100644 index 0000000..9909a5c --- /dev/null +++ b/packages/qt/doc/doxygen/DoxyMainPage.txt.in @@ -0,0 +1,14 @@ +/** + * \mainpage bbtk package @BBTK_PACKAGE_NAME@ + +\htmlonly + +

Version +@BBTK_PACKAGE_MAJOR_VERSION@.@BBTK_PACKAGE_MINOR_VERSION@.@BBTK_PACKAGE_BUILD_VERSION@ - +by @BBTK_PACKAGE_AUTHOR@ +

+@BBTK_PACKAGE_DESCRIPTION@ + +\endhtmlonly + + */ diff --git a/packages/qt/doc/doxygen/Doxyfile.txt.in b/packages/qt/doc/doxygen/Doxyfile.txt.in new file mode 100644 index 0000000..6b4211a --- /dev/null +++ b/packages/qt/doc/doxygen/Doxyfile.txt.in @@ -0,0 +1,764 @@ +# Doxyfile 1.2.14 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. +PROJECT_NAME = @DOXYGEN_PROJECT_NAME@ + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. +PROJECT_NUMBER = @PROJECT_VERSION@ + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. +OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT@ + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French, +# German, Greek, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, +# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish. +OUTPUT_LANGUAGE = English + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. +EXTRACT_LOCAL_CLASSES = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these class will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. +HIDE_UNDOC_CLASSES = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +REPEAT_BRIEF = YES + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited +# members of a class in the documentation of that class as if those members were +# ordinary class members. Constructors, destructors and assignment operators of +# the base classes will not be shown. +INLINE_INHERITED_MEMB = YES + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. It is allowed to use relative paths in the argument list. +STRIP_FROM_PATH = + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. +INTERNAL_DOCS = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. +STRIP_CODE_COMMENTS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower case letters. If set to YES upper case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# users are adviced to set this option to NO. +CASE_SENSE_NAMES = YES + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. +SHORT_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. +HIDE_SCOPE_NAMES = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. +VERBATIM_HEADERS = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put list of the files that are included by a file in the documentation +# of that file. +SHOW_INCLUDE_FILES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explict @brief command for a brief description. +JAVADOC_AUTOBRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# reimplements. +INHERIT_DOCS = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. +SORT_MEMBER_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +DISTRIBUTE_GROUP_DOC = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. +TAB_SIZE = 8 + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. +GENERATE_BUGLIST = YES + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. +ALIASES = + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consist of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. +MAX_INITIALIZER_LINES = 30 + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. +# For instance some of the names that are used will be different. The list +# of all members will be omitted, etc. +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. +SHOW_USED_FILES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, then doxygen will generate warnings +# for error documented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. +WARN_IF_DOC_ERROR = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. +WARN_LOGFILE = @DOXYGEN_LOGFILE@ + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. +INPUT = @DOXYGEN_INPUT@ + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp +# *.h++ *.idl *.odl +FILE_PATTERNS = *.h *.cxx *.txx + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +EXCLUDE = @DOXYGEN_EXCLUDE@ + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories +# that are symbolic links (a Unix filesystem feature) are excluded from the input. +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. +EXAMPLE_PATTERNS = *.cxx + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +INPUT_FILTER = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse. +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. +INLINE_SOURCES = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. +REFERENCES_RELATION = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) +COLS_IN_ALPHA_INDEX = 3 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. +HTML_OUTPUT = @DOXYGEN_HTML_OUTPUT@ + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the Html help documentation and to the tree view. +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+, +# or Internet explorer 4.0+). Note that for large projects the tree generation +# can take a very long time. In such cases it is better to disable this feature. +# Windows users are probably better off using the HTML help feature. +GENERATE_TREEVIEW = YES + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. +LATEX_OUTPUT = latex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimised for Word 97 and may not look very pretty with +# other RTF readers or editors. +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assigments. You only have to provide +# replacements, missing definitions are set to their default value. +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. +GENERATE_XML = NO + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. +PREDEFINED = @DOXYGEN_DOC_PREDEFINED@ + + +# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line and do not end with a semicolon. Such function macros are typically +# used for boiler-plate code, and will confuse the parser if not removed. +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES tag can be used to specify one or more tagfiles. +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. Note that this +# option is superceded by the HAVE_DOT option below. This is only a fallback. It is +# recommended to install and use dot, since it yield more powerful graphs. +CLASS_DIAGRAMS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) +HAVE_DOT = @DOXYGEN_HAVE_DOT@ + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. +COLLABORATION_GRAPH = YES + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. +TEMPLATE_RELATIONS = YES + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. +HIDE_UNDOC_RELATIONS = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. +INCLUDED_BY_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. +GRAPHICAL_HIERARCHY = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are gif, jpg, and png +# If left blank gif will be used. +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. +DOT_PATH = "@DOXYGEN_DOT_PATH@" + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. +MAX_DOT_GRAPH_HEIGHT = 1024 + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermedate dot files that are used to generate +# the various graphs. +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. +SEARCHENGINE = NO diff --git a/packages/qt/src/CMakeLists.txt b/packages/qt/src/CMakeLists.txt new file mode 100644 index 0000000..b056f60 --- /dev/null +++ b/packages/qt/src/CMakeLists.txt @@ -0,0 +1,23 @@ +#--------------------------------------------------------------------------- +# MOC +SET(QT4_HEADERS_TO_WRAP + bbqtQSlider.h + ) +QT4_WRAP_CPP(MOC_SOURCES ${QT4_HEADERS_TO_WRAP}) +#--------------------------------------------------------------------------- +# UI +#QT4_WRAP_UI(UI_SOURCES +# bbtkQtBlackBoxDialog.ui +# ) +#SET(SOURCES ${SOURCES} ${MOC_SOURCES} ${UI_SOURCES}) +#--------------------------------------------------------------------------- +SET(${BBTK_PACKAGE_NAME}_CXX_SOURCES + ${${BBTK_PACKAGE_NAME}_CXX_SOURCES} + ${MOC_SOURCES} + ) +MESSAGE(STATUS "Sources : ${${BBTK_PACKAGE_NAME}_SOURCES}") +#--------------------------------------------------------------------------- +# Include src configuration cmake script +INCLUDE(${BBTK_CMAKE_DIR}/BBTKConfigurePackage_src.cmake) +#--------------------------------------------------------------------------- + diff --git a/packages/qt/src/bbqtQLayoutLine.cxx b/packages/qt/src/bbqtQLayoutLine.cxx new file mode 100644 index 0000000..ffe64dd --- /dev/null +++ b/packages/qt/src/bbqtQLayoutLine.cxx @@ -0,0 +1,117 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbqtQLayoutLine.cxx,v $ + Language: C++ + Date: $Date: 2009/04/08 07:56:33 $ + Version: $Revision: 1.1 $ +=========================================================================*/ + +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* 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. +* ------------------------------------------------------------------------ */ + + +/** + * \file + * \brief + */ + + +#ifdef USE_QT + +#include "bbqtQLayoutLine.h" +#include "bbqtPackage.h" +#include "bbtkUtilities.h" + +#include + +namespace bbqt +{ + BBTK_ADD_BLACK_BOX_TO_PACKAGE(qt, LayoutLine); + BBTK_BLACK_BOX_IMPLEMENTATION(LayoutLine,bbtk::QtBlackBox); + + void LayoutLine::bbUserConstructor() + { + bbSetInputOrientation("VERTICAL"); + bbSetInputWidget1(NULL); + bbSetInputWidget2(NULL); + bbSetInputWidget3(NULL); + bbSetInputWidget4(NULL); + bbSetInputWidget5(NULL); + bbSetInputWidget6(NULL); + bbSetInputWidget7(NULL); + bbSetInputWidget8(NULL); + bbSetInputWidget9(NULL); + } + + void LayoutLine::Process() + { + } + + + + void LayoutLine::CreateWidget(QWidget* parent) + { + QWidget *w = new QWidget(parent); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(1); + sizePolicy.setVerticalStretch(1); + sizePolicy.setHeightForWidth(parent->sizePolicy().hasHeightForWidth()); + w->setSizePolicy(sizePolicy); + + QBoxLayout::Direction dir; + if (bbtk::Utilities::loosematch(bbGetInputOrientation(), + "0|H|HORIZONTAL")==true) + { dir = QBoxLayout::LeftToRight; } + if (bbtk::Utilities::loosematch(bbGetInputOrientation(), + "1|V|VERTICAL")==true) + { dir = QBoxLayout::TopToBottom; } + QBoxLayout* l = new QBoxLayout(dir); + + QWidget* cw; + if ((cw=bbCreateWidgetOfInput("Widget1",w)) != 0) l->addWidget(cw); + if ((cw=bbCreateWidgetOfInput("Widget2",w)) != 0) l->addWidget(cw); + + w->setLayout(l); + + + bbSetOutputWidget( w ); + } + + // This callback is necessary to get actual processing of the view + // when window is shown + void LayoutLine::OnShowWidget() + { + bbUserOnShowWidget("Widget1"); + bbUserOnShowWidget("Widget2"); + bbUserOnShowWidget("Widget3"); + bbUserOnShowWidget("Widget4"); + bbUserOnShowWidget("Widget5"); + bbUserOnShowWidget("Widget6"); + bbUserOnShowWidget("Widget7"); + bbUserOnShowWidget("Widget8"); + bbUserOnShowWidget("Widget9"); + } + +}//namespace bbqt + +#endif // USE_QT + diff --git a/packages/qt/src/bbqtQLayoutLine.cxx~ b/packages/qt/src/bbqtQLayoutLine.cxx~ new file mode 100644 index 0000000..9ef5f7d --- /dev/null +++ b/packages/qt/src/bbqtQLayoutLine.cxx~ @@ -0,0 +1,140 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbqtQLayoutLine.cxx~,v $ + Language: C++ + Date: $Date: 2009/04/08 07:56:33 $ + Version: $Revision: 1.1 $ +=========================================================================*/ + +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* 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. +* ------------------------------------------------------------------------ */ + + +/** + * \file + * \brief + */ + + +#ifdef _USE_WXWIDGETS_ + +#include "bbwxLayoutLine.h" +#include "bbwxPackage.h" +#include "bbtkUtilities.h" + + +namespace bbwx +{ + BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx, LayoutLine); + BBTK_BLACK_BOX_IMPLEMENTATION(LayoutLine,bbtk::WxBlackBox); + + void LayoutLine::bbUserConstructor() + { + bbSetInputOrientation("VERTICAL"); + bbSetInputWidget1(NULL); + bbSetInputWidget2(NULL); + bbSetInputWidget3(NULL); + bbSetInputWidget4(NULL); + bbSetInputWidget5(NULL); + bbSetInputWidget6(NULL); + bbSetInputWidget7(NULL); + bbSetInputWidget8(NULL); + bbSetInputWidget9(NULL); + } + + void LayoutLine::Process() + { + } + + +/* + void LayoutLine::TryInsertWindow(wxWindow *parent, wxWindow *w,wxBoxSizer *sizer) + { + if (w!=NULL) + { + w->Reparent(parent); + sizer->Add(w, 1, wxEXPAND, 0); + } + } + */ + + void LayoutLine::CreateWidget(wxWindow* parent) + { + wxBoxSizer *sizer; + wxPanel *w=new wxPanel(parent, //bbGetWxParent(), + -1); + w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) ); + + int style=0; + if (bbtk::Utilities::loosematch(bbGetInputOrientation(), + "0|H|HORIZONTAL")==true) + { style=wxHORIZONTAL; } + if (bbtk::Utilities::loosematch(bbGetInputOrientation(), + "1|V|VERTICAL")==true) + { 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); + TryInsertWindow(w,bbGetInputWidget4(),sizer); + TryInsertWindow(w,bbGetInputWidget5(),sizer); + TryInsertWindow(w,bbGetInputWidget6(),sizer); + TryInsertWindow(w,bbGetInputWidget7(),sizer); + TryInsertWindow(w,bbGetInputWidget8(),sizer); + TryInsertWindow(w,bbGetInputWidget9(),sizer); + */ + w -> SetSizer(sizer); + bbSetOutputWidget( w ); + } + + // This callback is necessary to get actual processing of the view + // when window is shown + void LayoutLine::OnShowWidget() + { + bbUserOnShowWidget("Widget1"); + bbUserOnShowWidget("Widget2"); + bbUserOnShowWidget("Widget3"); + bbUserOnShowWidget("Widget4"); + bbUserOnShowWidget("Widget5"); + bbUserOnShowWidget("Widget6"); + bbUserOnShowWidget("Widget7"); + bbUserOnShowWidget("Widget8"); + bbUserOnShowWidget("Widget9"); + } + +}//namespace bbwx + +#endif // _USE_WXWIDGETS_ + diff --git a/packages/qt/src/bbqtQLayoutLine.h b/packages/qt/src/bbqtQLayoutLine.h new file mode 100644 index 0000000..8208ef9 --- /dev/null +++ b/packages/qt/src/bbqtQLayoutLine.h @@ -0,0 +1,123 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbqtQLayoutLine.h,v $ + Language: C++ + Date: $Date: 2009/04/08 07:56:33 $ + Version: $Revision: 1.1 $ +=========================================================================*/ + +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* 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. +* ------------------------------------------------------------------------ */ + + +/** + * \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_QT + + +#ifndef __bbqtQLayoutLine_h__ +#define __bbqtQLayoutLine_h__ + +#include "bbtkQtBlackBox.h" +#include "bbqt_EXPORT.h" + + +namespace bbqt +{ + + + + //=========================================================== + class bbqt_EXPORT LayoutLine : public bbtk::QtBlackBox + { + + BBTK_BLACK_BOX_INTERFACE(LayoutLine,bbtk::QtBlackBox); + BBTK_DECLARE_INPUT(Widget1,QWidget*); + BBTK_DECLARE_INPUT(Widget2,QWidget*); + BBTK_DECLARE_INPUT(Widget3,QWidget*); + BBTK_DECLARE_INPUT(Widget4,QWidget*); + BBTK_DECLARE_INPUT(Widget5,QWidget*); + BBTK_DECLARE_INPUT(Widget6,QWidget*); + BBTK_DECLARE_INPUT(Widget7,QWidget*); + BBTK_DECLARE_INPUT(Widget8,QWidget*); + BBTK_DECLARE_INPUT(Widget9,QWidget*); + BBTK_DECLARE_INPUT(Orientation,std::string); + BBTK_PROCESS(Process); + BBTK_CREATE_WIDGET(CreateWidget); + BBTK_ON_SHOW_WIDGET(OnShowWidget); + + void Process(); + void CreateWidget(QWidget*); + void OnShowWidget(); + + protected: + virtual void bbUserConstructor(); + // void TryInsertWindow(QWidget *parent, QWidget *w,qtBoxSizer *sizer); + // + }; + //=========================================================== + + + //================================================================= + // BlackBox description + BBTK_BEGIN_DESCRIBE_BLACK_BOX(LayoutLine,bbtk::QtBlackBox); + BBTK_NAME("QLayoutLine"); + BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr"); + BBTK_DESCRIPTION("Linear layout widget (QBoxLayout)"); + // Already inserted for any QtBlackBox BBTK_CATEGORY("widget"); + BBTK_INPUT(LayoutLine,Widget1,"widget 1",QWidget*,""); + BBTK_INPUT(LayoutLine,Widget2,"widget 2",QWidget*,""); + BBTK_INPUT(LayoutLine,Widget3,"widget 3",QWidget*,""); + BBTK_INPUT(LayoutLine,Widget4,"widget 4",QWidget*,""); + BBTK_INPUT(LayoutLine,Widget5,"widget 5",QWidget*,""); + BBTK_INPUT(LayoutLine,Widget6,"widget 6",QWidget*,""); + BBTK_INPUT(LayoutLine,Widget7,"widget 7",QWidget*,""); + BBTK_INPUT(LayoutLine,Widget8,"widget 8",QWidget*,""); + BBTK_INPUT(LayoutLine,Widget9,"widget 9",QWidget*,""); + BBTK_INPUT(LayoutLine,Orientation,"Orientation (default V), 0=H=HORIZONTAL , 1=V=VERTICAL",std::string,""); + BBTK_END_DESCRIBE_BLACK_BOX(LayoutLine); + //================================================================= + + + +} + + + +//namespace bbtk +#endif //__bbtkQtLayoutLine_h__ + +#endif //USE_QTWIDGETS diff --git a/packages/qt/src/bbqtQLayoutLine.h~ b/packages/qt/src/bbqtQLayoutLine.h~ new file mode 100644 index 0000000..63388ef --- /dev/null +++ b/packages/qt/src/bbqtQLayoutLine.h~ @@ -0,0 +1,123 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbqtQLayoutLine.h~,v $ + Language: C++ + Date: $Date: 2009/04/08 07:56:33 $ + Version: $Revision: 1.1 $ +=========================================================================*/ + +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* 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. +* ------------------------------------------------------------------------ */ + + +/** + * \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_QTWIDGETS + + +#ifndef __bbQtLayoutLine_h__ +#define __bbQtLayoutLine_h__ + +#include "bbtkQtBlackBox.h" +#include "bbqt_EXPORT.h" + + +namespace bbqt +{ + + + + //=========================================================== + class bbqt_EXPORT LayoutLine : public bbtk::QtBlackBox + { + + BBTK_BLACK_BOX_INTERFACE(LayoutLine,bbtk::QtBlackBox); + BBTK_DECLARE_INPUT(Widget1,qtWindow*); + BBTK_DECLARE_INPUT(Widget2,qtWindow*); + BBTK_DECLARE_INPUT(Widget3,qtWindow*); + BBTK_DECLARE_INPUT(Widget4,qtWindow*); + BBTK_DECLARE_INPUT(Widget5,qtWindow*); + BBTK_DECLARE_INPUT(Widget6,qtWindow*); + BBTK_DECLARE_INPUT(Widget7,qtWindow*); + BBTK_DECLARE_INPUT(Widget8,qtWindow*); + BBTK_DECLARE_INPUT(Widget9,qtWindow*); + BBTK_DECLARE_INPUT(Orientation,std::string); + BBTK_PROCESS(Process); + BBTK_CREATE_WIDGET(CreateWidget); + BBTK_ON_SHOW_WIDGET(OnShowWidget); + + void Process(); + void CreateWidget(qtWindow*); + void OnShowWidget(); + + protected: + virtual void bbUserConstructor(); + void TryInsertWindow(qtWindow *parent, qtWindow *w,qtBoxSizer *sizer); + + }; + //=========================================================== + + + //================================================================= + // BlackBox description + BBTK_BEGIN_DESCRIBE_BLACK_BOX(LayoutLine,bbtk::QtBlackBox); + BBTK_NAME("LayoutLine"); + BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr"); + BBTK_DESCRIPTION("LayoutLine widget (qtBoxSizer)"); + // Already inserted for any QtBlackBox BBTK_CATEGORY("widget"); + BBTK_INPUT(LayoutLine,Widget1,"widget 1",qtWindow*,""); + BBTK_INPUT(LayoutLine,Widget2,"widget 2",qtWindow*,""); + BBTK_INPUT(LayoutLine,Widget3,"widget 3",qtWindow*,""); + BBTK_INPUT(LayoutLine,Widget4,"widget 4",qtWindow*,""); + BBTK_INPUT(LayoutLine,Widget5,"widget 5",qtWindow*,""); + BBTK_INPUT(LayoutLine,Widget6,"widget 6",qtWindow*,""); + BBTK_INPUT(LayoutLine,Widget7,"widget 7",qtWindow*,""); + BBTK_INPUT(LayoutLine,Widget8,"widget 8",qtWindow*,""); + BBTK_INPUT(LayoutLine,Widget9,"widget 9",qtWindow*,""); + BBTK_INPUT(LayoutLine,Orientation,"Orientation (default V), 0=H=HORIZONTAL , 1=V=VERTICAL",std::string,""); + BBTK_END_DESCRIBE_BLACK_BOX(LayoutLine); + //================================================================= + + + +} + + + +//namespace bbtk +#endif //__bbtkQtLayoutLine_h__ + +#endif //USE_QTWIDGETS diff --git a/packages/qt/src/bbqtQOutputText.cxx b/packages/qt/src/bbqtQOutputText.cxx new file mode 100644 index 0000000..b7fbad5 --- /dev/null +++ b/packages/qt/src/bbqtQOutputText.cxx @@ -0,0 +1,57 @@ +#include "bbqtQOutputText.h" +#include "bbqtPackage.h" +#include + +namespace bbqt +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(qt,QOutputText) +BBTK_BLACK_BOX_IMPLEMENTATION(QOutputText,bbtk::QtBlackBox); +void QOutputText::Process() +{ + + std::string msg; + if (bbGetInputTitle()!="") + { + msg = bbGetInputTitle()+": " + bbGetInputIn(); + } + else + { + msg = bbGetInputIn(); + } + ((QLabel*)bbGetOutputWidget())->setText( msg.c_str() ); + //SetLabel( bbtk::std2wx( msg ) ); + +} +void QOutputText::CreateWidget(QWidget* parent) +{ + + bbSetOutputWidget( new + QLabel( parent ) ); + //wxStaticText ( bbGetWxParent() , -1 , _T("") ) ); + Process(); + +} +void QOutputText::bbUserConstructor() +{ + + bbSetInputIn(""); + bbSetInputTitle(""); + +} +void QOutputText::bbUserCopyConstructor(bbtk::BlackBox::Pointer) +{ + + + +} +void QOutputText::bbUserDestructor() +{ + + + +} +} +// EO namespace bbqt + + diff --git a/packages/qt/src/bbqtQOutputText.cxx~ b/packages/qt/src/bbqtQOutputText.cxx~ new file mode 100644 index 0000000..451bf3f --- /dev/null +++ b/packages/qt/src/bbqtQOutputText.cxx~ @@ -0,0 +1,57 @@ +#include "bbqtQOutputText.h" +#include "bbqtPackage.h" +#include + +namespace bbqt +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(qt,QOutputText) +BBTK_BLACK_BOX_IMPLEMENTATION(QOutputText,bbtk::QtBlackBox); +void QOutputText::Process() +{ + + std::string msg; + if (bbGetInputTitle()!="") + { + msg = bbGetInputTitle()+": " + bbGetInputIn(); + } + else + { + msg = bbGetInputIn(); + } + ((QLabel*)bbGetOutputWidget())->setText( msg.c_str() ); + //SetLabel( bbtk::std2wx( msg ) ); + +} +void QOutputText::CreateWidget(QWidget* parent) +{ + + bbSetOutputWidget( new + QLabel( parent ) ); + //wxStaticText ( bbGetWxParent() , -1 , _T("") ) ); + Process(); + +} +void QOutputText::bbUserConstructor() +{ + + bbSetInputIn(""); + bbSetInputTitle(""); + +} +void QOutputText::bbUserCopyConstructor(bbtk::BlackBox::Pointer) +{ + + + +} +void QOutputText::bbUserDestructor() +{ + + + +} +} +// EO namespace bbqt + + diff --git a/packages/qt/src/bbqtQOutputText.h b/packages/qt/src/bbqtQOutputText.h new file mode 100644 index 0000000..d61db3c --- /dev/null +++ b/packages/qt/src/bbqtQOutputText.h @@ -0,0 +1,45 @@ +#ifdef USE_QT + +#ifndef __bbqtQOutputText_h_INCLUDED__ +#define __bbqtQOutputText_h_INCLUDED__ +#include "bbqt_EXPORT.h" +#include "bbtkQtBlackBox.h" + +namespace bbqt +{ + +class bbqt_EXPORT QOutputText + : + public bbtk::QtBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(QOutputText,bbtk::QtBlackBox); +//================================================================== +/// User callback called in the box contructor +virtual void bbUserConstructor(); +/// User callback called in the box copy constructor +virtual void bbUserCopyConstructor(bbtk::BlackBox::Pointer); +/// User callback called in the box destructor +virtual void bbUserDestructor(); +//================================================================== + BBTK_DECLARE_INPUT(Title,std::string); + BBTK_DECLARE_INPUT(In,std::string); + BBTK_PROCESS(Process); + void Process(); + BBTK_CREATE_WIDGET(CreateWidget); + void CreateWidget(QWidget*); +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(QOutputText,bbtk::QtBlackBox); +BBTK_NAME("QOutputText"); +BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr"); +BBTK_DESCRIPTION("OutputText"); +BBTK_CATEGORY(""); +BBTK_INPUT(QOutputText,Title,"Title prepended to the text",std::string,""); +BBTK_INPUT(QOutputText,In,"Text",std::string,""); +BBTK_END_DESCRIBE_BLACK_BOX(QOutputText); +} +// EO namespace bbqt + +#endif // __bbqtQOutputText_h_INCLUDED__ +#endif // USE_QT + diff --git a/packages/qt/src/bbqtQOutputText.h~ b/packages/qt/src/bbqtQOutputText.h~ new file mode 100644 index 0000000..2b0153f --- /dev/null +++ b/packages/qt/src/bbqtQOutputText.h~ @@ -0,0 +1,44 @@ +#ifdef _USE_WXWIDGETS_ +#ifndef __bbqtQOutputText_h_INCLUDED__ +#define __bbqtQOutputText_h_INCLUDED__ +#include "bbqt_EXPORT.h" +#include "bbtkQtBlackBox.h" + +namespace bbqt +{ + +class bbqt_EXPORT QOutputText + : + public bbtk::QtBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(QOutputText,bbtk::QtBlackBox); +//================================================================== +/// User callback called in the box contructor +virtual void bbUserConstructor(); +/// User callback called in the box copy constructor +virtual void bbUserCopyConstructor(bbtk::BlackBox::Pointer); +/// User callback called in the box destructor +virtual void bbUserDestructor(); +//================================================================== + BBTK_DECLARE_INPUT(Title,std::string); + BBTK_DECLARE_INPUT(In,std::string); + BBTK_PROCESS(Process); + void Process(); + BBTK_CREATE_WIDGET(CreateWidget); + void CreateWidget(QWidget*); +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(QOutputText,bbtk::QtBlackBox); +BBTK_NAME("QOutputText"); +BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr"); +BBTK_DESCRIPTION("OutputText"); +BBTK_CATEGORY(""); +BBTK_INPUT(QOutputText,Title,"Title prepended to the text",std::string,""); +BBTK_INPUT(QOutputText,In,"Text",std::string,""); +BBTK_END_DESCRIBE_BLACK_BOX(QOutputText); +} +// EO namespace bbqt + +#endif // __bbqtQOutputText_h_INCLUDED__ +#endif // _USE_WXWIDGETS_ + diff --git a/packages/qt/src/bbqtQSlider.cxx b/packages/qt/src/bbqtQSlider.cxx new file mode 100644 index 0000000..530473e --- /dev/null +++ b/packages/qt/src/bbqtQSlider.cxx @@ -0,0 +1,139 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbqtQSlider.cxx,v $ + Language: C++ + Date: $Date: 2009/04/08 07:56:33 $ + Version: $Revision: 1.1 $ +=========================================================================*/ + +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* 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. +* ------------------------------------------------------------------------ */ + +/** + * \file + * \brief Short description in one line + * + * Long + * description + * + */ + +#ifdef USE_QT + +#include "bbqtQSlider.h" +#include "bbqtPackage.h" +#include "bbtkUtilities.h" + +namespace bbqt +{ + + + + //-------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // QtBlackBox implementation + //-------------------------------------------------------------------------- + //-------------------------------------------------------------------------- + + //-------------------------------------------------------------------------- + BBTK_BLACK_BOX_IMPLEMENTATION(Slider,bbtk::QtBlackBox); + BBTK_ADD_BLACK_BOX_TO_PACKAGE(qt,Slider); + + //-------------------------------------------------------------------------- + void Slider::bbUserConstructor() + { + bbSetInputIn(0); + bbSetInputMin(0); + bbSetInputMax(500); + bbSetOutputOut(0); + bbSetInputOrientation("HORIZONTAL"); + bbSetInputChangeResolution(false); + bbSetInputLabel(true); + bbSetInputReactiveOnTrack(false); + } + //-------------------------------------------------------------------------- + + //-------------------------------------------------------------------------- + void Slider::Process() + { + bbtkDebugMessage("process",3, + "Slider "<SetValue(v); } + int GetValue() { return mqtSlider->GetValue(); } + void SetRange(int min, int max); + // Update the texts which display the min/max/current values of the slider + void RefreshLabels(); + + private: + Slider* mBox; + qtSlider *mqtSlider; + qtSlider *mResolutionOfSlider; + int min; + int max; + bool reactiveOnTrack; + qtStaticText *label_vertical; + qtStaticText *label_min; + qtStaticText *label_max; + }; + //------------------------------------------------------------------------ + //------------------------------------------------------------------------ + //------------------------------------------------------------------------ + + + + //------------------------------------------------------------------------- + SliderWidget::SliderWidget(Slider* box, qtWindow *parent, + int orientation, + bool changeresolution, + bool labels, + qtString title, + int vmin, + int vmax, + int value, + bool reactiveontrack) + : + qtPanel( parent, -1, qtDefaultPosition, qtDefaultSize, qtTAB_TRAVERSAL), + mBox(box), + min(vmin), + max(vmax), + reactiveOnTrack(reactiveontrack) + { + qtPanel * panel = this; + + label_min = NULL; + label_max = NULL; + label_vertical = NULL; + mResolutionOfSlider = NULL; + + int sizeX,sizeY; + long qtlabels=0; + long qtorientation=0; + if (orientation==0) + { + sizeX = 2; + sizeY = 40; + qtorientation = qtSL_HORIZONTAL; + if (labels==true) + { + qtlabels = qtSL_LABELS; + } + } + else + { + sizeX = 20; + sizeY = 2; + qtorientation = qtSL_VERTICAL; + } + + //--------------------------------------------------------------------- + // 1) Creation of the components of the widget + // Any top level sub-widget must have the panel returned by panel + // for parent + mqtSlider = new qtSlider( panel, + -1, 0 , 0, 500 , + qtDefaultPosition, + qtSize(sizeX,sizeY), + qtorientation | qtlabels ); + + // mqtSlider->SetInitialSize(qtSize(sizeX,sizeY)); + + // mqtSlider->SetTickFreq(100,0); + mqtSlider->SetRange(min,max); + mqtSlider->SetValue(value); + + // RefreshLabels(); + + // Connecting events to callbacks + Connect( mqtSlider->GetId(), + qtEVT_SCROLL_THUMBRELEASE, + (qtObjectEventFunction) + (void (qtPanel::*)(qtScrollEvent&)) + &SliderWidget::OnSliderRelease ); + + Connect( mqtSlider->GetId(), + qtEVT_SCROLL_THUMBTRACK, + (qtObjectEventFunction) + (void (qtPanel::*)(qtScrollEvent&)) + &SliderWidget::OnSliderTrack ); + + Connect( mqtSlider->GetId(), + qtEVT_SCROLL_CHANGED, + (qtObjectEventFunction) + (void (qtPanel::*)(qtScrollEvent&)) + &SliderWidget::OnSliderTrack ); + + // If asked : creation of the other little slider which allows to change + // the resolution of the main slider + if (changeresolution==true){ + // has panel for parent too + mResolutionOfSlider = new qtSlider(panel, + -1,5,1,10, + qtDefaultPosition, + qtSize(25,45), + qtSL_VERTICAL | + qtSL_AUTOTICKS | + qtSL_LEFT ); + + + mResolutionOfSlider->SetRange(1,8); + mResolutionOfSlider->SetValue(5); + // Is qtEVT_COMMAND_SLIDER_UPDATED event + // is connected to the method OnResolutionOfSlider + Connect(mResolutionOfSlider->GetId(), + qtEVT_COMMAND_SLIDER_UPDATED, + (qtObjectEventFunction) + (void (qtPanel::*)(qtScrollEvent&)) + &SliderWidget::OnResolutionOfSlider ); + } + //--------------------------------------------------------------------- + + //--------------------------------------------------------------------- + // 2) Insertion of the components in the window + + // We use a FlexGridSizer + qtFlexGridSizer *sizer; + + + if (orientation==0) + { + // HORIZONTAL + if (mResolutionOfSlider!=NULL) + { + sizer = new qtFlexGridSizer(2); + if (title!=_T("")) + { + sizer -> Add( new qtStaticText(panel,-1, title ) ); + sizer -> Add( new qtStaticText(panel,-1, _T("") ) ); + } + } + else + { + sizer = new qtFlexGridSizer(1); + if (title!=_T("")) + { + sizer -> Add( new qtStaticText(panel,-1, title ) ); + } + } + sizer -> Add( mqtSlider,1,qtGROW ); + sizer -> AddGrowableCol(0); + if (mResolutionOfSlider!=NULL) + { + sizer -> Add( mResolutionOfSlider ); + } + } + else + { + // VERTICAL + sizer = new qtFlexGridSizer(1); + if (labels==true) // with lable + { + label_vertical = new qtStaticText(panel,-1,_T("")); + label_min = new qtStaticText(panel,-1,_T("")); + label_max = new qtStaticText(panel,-1,_T("")); + if (title!=_T("")) + { + sizer -> Add( new qtStaticText(panel,-1, title ) ); + sizer -> AddGrowableRow(3); + } + else + { + sizer -> AddGrowableRow(2); + } + sizer -> Add( label_vertical ); + sizer -> Add( label_min ); + sizer -> Add( mqtSlider,1,qtGROW ); + sizer -> Add( label_max ); + if (mResolutionOfSlider!=NULL) + { + sizer -> Add( mResolutionOfSlider ); + } + } + else + { + if (title!=_T("")) + { + sizer -> Add( new qtStaticText(panel,-1, title ) ); + sizer -> AddGrowableRow(1); + } + else + { + sizer -> AddGrowableRow(0); + } + sizer -> Add( mqtSlider,1,qtGROW ); + if (mResolutionOfSlider!=NULL) + { + sizer -> Add( mResolutionOfSlider ); + } + } + } + // Initialize the labels + RefreshLabels(); + // Insert the sizer in the main panel and refresh the layout + panel->SetSizer(sizer); + } + //------------------------------------------------------------------------- + + + //------------------------------------------------------------------------- + SliderWidget::~SliderWidget() + { + } + //------------------------------------------------------------------------- + + + //------------------------------------------------------------------------- + void SliderWidget::OnResolutionOfSlider(qtScrollEvent& event) + { + int value = mqtSlider->GetValue(); + int delta = (int) (pow( 4 , mResolutionOfSlider->GetValue() )); + int minTmp = value - delta/2; + int maxTmp = value + delta/2; + if (minTmpmax) + { + maxTmp = max; + } + mqtSlider->SetRange(minTmp,maxTmp); + RefreshLabels(); + } + //------------------------------------------------------------------------- + + + + //------------------------------------------------------------------------- + void SliderWidget::OnSliderTrack(qtScrollEvent& event) + { + if(reactiveOnTrack) + { + // When user releases the slider + // we update the output of the box + + mBox->bbSetOutputOut( mqtSlider->GetValue() ); + mBox->bbSetInputIn( mqtSlider->GetValue() ); + // and signal that the output has changed + mBox->bbSignalOutputModification(std::string("Out")); + } + RefreshLabels(); + } + //------------------------------------------------------------------------- + + + //------------------------------------------------------------------------- + void SliderWidget::OnSliderRelease(qtScrollEvent& event) + { + // When user releases the slider + // we update the output of the box + mBox->bbSetOutputOut( mqtSlider->GetValue() ); + mBox->bbSetInputIn( mqtSlider->GetValue() ); + // and signal that the output has changed + mBox->bbSignalOutputModification(std::string("Out")); + } + //------------------------------------------------------------------------- + + + //------------------------------------------------------------------------- + void SliderWidget::RefreshLabels() + { + qtString strValue; + if (label_vertical!=NULL) + { + strValue.Printf( _T("%d"), mqtSlider->GetValue() ); + label_vertical->SetLabel(strValue); + } + if (label_min!=NULL) + { + strValue.Printf( _T("%d"), mqtSlider->GetMin() ); + label_min->SetLabel(strValue); + } + if (label_max!=NULL) + { + strValue.Printf( _T("%d"), mqtSlider->GetMax() ); + label_max->SetLabel(strValue); + } + } + //------------------------------------------------------------------------- + + + //------------------------------------------------------------------------- + void SliderWidget::SetRange(int min, int max) + { + this->min = min; + this->max = max; + mqtSlider->SetRange(min,max); + RefreshLabels(); + } + //------------------------------------------------------------------------- + + */ + + + //-------------------------------------------------------------------------- + //------------------------------------------------------------------------- + // QtBlackBox implementation + //-------------------------------------------------------------------------- + //-------------------------------------------------------------------------- + + //-------------------------------------------------------------------------- + BBTK_BLACK_BOX_IMPLEMENTATION(Slider,bbtk::QtBlackBox); + BBTK_ADD_BLACK_BOX_TO_PACKAGE(qt,Slider); + + //-------------------------------------------------------------------------- + void Slider::bbUserConstructor() + { + bbSetInputIn(0); + bbSetInputMin(0); + bbSetInputMax(500); + bbSetOutputOut(0); + bbSetInputOrientation("HORIZONTAL"); + bbSetInputChangeResolution(false); + bbSetInputLabel(true); + bbSetInputReactiveOnTrack(false); + } + //-------------------------------------------------------------------------- + + //-------------------------------------------------------------------------- + void Slider::Process() + { + bbtkDebugMessage("process",3, + "Slider "< + +// Namespace of the package "qt" is "bbqt" +// Namespace associated to packages should be of the form : +// bbPACKAGENAME +namespace bbqt +{ + + + + + //------------------------------------------------------------------------ + // The black box + class bbqt_EXPORT Slider : public QObject, + public bbtk::QtBlackBox + { + Q_OBJECT + + BBTK_BLACK_BOX_INTERFACE(Slider,bbtk::QtBlackBox); + BBTK_DECLARE_INPUT(In,int); + BBTK_DECLARE_INPUT(Min,int); + BBTK_DECLARE_INPUT(Max,int); + BBTK_DECLARE_INPUT(Label,bool); + BBTK_DECLARE_INPUT(Title,std::string); + BBTK_DECLARE_INPUT(Orientation,std::string); + BBTK_DECLARE_INPUT(ChangeResolution,bool); + BBTK_DECLARE_INPUT(ReactiveOnTrack,bool); + BBTK_DECLARE_OUTPUT(Out,int); + BBTK_PROCESS(Process); + BBTK_CREATE_WIDGET(CreateWidget); + void Process(); + void CreateWidget(QWidget*); + + public slots: + void OnValueChanged(int); + + + protected: + virtual void bbUserConstructor(); + + // QSlider* mSlider; + }; + //================================================================= + + //================================================================= + // the black box description + BBTK_BEGIN_DESCRIBE_BLACK_BOX(Slider,bbtk::QtBlackBox); + BBTK_NAME("QSlider"); + BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr"); + // Already inserted for any QtBlackBox BBTK_CATEGORY("widget"); + BBTK_DESCRIPTION("Slider widget (QSlider)"); + BBTK_INPUT(Slider,In,"Initial position of the slider (default 0)",int,""); + BBTK_INPUT(Slider,Min,"Minimum value of the slider (default 0)",int,""); + BBTK_INPUT(Slider,Max,"Maximum value of the slider (default 500)",int,""); + BBTK_INPUT(Slider,Label,"Show slider labels ? (default FALSE) ",bool,""); + BBTK_INPUT(Slider,Title,"Title shown above the slider (default '') ", std::string,""); + BBTK_INPUT(Slider,Orientation, "Orientation : (default H) 0=H=HORIZONTAL, 1=V=VERTICAL ",std::string,""); + BBTK_INPUT(Slider,ChangeResolution, "Can the user change the resolution of the slider ? (default FALSE) ",bool,""); + BBTK_INPUT(Slider,ReactiveOnTrack, "Slider sends info when track moves (default : FALSE)",bool,""); + BBTK_OUTPUT(Slider,Out,"Current position of the slider",int,""); + BBTK_END_DESCRIBE_BLACK_BOX(Slider); + //================================================================= + + + +} //namespace bbqt + +#endif //__bbtkqtSlider_h_INCLUDED__ + +#endif //USE_QT diff --git a/packages/qt/src/bbqtQSlider.h~ b/packages/qt/src/bbqtQSlider.h~ new file mode 100644 index 0000000..3ca8981 --- /dev/null +++ b/packages/qt/src/bbqtQSlider.h~ @@ -0,0 +1,120 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbqtQSlider.h~,v $ + Language: C++ + Date: $Date: 2009/04/08 07:56:33 $ + Version: $Revision: 1.1 $ +=========================================================================*/ + +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* 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. +* ------------------------------------------------------------------------ */ + +/** + * \file + * \brief Short description in one line + * + * Long description which + * can span multiple lines +*/ + +/** + * \class bbqt::Slider + * \brief + + * \class bbqt::SliderWidget + * \brief + */ + +#ifdef USE_QT + +// Prevents multiple inclusions : use symbols of the form +// __FILENAME_INCLUDED__ +// where FILENAME must be replaced by the actual file name +#ifndef __bbqtSlider_h_INCLUDED__ +#define __bbqtSlider_h_INCLUDED__ + +// Include qtBlackBox definition +#include "bbtkQtBlackBox.h" + +#include "bbqt_EXPORT.h" + + +// Namespace of the package "qt" is "bbqt" +// Namespace associated to packages should be of the form : +// bbPACKAGENAME +namespace bbqt +{ + + + + + //------------------------------------------------------------------------ + // The black box + class bbqt_EXPORT Slider : public bbtk::QtBlackBox + { + + BBTK_BLACK_BOX_INTERFACE(Slider,bbtk::QtBlackBox); + BBTK_DECLARE_INPUT(In,int); + BBTK_DECLARE_INPUT(Min,int); + BBTK_DECLARE_INPUT(Max,int); + BBTK_DECLARE_INPUT(Label,bool); + BBTK_DECLARE_INPUT(Title,std::string); + BBTK_DECLARE_INPUT(Orientation,std::string); + BBTK_DECLARE_INPUT(ChangeResolution,bool); + BBTK_DECLARE_INPUT(ReactiveOnTrack,bool); + BBTK_DECLARE_OUTPUT(Out,int); + BBTK_PROCESS(Process); + BBTK_CREATE_WIDGET(CreateWidget); + void Process(); + void CreateWidget(QWidget*); + + protected: + virtual void bbUserConstructor(); + }; + //================================================================= + + //================================================================= + // the black box description + BBTK_BEGIN_DESCRIBE_BLACK_BOX(Slider,bbtk::QtBlackBox); + BBTK_NAME("Slider"); + BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr"); + // Already inserted for any QtBlackBox BBTK_CATEGORY("widget"); + BBTK_DESCRIPTION("Slider widget (QSlider)"); + BBTK_INPUT(Slider,In,"Initial position of the slider (default 0)",int,""); + BBTK_INPUT(Slider,Min,"Minimum value of the slider (default 0)",int,""); + BBTK_INPUT(Slider,Max,"Maximum value of the slider (default 500)",int,""); + BBTK_INPUT(Slider,Label,"Show slider labels ? (default FALSE) ",bool,""); + BBTK_INPUT(Slider,Title,"Title shown above the slider (default '') ", std::string,""); + BBTK_INPUT(Slider,Orientation, "Orientation : (default H) 0=H=HORIZONTAL, 1=V=VERTICAL ",std::string,""); + BBTK_INPUT(Slider,ChangeResolution, "Can the user change the resolution of the slider ? (default FALSE) ",bool,""); + BBTK_INPUT(Slider,ReactiveOnTrack, "Slider sends info when track moves (default : FALSE)",bool,""); + BBTK_OUTPUT(Slider,Out,"Current position of the slider",int,""); + BBTK_END_DESCRIBE_BLACK_BOX(Slider); + //================================================================= + + + +} //namespace bbqt + +#endif //__bbtkqtSlider_h_INCLUDED__ + +#endif //USE_QT