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: bbtkQtBlackBox.cxx,v $
32 Date: $Date: 2012/11/16 08:49:01 $
33 Version: $Revision: 1.4 $
34 =========================================================================*/
45 #include "bbtkQtBlackBox.h"
46 //#include "bbtkBlackBoxOutputConnector.h"
47 //#include "bbtkQtBlackBoxDialog.h"
48 #include "bbtkQtBlackBoxDialog.h"
56 //=========================================================================
58 //=========================================================================
60 //=========================================================================
61 //=========================================================================
62 //=========================================================================
63 //=========================================================================
64 BBTK_BLACK_BOX_IMPLEMENTATION(QtBlackBox,WidgetBlackBox<QWidget>);
65 //=========================================================================
67 //==================================================================
68 /// Callback for creating a Dialog window (modal)
69 void QtBlackBox::bbCreateDialogWindow()
71 Qt::CreateQtAppIfNeeded();
72 QtBlackBoxDialog* w = 0;
73 w = new QtBlackBoxDialog( GetThisPointer<QtBlackBox>(),
76 + " - bbtk (c) CREATIS LRMN",
77 bbGetInputWinWidth() ,
78 bbGetInputWinHeight() );
80 //==================================================================
82 //==================================================================
83 /// Callback for creating a Frame window
84 void QtBlackBox::bbCreateFrameWindow()
87 this->bbCreateDialogWindow();
90 //==================================================================
92 //==================================================================
93 void QtBlackBox::bbUserSetDefaultValues()
95 bbtkBlackBoxDebugMessage("widget",5,"QtBlackBox::bbUserSetDefaultValues()"<<std::endl);
98 //==================================================================
100 //==================================================================
101 void QtBlackBox::bbUserInitializeProcessing()
104 //==================================================================
106 //==================================================================
107 void QtBlackBox::bbUserFinalizeProcessing()
109 bbtkBlackBoxDebugMessage("widget",5,"==> QtBlackBox::bbUserFinalizeProcessing()"<<std::endl);
111 bbtkBlackBoxDebugMessage("widget",5,"<== QtBlackBox::bbUserFinalizeProcessing()"<<std::endl);
113 //==================================================================
115 //==================================================================
116 void QtBlackBox::bbSetWindow(QWidget* w)
118 bbtkBlackBoxDebugMessage("widget",9,"==> QtBlackBox::bbSetWindow("<<w<<")"<<std::endl);
119 if ((bbmWindow != 0)&&(w!=0))
121 std::cout << "ERRRRRRRROOOOR"<<std::endl;
125 //==================================================================
127 //==================================================================
128 void QtBlackBox::bbShowWindow()
130 if ((bbmWindow) && (!bbIsShown()))
132 bbtkBlackBoxDebugMessage("widget",3,"==> QtBlackBox::bbShowWindow()"
134 if (bbGetInputWinDialog())
136 bbmWindow->updateGeometry();
137 ((QDialog*)bbmWindow)->exec();
142 bbmWindow->updateGeometry();
143 ((QDialog*)bbmWindow)->exec();
148 //==================================================================
150 //==================================================================
151 void QtBlackBox::bbDestroyWindow()
153 bbtkBlackBoxDebugMessage("widget",3,"==> QtBlackBox::bbDestroyWindow("<<bbmWindow<<")"<<std::endl);
154 if (bbGetWindow()!=NULL)
156 // wxWindow* w = bbGetWindow();
158 // WE SHOULD DESTROY THE WINDOW WITH THE Close METHOD
162 delete bbGetWindow();
165 bbtkBlackBoxDebugMessage("widget",3,"<== QtBlackBox::bbDestroyWindow("<<bbmWindow<<")"<<std::endl);
168 //==================================================================
170 //==================================================================
171 // void QtBlackBox::InitWindowManagerIfNeeded() { Qt::
172 void QtBlackBox::IncNbWindowsAlive() { Qt::IncNbWindowsAlive(); }
173 void QtBlackBox::DecNbWindowsAlive() { Qt::DecNbWindowsAlive(); }
174 int QtBlackBox::GetNbWindowsAlive() { return Qt::GetNbWindowsAlive(); }
175 bool QtBlackBox::IsSomeWindowAlive() { return Qt::IsSomeWindowAlive(); }
177 void QtBlackBox::IncNbWindowsShown() { Qt::IncNbWindowsShown(); }
178 void QtBlackBox::DecNbWindowsShown() { Qt::DecNbWindowsShown(); }
179 int QtBlackBox::GetNbWindowsShown() { return Qt::GetNbWindowsShown(); }
180 bool QtBlackBox::IsSomeWindowShown() { return Qt::GetNbWindowsShown(); }
181 //==================================================================