From: guigues Date: Wed, 8 Apr 2009 08:35:57 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: EED.02Oct2009~63 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=82339d1dea2db3b2c99f18bbb963853f1d692455;p=bbtk.git *** empty log message *** --- diff --git a/packages/qt/CMakeLists.txt b/packages/qt/CMakeLists.txt index f9f9d75..3802e43 100644 --- a/packages/qt/CMakeLists.txt +++ b/packages/qt/CMakeLists.txt @@ -68,9 +68,10 @@ 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 + bbqtOutputText + bbqtSlider + bbqtLayoutLine + bbqtLayoutSplit ) #=========================================================================== diff --git a/packages/qt/src/CMakeLists.txt b/packages/qt/src/CMakeLists.txt index b056f60..70d9e2c 100644 --- a/packages/qt/src/CMakeLists.txt +++ b/packages/qt/src/CMakeLists.txt @@ -1,7 +1,7 @@ #--------------------------------------------------------------------------- # MOC SET(QT4_HEADERS_TO_WRAP - bbqtQSlider.h + bbqtSlider.h ) QT4_WRAP_CPP(MOC_SOURCES ${QT4_HEADERS_TO_WRAP}) #--------------------------------------------------------------------------- diff --git a/packages/qt/src/bbqtQLayoutLine.cxx b/packages/qt/src/bbqtLayoutLine.cxx similarity index 85% rename from packages/qt/src/bbqtQLayoutLine.cxx rename to packages/qt/src/bbqtLayoutLine.cxx index ffe64dd..031fff9 100644 --- a/packages/qt/src/bbqtQLayoutLine.cxx +++ b/packages/qt/src/bbqtLayoutLine.cxx @@ -1,8 +1,8 @@ /*========================================================================= Program: bbtk - Module: $RCSfile: bbqtQLayoutLine.cxx,v $ + Module: $RCSfile: bbqtLayoutLine.cxx,v $ Language: C++ - Date: $Date: 2009/04/08 07:56:33 $ + Date: $Date: 2009/04/08 08:35:59 $ Version: $Revision: 1.1 $ =========================================================================*/ @@ -37,7 +37,7 @@ #ifdef USE_QT -#include "bbqtQLayoutLine.h" +#include "bbqtLayoutLine.h" #include "bbqtPackage.h" #include "bbtkUtilities.h" @@ -89,6 +89,14 @@ namespace bbqt QWidget* cw; if ((cw=bbCreateWidgetOfInput("Widget1",w)) != 0) l->addWidget(cw); if ((cw=bbCreateWidgetOfInput("Widget2",w)) != 0) l->addWidget(cw); + if ((cw=bbCreateWidgetOfInput("Widget3",w)) != 0) l->addWidget(cw); + if ((cw=bbCreateWidgetOfInput("Widget4",w)) != 0) l->addWidget(cw); + if ((cw=bbCreateWidgetOfInput("Widget5",w)) != 0) l->addWidget(cw); + if ((cw=bbCreateWidgetOfInput("Widget6",w)) != 0) l->addWidget(cw); + if ((cw=bbCreateWidgetOfInput("Widget7",w)) != 0) l->addWidget(cw); + if ((cw=bbCreateWidgetOfInput("Widget8",w)) != 0) l->addWidget(cw); + if ((cw=bbCreateWidgetOfInput("Widget9",w)) != 0) l->addWidget(cw); + w->setLayout(l); diff --git a/packages/qt/src/bbqtQLayoutLine.h b/packages/qt/src/bbqtLayoutLine.h similarity index 97% rename from packages/qt/src/bbqtQLayoutLine.h rename to packages/qt/src/bbqtLayoutLine.h index 8208ef9..3265a19 100644 --- a/packages/qt/src/bbqtQLayoutLine.h +++ b/packages/qt/src/bbqtLayoutLine.h @@ -1,8 +1,8 @@ /*========================================================================= Program: bbtk - Module: $RCSfile: bbqtQLayoutLine.h,v $ + Module: $RCSfile: bbqtLayoutLine.h,v $ Language: C++ - Date: $Date: 2009/04/08 07:56:33 $ + Date: $Date: 2009/04/08 08:35:59 $ Version: $Revision: 1.1 $ =========================================================================*/ diff --git a/packages/qt/src/bbqtLayoutSplit.cxx b/packages/qt/src/bbqtLayoutSplit.cxx new file mode 100644 index 0000000..7e3cfdc --- /dev/null +++ b/packages/qt/src/bbqtLayoutSplit.cxx @@ -0,0 +1,172 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbqtLayoutSplit.cxx,v $ + Language: C++ + Date: $Date: 2009/04/08 08:35:59 $ + 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 "bbqtLayoutSplit.h" +#include "bbqtPackage.h" +#include "bbtkUtilities.h" + +#include + +namespace bbqt +{ + BBTK_ADD_BLACK_BOX_TO_PACKAGE(qt,LayoutSplit); + BBTK_BLACK_BOX_IMPLEMENTATION(LayoutSplit,bbtk::QtBlackBox); + + void LayoutSplit::bbUserConstructor() + { + bbSetInputOrientation("VERTICAL"); + // bbSetInputProportion(50); + + bbSetInputWidget1(NULL); + bbSetInputWidget2(NULL); + bbSetInputWidget3(NULL); + bbSetInputWidget4(NULL); + bbSetInputWidget5(NULL); + bbSetInputWidget6(NULL); + bbSetInputWidget7(NULL); + bbSetInputWidget8(NULL); + bbSetInputWidget9(NULL); + + bbSetInputWeight1(1); + bbSetInputWeight2(1); + bbSetInputWeight3(1); + bbSetInputWeight4(1); + bbSetInputWeight5(1); + bbSetInputWeight6(1); + bbSetInputWeight7(1); + bbSetInputWeight8(1); + bbSetInputWeight9(1); + } + + void LayoutSplit::Process() + { + } + + void LayoutSplit::CreateWidget(QWidget* parent) + { + Qt::Orientation ori; + if (bbtk::Utilities::loosematch(bbGetInputOrientation(), + "0|H|HORIZONTAL")==true) + { ori = Qt::Horizontal; } + if (bbtk::Utilities::loosematch(bbGetInputOrientation(), + "1|V|VERTICAL")==true) + { ori = Qt::Vertical; } + + QSplitter* w = new QSplitter(ori,parent); + QWidget* c; + int i=0; + if ((c=bbCreateWidgetOfInput("Widget1",w))!=0) + { + w->addWidget(c); + w->setStretchFactor(i,bbGetInputWeight1()); + i++; + } + if ((c=bbCreateWidgetOfInput("Widget2",w))!=0) + { + w->addWidget(c); + w->setStretchFactor(i,bbGetInputWeight2()); + i++; + } + if ((c=bbCreateWidgetOfInput("Widget3",w))!=0) + { + w->addWidget(c); + w->setStretchFactor(i,bbGetInputWeight3()); + i++; + } + if ((c=bbCreateWidgetOfInput("Widget4",w))!=0) + { + w->addWidget(c); + w->setStretchFactor(i,bbGetInputWeight4()); + i++; + } + if ((c=bbCreateWidgetOfInput("Widget5",w))!=0) + { + w->addWidget(c); + w->setStretchFactor(i,bbGetInputWeight5()); + i++; + } + if ((c=bbCreateWidgetOfInput("Widget6",w))!=0) + { + w->addWidget(c); + w->setStretchFactor(i,bbGetInputWeight6()); + i++; + } + if ((c=bbCreateWidgetOfInput("Widget7",w))!=0) + { + w->addWidget(c); + w->setStretchFactor(i,bbGetInputWeight7()); + i++; + } + if ((c=bbCreateWidgetOfInput("Widget8",w))!=0) + { + w->addWidget(c); + w->setStretchFactor(i,bbGetInputWeight8()); + i++; + } + if ((c=bbCreateWidgetOfInput("Widget9",w))!=0) + { + w->addWidget(c); + w->setStretchFactor(i,bbGetInputWeight9()); + i++; + } + + bbSetOutputWidget( w ); + } + + + // This callback is necessary to get actual processing of the view + // when window is shown + void LayoutSplit::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/bbqtLayoutSplit.h b/packages/qt/src/bbqtLayoutSplit.h new file mode 100644 index 0000000..b9d9b1b --- /dev/null +++ b/packages/qt/src/bbqtLayoutSplit.h @@ -0,0 +1,137 @@ +/*========================================================================= + Program: bbtk + Module: $RCSfile: bbqtLayoutSplit.h,v $ + Language: C++ + Date: $Date: 2009/04/08 08:35:59 $ + 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 Widget which splits a window into two parts + */ +/** + * \class bbqt::LayoutSplit + * \brief Widget which splits a window into two parts + */ + + +#ifdef USE_QT + + +#ifndef __bbqtQLayoutSplit_h__ +#define __bbqtQLayoutSplit_h__ + +#include "bbtkQtBlackBox.h" +#include "bbqt_EXPORT.h" + +namespace bbqt +{ + + + + + //================================================================= + class bbqt_EXPORT LayoutSplit : public bbtk::QtBlackBox + { + + BBTK_BLACK_BOX_INTERFACE(LayoutSplit,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(Weight1,int); + BBTK_DECLARE_INPUT(Weight2,int); + BBTK_DECLARE_INPUT(Weight3,int); + BBTK_DECLARE_INPUT(Weight4,int); + BBTK_DECLARE_INPUT(Weight5,int); + BBTK_DECLARE_INPUT(Weight6,int); + BBTK_DECLARE_INPUT(Weight7,int); + BBTK_DECLARE_INPUT(Weight8,int); + BBTK_DECLARE_INPUT(Weight9,int); + + BBTK_DECLARE_INPUT(Orientation,std::string); + // BBTK_DECLARE_INPUT(Proportion,int); + BBTK_PROCESS(Process); + BBTK_CREATE_WIDGET(CreateWidget); + BBTK_ON_SHOW_WIDGET(OnShowWidget); + + void Process(); + void CreateWidget(QWidget*); + void OnShowWidget(); + + protected: + virtual void bbUserConstructor(); + + }; + //================================================================= + + + //================================================================= + // BlackBox description + BBTK_BEGIN_DESCRIBE_BLACK_BOX(LayoutSplit,bbtk::QtBlackBox); + BBTK_NAME("QLayoutSplit"); + BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr"); + BBTK_DESCRIPTION("Widget which splits a window in two resizable parts (QSplitter)"); + BBTK_INPUT(LayoutSplit,Widget1,"First widget to layout (upper or left most)",QWidget*,""); + BBTK_INPUT(LayoutSplit,Widget2,"Second widget",QWidget*,""); + BBTK_INPUT(LayoutSplit,Widget3,"Third widget",QWidget*,""); + BBTK_INPUT(LayoutSplit,Widget4,"Fourth widget",QWidget*,""); + BBTK_INPUT(LayoutSplit,Widget5,"Fifth widget",QWidget*,""); + BBTK_INPUT(LayoutSplit,Widget6,"Sixth widget",QWidget*,""); + BBTK_INPUT(LayoutSplit,Widget7,"Seventh widget",QWidget*,""); + BBTK_INPUT(LayoutSplit,Widget8,"Eighth widget",QWidget*,""); + BBTK_INPUT(LayoutSplit,Widget9,"Nineth widget",QWidget*,""); + + BBTK_INPUT(LayoutSplit,Weight1,"Weight of the widget 1",int,""); + BBTK_INPUT(LayoutSplit,Weight2,"Weight of the widget 2",int,""); + BBTK_INPUT(LayoutSplit,Weight3,"Weight of the widget 3",int,""); + BBTK_INPUT(LayoutSplit,Weight4,"Weight of the widget 4",int,""); + BBTK_INPUT(LayoutSplit,Weight5,"Weight of the widget 5",int,""); + BBTK_INPUT(LayoutSplit,Weight6,"Weight of the widget 6",int,""); + BBTK_INPUT(LayoutSplit,Weight7,"Weight of the widget 7",int,""); + BBTK_INPUT(LayoutSplit,Weight8,"Weight of the widget 8",int,""); + BBTK_INPUT(LayoutSplit,Weight9,"Weight of the widget 9",int,""); + + + BBTK_INPUT(LayoutSplit,Orientation,"Orientation (default H), 0=H=HORIZONTAL , 1=V=VERTICAL",std::string,""); + // BBTK_INPUT(LayoutSplit,Proportion,"Proportion (in percent) of the first children in the window",int,""); + BBTK_END_DESCRIBE_BLACK_BOX(LayoutSplit); + //================================================================= +} + +//namespace bbqt +#endif //__bbqtQtLayoutSplit_h__ + +#endif //USE_QT diff --git a/packages/qt/src/bbqtQOutputText.cxx b/packages/qt/src/bbqtOutputText.cxx similarity index 96% rename from packages/qt/src/bbqtQOutputText.cxx rename to packages/qt/src/bbqtOutputText.cxx index b7fbad5..aa8a14b 100644 --- a/packages/qt/src/bbqtQOutputText.cxx +++ b/packages/qt/src/bbqtOutputText.cxx @@ -1,4 +1,4 @@ -#include "bbqtQOutputText.h" +#include "bbqtOutputText.h" #include "bbqtPackage.h" #include diff --git a/packages/qt/src/bbqtQOutputText.h b/packages/qt/src/bbqtOutputText.h similarity index 100% rename from packages/qt/src/bbqtQOutputText.h rename to packages/qt/src/bbqtOutputText.h diff --git a/packages/qt/src/bbqtQLayoutLine.cxx~ b/packages/qt/src/bbqtQLayoutLine.cxx~ deleted file mode 100644 index 9ef5f7d..0000000 --- a/packages/qt/src/bbqtQLayoutLine.cxx~ +++ /dev/null @@ -1,140 +0,0 @@ -/*========================================================================= - 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~ deleted file mode 100644 index 63388ef..0000000 --- a/packages/qt/src/bbqtQLayoutLine.h~ +++ /dev/null @@ -1,123 +0,0 @@ -/*========================================================================= - 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~ deleted file mode 100644 index 451bf3f..0000000 --- a/packages/qt/src/bbqtQOutputText.cxx~ +++ /dev/null @@ -1,57 +0,0 @@ -#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~ deleted file mode 100644 index 2b0153f..0000000 --- a/packages/qt/src/bbqtQOutputText.h~ +++ /dev/null @@ -1,44 +0,0 @@ -#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~ deleted file mode 100644 index 3a5fccf..0000000 --- a/packages/qt/src/bbqtQSlider.cxx~ +++ /dev/null @@ -1,482 +0,0 @@ -/*========================================================================= - 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 -{ - - /* - //-------------------------------------------------------------------------- - // The widget created by the box - class SliderWidget : public qtPanel - { - public: - /// Ctor with the two first params the parent window and the creator box - /// which must be passed to the QtBlackBoxWidget constructor. - /// The other params initialize the widget - SliderWidget(Slider* box, qtWindow *parent, - int orientation, - bool changeresolution, - bool label, - qtString title, - int vmin, - int vmax, - int value, - bool track); - /// Dtor - ~SliderWidget(); - /// Events callbacks - /// Called when the slider is moved - void OnSliderTrack(qtScrollEvent& event); - /// Called when the slider is released - void OnSliderRelease(qtScrollEvent& event); - /// Called when the little slider which controls the resolution - /// of the main slider is moved (if activated) - void OnResolutionOfSlider(qtScrollEvent& event); - - // Accessors - void SetValue(int v) { mqtSlider->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 "<