]> Creatis software - bbtk.git/blobdiff - kernel/src/vtkKWBlackBoxDialog.cxx
#2853 BBTK Feature New Normal - std:FilesFromDirectory box add option to create...
[bbtk.git] / kernel / src / vtkKWBlackBoxDialog.cxx
index d7ca41b2046b55d5ccc524b1610f901bd1790525..ccc9fe47be023563036559af174986917fd1a31d 100644 (file)
@@ -1,3 +1,30 @@
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ #                        pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ #  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.
+ # ------------------------------------------------------------------------ */
+
+
 #ifdef USE_KWWIDGETS
 
 #include "vtkKWBlackBoxDialog.h"
   
   //-------------------------------------------------------------------------
   vtkStandardNewMacro( vtkKWBlackBoxDialog );
-  vtkCxxRevisionMacro( vtkKWBlackBoxDialog, "$Revision: 1.1 $");
+  vtkCxxRevisionMacro( vtkKWBlackBoxDialog, "$Revision: 1.4 $");
   //-------------------------------------------------------------------------
 
   //=========================================================================
-  vtkKWBlackBoxDialog::vtkKWBlackBoxDialog() 
-    : mShown(false)
+vtkKWBlackBoxDialog::vtkKWBlackBoxDialog() 
+  : mShown(false)
+{
+  bbtkDebugMessage("kw",9,"vtkKWBlackBoxDialog::vtkKWBlackBoxDialog()"
+                  <<std::endl);
+  bbtk::KW::IncNbWindowsAlive();
+  this->mFrame = vtkKWFrame::New();
+}
+//=========================================================================
+  //=========================================================================
+  vtkKWBlackBoxDialog::~vtkKWBlackBoxDialog()
   {
-    bbtkDebugMessage("kw",9,"vtkKWBlackBoxDialog::vtkKWBlackBoxDialog()"
-                    <<std::endl);
-    bbtk::KW::IncNbWindowsAlive();
+    bbtkDebugMessage("kw",9,"~vtkKWBlackBoxDialog()"<<std::endl);
+    this->mFrame->Delete();
+    bbHide();
+    bbtk::KW::DecNbWindowsAlive();
+    if (!mBox.expired())
+      {
+       mBox.lock()->bbSetWindow(0);
+      }
   }
   //=========================================================================
+
+//=========================================================================
+void vtkKWBlackBoxDialog::CreateWidget()
+{
+  bbtkDebugMessage("kw",5,"vtkKWBlackBoxDialog::CreateWidget() ["
+                  <<bbGetBlackBox()->bbGetFullName()<<"]"<<std::endl);
+  if (this->IsCreated())
+    {
+      vtkErrorMacro("vtkKWBlackBoxDialog already created");
+      return;
+    }
+  
+  this->Superclass::CreateWidget();
   
+  this->SetTitle((bbGetBlackBox()->bbGetInputWinTitle()+"            - bbtk (c) CREATIS").c_str());
+
+  this->mFrame->SetParent(this);
+  this->mFrame->Create();
+  this->mFrame->SetWidth ( bbGetBlackBox()->bbGetInputWinWidth() );
+  this->mFrame->SetHeight ( bbGetBlackBox()->bbGetInputWinHeight() );
+
+  this->Script("pack %s -side top -expand true",
+               this->mFrame->GetWidgetName());
+}
+//=========================================================================
+
+/*
+//=========================================================================
+void vtkKWBlackBoxDialog::Pack()
+{
+  this->Script("pack %s -side top -expand true",
+               this->mFrame->GetWidgetName());
+}
+//=========================================================================
+*/
+ //=========================================================================
+  void vtkKWBlackBoxDialog::Cancel()
+  {
+    bbtkDebugMessage("kw",9,"vtkKWBlackBoxDialog::Cancel()"<<std::endl);
+    //    this->Delete();
+
+    //    this->Withdraw();
+    bbHide();
+    this->Done = vtkKWDialog::StatusCanceled;
+    //    std::cout << "REFS= "<<this->GetReferenceCount()<<std::endl;
+    //    std::cout << "WINS= "<<this->GetApplication()->GetNumberOfWindows ()<<std::endl;
+    //    this->Delete();
+    
+  }
   //=========================================================================
+  
+//=========================================================================
   void vtkKWBlackBoxDialog::bbShow()
   { 
     if (bbIsShown()) return;
   }
   //=========================================================================
 
-  //=========================================================================
-  void vtkKWBlackBoxDialog::Cancel()
-  {
-    bbtkDebugMessage("kw",9,"vtkKWBlackBoxDialog::Cancel()"<<std::endl);
-    //    this->Delete();
-
-    //    this->Withdraw();
-    bbHide();
-    this->Done = vtkKWDialog::StatusCanceled;
-    //    std::cout << "REFS= "<<this->GetReferenceCount()<<std::endl;
-    //    std::cout << "WINS= "<<this->GetApplication()->GetNumberOfWindows ()<<std::endl;
-    //    this->Delete();
-    
-  }
-  //=========================================================================
-  
-  //=========================================================================
-  vtkKWBlackBoxDialog::~vtkKWBlackBoxDialog()
-  {
-    bbtkDebugMessage("kw",9,"~vtkKWBlackBoxDialog()"<<std::endl);
-    bbHide();
-    bbtk::KW::DecNbWindowsAlive();
-    if (!mBox.expired())
-      {
-       mBox.lock()->bbSetWindow(0);
-      }
-  }
-  //=========================================================================
 
 
 /*
 
   //-------------------------------------------------------------------------
   vtkStandardNewMacro( vtkKWBlackBoxFrame );
-  vtkCxxRevisionMacro(vtkKWBlackBoxFrame, "$Revision: 1.1 $");
+  vtkCxxRevisionMacro(vtkKWBlackBoxFrame, "$Revision: 1.4 $");
   //-------------------------------------------------------------------------
   //=========================================================================
   vtkKWBlackBoxFrame::vtkKWBlackBoxFrame()