1 /*=========================================================================
3 Module: $RCSfile: bbqtLayoutSplit.cxx,v $
5 Date: $Date: 2009/04/08 08:35:59 $
6 Version: $Revision: 1.1 $
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
14 * This software is governed by the CeCILL-B license under French law and
15 * abiding by the rules of distribution of free software. You can use,
16 * modify and/ or redistribute the software under the terms of the CeCILL-B
17 * license as circulated by CEA, CNRS and INRIA at the following URL
18 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
19 * or in the file LICENSE.txt.
21 * As a counterpart to the access to the source code and rights to copy,
22 * modify and redistribute granted by the license, users are provided only
23 * with a limited warranty and the software's author, the holder of the
24 * economic rights, and the successive licensors have only limited
27 * The fact that you are presently reading this means that you have had
28 * knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */
39 #include "bbqtLayoutSplit.h"
40 #include "bbqtPackage.h"
41 #include "bbtkUtilities.h"
47 BBTK_ADD_BLACK_BOX_TO_PACKAGE(qt,LayoutSplit);
48 BBTK_BLACK_BOX_IMPLEMENTATION(LayoutSplit,bbtk::QtBlackBox);
50 void LayoutSplit::bbUserConstructor()
52 bbSetInputOrientation("VERTICAL");
53 // bbSetInputProportion(50);
55 bbSetInputWidget1(NULL);
56 bbSetInputWidget2(NULL);
57 bbSetInputWidget3(NULL);
58 bbSetInputWidget4(NULL);
59 bbSetInputWidget5(NULL);
60 bbSetInputWidget6(NULL);
61 bbSetInputWidget7(NULL);
62 bbSetInputWidget8(NULL);
63 bbSetInputWidget9(NULL);
76 void LayoutSplit::Process()
80 void LayoutSplit::CreateWidget(QWidget* parent)
83 if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
84 "0|H|HORIZONTAL")==true)
85 { ori = Qt::Horizontal; }
86 if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
87 "1|V|VERTICAL")==true)
88 { ori = Qt::Vertical; }
90 QSplitter* w = new QSplitter(ori,parent);
93 if ((c=bbCreateWidgetOfInput("Widget1",w))!=0)
96 w->setStretchFactor(i,bbGetInputWeight1());
99 if ((c=bbCreateWidgetOfInput("Widget2",w))!=0)
102 w->setStretchFactor(i,bbGetInputWeight2());
105 if ((c=bbCreateWidgetOfInput("Widget3",w))!=0)
108 w->setStretchFactor(i,bbGetInputWeight3());
111 if ((c=bbCreateWidgetOfInput("Widget4",w))!=0)
114 w->setStretchFactor(i,bbGetInputWeight4());
117 if ((c=bbCreateWidgetOfInput("Widget5",w))!=0)
120 w->setStretchFactor(i,bbGetInputWeight5());
123 if ((c=bbCreateWidgetOfInput("Widget6",w))!=0)
126 w->setStretchFactor(i,bbGetInputWeight6());
129 if ((c=bbCreateWidgetOfInput("Widget7",w))!=0)
132 w->setStretchFactor(i,bbGetInputWeight7());
135 if ((c=bbCreateWidgetOfInput("Widget8",w))!=0)
138 w->setStretchFactor(i,bbGetInputWeight8());
141 if ((c=bbCreateWidgetOfInput("Widget9",w))!=0)
144 w->setStretchFactor(i,bbGetInputWeight9());
148 bbSetOutputWidget( w );
152 // This callback is necessary to get actual processing of the view
153 // when window is shown
154 void LayoutSplit::OnShowWidget()
156 bbUserOnShowWidget("Widget1");
157 bbUserOnShowWidget("Widget2");
158 bbUserOnShowWidget("Widget3");
159 bbUserOnShowWidget("Widget4");
160 bbUserOnShowWidget("Widget5");
161 bbUserOnShowWidget("Widget6");
162 bbUserOnShowWidget("Widget7");
163 bbUserOnShowWidget("Widget8");
164 bbUserOnShowWidget("Widget9");