2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
28 /*=========================================================================
30 Module: $RCSfile: bbqtLayoutLine.cxx,v $
32 Date: $Date: 2012/11/16 08:51:19 $
33 Version: $Revision: 1.4 $
34 =========================================================================*/
47 #include "bbqtLayoutLine.h"
48 #include "bbqtPackage.h"
49 #include "bbtkUtilities.h"
55 BBTK_ADD_BLACK_BOX_TO_PACKAGE(qt, LayoutLine);
56 BBTK_BLACK_BOX_IMPLEMENTATION(LayoutLine,bbtk::QtBlackBox);
58 void LayoutLine::bbUserSetDefaultValues()
60 bbSetInputOrientation("VERTICAL");
61 bbSetInputWidget1(NULL);
62 bbSetInputWidget2(NULL);
63 bbSetInputWidget3(NULL);
64 bbSetInputWidget4(NULL);
65 bbSetInputWidget5(NULL);
66 bbSetInputWidget6(NULL);
67 bbSetInputWidget7(NULL);
68 bbSetInputWidget8(NULL);
69 bbSetInputWidget9(NULL);
72 void LayoutLine::bbUserInitializeProcessing()
76 void LayoutLine::bbUserFinalizeProcessing()
81 void LayoutLine::Process()
87 void LayoutLine::CreateWidget(QWidget* parent)
89 QWidget *w = new QWidget(parent);
90 QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
91 sizePolicy.setHorizontalStretch(1);
92 sizePolicy.setVerticalStretch(1);
93 sizePolicy.setHeightForWidth(parent->sizePolicy().hasHeightForWidth());
94 w->setSizePolicy(sizePolicy);
96 QBoxLayout::Direction dir;
97 if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
98 "0|H|HORIZONTAL")==true)
99 { dir = QBoxLayout::LeftToRight; }
100 if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
101 "1|V|VERTICAL")==true)
102 { dir = QBoxLayout::TopToBottom; }
103 QBoxLayout* l = new QBoxLayout(dir);
106 if ((cw=bbCreateWidgetOfInput("Widget1",w)) != 0) l->addWidget(cw);
107 if ((cw=bbCreateWidgetOfInput("Widget2",w)) != 0) l->addWidget(cw);
108 if ((cw=bbCreateWidgetOfInput("Widget3",w)) != 0) l->addWidget(cw);
109 if ((cw=bbCreateWidgetOfInput("Widget4",w)) != 0) l->addWidget(cw);
110 if ((cw=bbCreateWidgetOfInput("Widget5",w)) != 0) l->addWidget(cw);
111 if ((cw=bbCreateWidgetOfInput("Widget6",w)) != 0) l->addWidget(cw);
112 if ((cw=bbCreateWidgetOfInput("Widget7",w)) != 0) l->addWidget(cw);
113 if ((cw=bbCreateWidgetOfInput("Widget8",w)) != 0) l->addWidget(cw);
114 if ((cw=bbCreateWidgetOfInput("Widget9",w)) != 0) l->addWidget(cw);
120 bbSetOutputWidget( w );
123 // This callback is necessary to get actual processing of the view
124 // when window is shown
125 void LayoutLine::OnShowWidget()
128 bbUserOnShowWidget("Widget1");
129 bbUserOnShowWidget("Widget2");
130 bbUserOnShowWidget("Widget3");
131 bbUserOnShowWidget("Widget4");
132 bbUserOnShowWidget("Widget5");
133 bbUserOnShowWidget("Widget6");
134 bbUserOnShowWidget("Widget7");
135 bbUserOnShowWidget("Widget8");
136 bbUserOnShowWidget("Widget9");