bbtkQtBlackBox.cxx

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkQtBlackBox.cxx,v $
00004   Language:  C++
00005   Date:      $Date: 2009/05/28 14:22:10 $
00006   Version:   $Revision: 1.3 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013 *
00014 *  This software is governed by the CeCILL-B license under French law and 
00015 *  abiding by the rules of distribution of free software. You can  use, 
00016 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
00017 *  license as circulated by CEA, CNRS and INRIA at the following URL 
00018 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
00019 *  or in the file LICENSE.txt.
00020 *
00021 *  As a counterpart to the access to the source code and  rights to copy,
00022 *  modify and redistribute granted by the license, users are provided only
00023 *  with a limited warranty  and the software's author,  the holder of the
00024 *  economic rights,  and the successive licensors  have only  limited
00025 *  liability. 
00026 *
00027 *  The fact that you are presently reading this means that you have had
00028 *  knowledge of the CeCILL-B license and that you accept its terms.
00029 * ------------------------------------------------------------------------ */                                                                         
00035 #ifdef USE_QT
00036 
00037 
00038 #include "bbtkQtBlackBox.h"
00039 //#include "bbtkBlackBoxOutputConnector.h"
00040 //#include "bbtkQtBlackBoxDialog.h"
00041 #include "bbtkQtBlackBoxDialog.h"
00042 
00043 
00044 namespace bbtk
00045 {
00046 
00047 
00048 
00049   //=========================================================================
00050   // QtBlackBox
00051   //=========================================================================
00052 
00053   //=========================================================================
00054   //=========================================================================
00055   //=========================================================================
00056   //=========================================================================
00057   BBTK_BLACK_BOX_IMPLEMENTATION(QtBlackBox,WidgetBlackBox<QWidget>);
00058   //=========================================================================
00059   
00060   //==================================================================    
00062   void QtBlackBox::bbCreateDialogWindow()
00063   {
00064     Qt::CreateQtAppIfNeeded();
00065     QtBlackBoxDialog* w = 0;  
00066     w = new QtBlackBoxDialog( GetThisPointer<QtBlackBox>(),
00067                               0, 
00068                               bbGetInputWinTitle() 
00069                               + " - bbtk (c) CREATIS LRMN",
00070                               bbGetInputWinWidth() , 
00071                               bbGetInputWinHeight()  );
00072   }
00073   //==================================================================    
00074 
00075   //==================================================================    
00077   void QtBlackBox::bbCreateFrameWindow()
00078   {
00079     
00080     this->bbCreateDialogWindow();
00081 
00082   }
00083   //==================================================================    
00084 
00085   //==================================================================    
00086   void QtBlackBox::bbUserSetDefaultValues()
00087   {
00088     bbtkBlackBoxDebugMessage("widget",5,"QtBlackBox::bbUserSetDefaultValues()"<<std::endl);
00089     bbmWindow = 0;
00090   }
00091   //==================================================================    
00092 
00093   //==================================================================    
00094   void QtBlackBox::bbUserInitializeProcessing()
00095   {
00096   }
00097   //==================================================================    
00098  
00099   //==================================================================    
00100   void QtBlackBox::bbUserFinalizeProcessing()
00101   {
00102     bbtkBlackBoxDebugMessage("widget",5,"==> QtBlackBox::bbUserFinalizeProcessing()"<<std::endl);
00103     bbDestroyWindow();
00104     bbtkBlackBoxDebugMessage("widget",5,"<== QtBlackBox::bbUserFinalizeProcessing()"<<std::endl);
00105   }
00106   //==================================================================    
00107    
00108   //==================================================================    
00109   void QtBlackBox::bbSetWindow(QWidget* w) 
00110   {
00111     bbtkBlackBoxDebugMessage("widget",9,"==> QtBlackBox::bbSetWindow("<<w<<")"<<std::endl);
00112     if ((bbmWindow != 0)&&(w!=0)) 
00113       { 
00114         std::cout << "ERRRRRRRROOOOR"<<std::endl; 
00115       }
00116     bbmWindow = w;
00117   }
00118   //==================================================================    
00119 
00120   //==================================================================    
00121   void QtBlackBox::bbShowWindow()
00122   {
00123     if ((bbmWindow) && (!bbIsShown()))
00124       {
00125         bbtkBlackBoxDebugMessage("widget",3,"==> QtBlackBox::bbShowWindow()"
00126                          <<std::endl);
00127         if (bbGetInputWinDialog()) 
00128           {
00129             bbmWindow->updateGeometry();
00130             ((QDialog*)bbmWindow)->exec();
00131             bbDestroyWindow();  
00132           }
00133         else
00134           {
00135             bbmWindow->updateGeometry();
00136             ((QDialog*)bbmWindow)->exec();
00137             bbSetShown(true);
00138           } 
00139     }
00140   }
00141   //==================================================================    
00142 
00143   //==================================================================    
00144   void QtBlackBox::bbDestroyWindow()
00145   {
00146     bbtkBlackBoxDebugMessage("widget",3,"==> QtBlackBox::bbDestroyWindow("<<bbmWindow<<")"<<std::endl);
00147     if (bbGetWindow()!=NULL) 
00148       {
00149         //       wxWindow* w = bbGetWindow();
00150         //bbSetWindow(0);
00151         // WE SHOULD DESTROY THE WINDOW WITH THE Close METHOD
00152         // HOWEVER I
00153         //w->Close(true);
00154         //
00155         delete bbGetWindow();
00156         bbSetShown(false);
00157       }
00158     bbtkBlackBoxDebugMessage("widget",3,"<== QtBlackBox::bbDestroyWindow("<<bbmWindow<<")"<<std::endl);
00159 
00160   }
00161   //==================================================================    
00162 
00163   //==================================================================
00164   //  void QtBlackBox::InitWindowManagerIfNeeded() { Qt::
00165   void QtBlackBox::IncNbWindowsAlive() { Qt::IncNbWindowsAlive(); }
00166   void QtBlackBox::DecNbWindowsAlive() { Qt::DecNbWindowsAlive(); }
00167   int  QtBlackBox::GetNbWindowsAlive() { return Qt::GetNbWindowsAlive(); }
00168   bool QtBlackBox::IsSomeWindowAlive() { return Qt::IsSomeWindowAlive(); }
00169   
00170   void QtBlackBox::IncNbWindowsShown() { Qt::IncNbWindowsShown(); }
00171   void QtBlackBox::DecNbWindowsShown() { Qt::DecNbWindowsShown(); }
00172   int  QtBlackBox::GetNbWindowsShown() { return Qt::GetNbWindowsShown(); }
00173   bool QtBlackBox::IsSomeWindowShown() { return Qt::GetNbWindowsShown(); }
00174   //==================================================================
00175   
00176 
00177 
00178 
00179 }//namespace bbtk
00180 
00181 
00182 #endif
00183 

Generated on Thu May 31 14:12:03 2012 for BBTK by  doxygen 1.5.7.1