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 # ------------------------------------------------------------------------ */
30 #include "vtkKWBlackBoxDialog.h"
32 #include "vtkObjectFactory.h"
34 //=========================================================================
35 // vtkKWBlackBoxWindow
36 //=========================================================================
40 //=========================================================================
41 vtkKWBlackBoxWindow::vtkKWBlackBoxWindow()
44 bbtkDebugMessage("kw",9,"vtkKWBlackBoxWindow::vtkKWBlackBoxWindow()"
46 bbtk::KW::IncNbWindowsAlive();
48 //=========================================================================
52 //=========================================================================
53 vtkKWBlackBoxWindow::~vtkKWBlackBoxWindow()
55 bbtkDebugMessage("kw",9,"vtkKWBlackBoxWindow::~vtkKWBlackBoxWindow() "
58 bbtk::KW::DecNbWindowsAlive();
61 mBox.lock()->bbSetWindow(0);
64 //=========================================================================
67 //=========================================================================
68 void vtkKWBlackBoxWindow::bbShow()
70 if (bbIsShown()) return;
71 bbtkDebugMessage("kw",9,"vtkKWBlackBoxWindow::bbShow()"<<std::endl);
72 bbtk::KW::IncNbWindowsShown();
75 //=========================================================================
77 //=========================================================================
78 void vtkKWBlackBoxWindow::bbHide()
80 if (!bbIsShown()) return;
81 bbtkDebugMessage("kw",9,"vtkKWBlackBoxWindow::bbHide()"<<std::endl);
82 bbtk::KW::DecNbWindowsShown();
85 //=========================================================================
87 //=========================================================================
88 void vtkKWBlackBoxWindow::bbClose()
91 //=========================================================================
94 //=========================================================================
95 // vtkKWBlackBoxDialog
96 //=========================================================================
98 //-------------------------------------------------------------------------
99 vtkStandardNewMacro( vtkKWBlackBoxDialog );
100 vtkCxxRevisionMacro( vtkKWBlackBoxDialog, "$Revision: 1.4 $");
101 //-------------------------------------------------------------------------
103 //=========================================================================
104 vtkKWBlackBoxDialog::vtkKWBlackBoxDialog()
107 bbtkDebugMessage("kw",9,"vtkKWBlackBoxDialog::vtkKWBlackBoxDialog()"
109 bbtk::KW::IncNbWindowsAlive();
110 this->mFrame = vtkKWFrame::New();
112 //=========================================================================
113 //=========================================================================
114 vtkKWBlackBoxDialog::~vtkKWBlackBoxDialog()
116 bbtkDebugMessage("kw",9,"~vtkKWBlackBoxDialog()"<<std::endl);
117 this->mFrame->Delete();
119 bbtk::KW::DecNbWindowsAlive();
122 mBox.lock()->bbSetWindow(0);
125 //=========================================================================
127 //=========================================================================
128 void vtkKWBlackBoxDialog::CreateWidget()
130 bbtkDebugMessage("kw",5,"vtkKWBlackBoxDialog::CreateWidget() ["
131 <<bbGetBlackBox()->bbGetFullName()<<"]"<<std::endl);
132 if (this->IsCreated())
134 vtkErrorMacro("vtkKWBlackBoxDialog already created");
138 this->Superclass::CreateWidget();
140 this->SetTitle((bbGetBlackBox()->bbGetInputWinTitle()+" - bbtk (c) CREATIS").c_str());
142 this->mFrame->SetParent(this);
143 this->mFrame->Create();
144 this->mFrame->SetWidth ( bbGetBlackBox()->bbGetInputWinWidth() );
145 this->mFrame->SetHeight ( bbGetBlackBox()->bbGetInputWinHeight() );
147 this->Script("pack %s -side top -expand true",
148 this->mFrame->GetWidgetName());
150 //=========================================================================
153 //=========================================================================
154 void vtkKWBlackBoxDialog::Pack()
156 this->Script("pack %s -side top -expand true",
157 this->mFrame->GetWidgetName());
159 //=========================================================================
161 //=========================================================================
162 void vtkKWBlackBoxDialog::Cancel()
164 bbtkDebugMessage("kw",9,"vtkKWBlackBoxDialog::Cancel()"<<std::endl);
169 this->Done = vtkKWDialog::StatusCanceled;
170 // std::cout << "REFS= "<<this->GetReferenceCount()<<std::endl;
171 // std::cout << "WINS= "<<this->GetApplication()->GetNumberOfWindows ()<<std::endl;
175 //=========================================================================
178 //=========================================================================
179 void vtkKWBlackBoxDialog::bbShow()
181 if (bbIsShown()) return;
182 bbtkDebugMessage("kw",5,"vtkKWBlackBoxDialog::bbShow() ["
183 <<bbGetBlackBox()->bbGetFullName()<<"]"<<std::endl);
184 bbtk::KW::IncNbWindowsShown();
186 // vtkKWBlackBoxWindow::bbShow();
187 //SetReturnCode( kwDialog::ShowModal() );
192 //=========================================================================
194 //=========================================================================
195 void vtkKWBlackBoxDialog::bbHide()
197 bbtkDebugMessage("kw",9,"vtkKWBlackBoxDialog::bbHide()"<<std::endl);
198 // vtkKWBlackBoxWindow::bbHide();
199 bbtk::KW::DecNbWindowsShown();
204 //=========================================================================
206 //=========================================================================
207 void vtkKWBlackBoxDialog::bbClose()
209 bbtkDebugMessage("kw",9,"vtkKWBlackBoxDialog::bbClose()"<<std::endl);
210 this->Done = vtkKWDialog::StatusCanceled;
211 // this->Withdraw(); // this->Delete();
213 //=========================================================================
220 //=========================================================================
221 // vtkKWBlackBoxFrame
222 //=========================================================================
224 //-------------------------------------------------------------------------
225 vtkStandardNewMacro( vtkKWBlackBoxFrame );
226 vtkCxxRevisionMacro(vtkKWBlackBoxFrame, "$Revision: 1.4 $");
227 //-------------------------------------------------------------------------
228 //=========================================================================
229 vtkKWBlackBoxFrame::vtkKWBlackBoxFrame()
231 bbtkDebugMessage("kw",9,"vtkKWBlackBoxFrame::vtkKWBlackBoxFrame()"<<std::endl);
233 //=========================================================================
235 //=========================================================================
236 vtkKWBlackBoxFrame::~vtkKWBlackBoxFrame()
239 //=========================================================================
241 //=========================================================================
242 void vtkKWBlackBoxFrame::bbShow()
244 if (bbIsShown()) return;
245 bbtkDebugMessage("kw",5,"vtkKWBlackBoxFrame::bbShow("
246 <<bbGetBlackBox()->bbGetFullName()<<")"<<std::endl);
247 vtkKWBlackBoxWindow::bbShow();
248 // vtkKWFrame::Show();
250 // This Update is ** MANDATORY **
251 // to synchronize kwvtkRenderWindowInteractor objects
252 // (force kw objects creation **NOW**)
254 if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnShow();
256 //=========================================================================
258 //=========================================================================
259 void vtkKWBlackBoxFrame::bbHide()
261 bbtkDebugMessage("kw",9,"vtkKWBlackBoxFrame::bbHide()"<<std::endl);
262 vtkKWBlackBoxWindow::bbHide();
263 // vtkKWFrame::Hide();
265 if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnHide();
267 //=========================================================================
269 //=========================================================================
270 void vtkKWBlackBoxFrame::bbClose()
272 bbtkDebugMessage("kw",9,"vtkKWBlackBoxFrame::bbClose()"<<std::endl);
273 // vtkKWFrame::Close();
276 //=========================================================================