bbtkKWBlackBox.cxx

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkKWBlackBox.cxx,v $
00004   Language:  C++
00005   Date:      $Date: 2010/01/14 13:17:27 $
00006   Version:   $Revision: 1.10 $
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_KWWIDGETS
00036 
00037 #include "bbtkKWBlackBox.h"
00038 #include "bbtkBlackBoxOutputConnector.h"
00039 #include "vtkKWBlackBoxDialog.h"
00040 
00041 namespace bbtk
00042 {
00043   //=========================================================================
00044   // KWBlackBox
00045   //=========================================================================
00046 
00047   //=========================================================================
00048   //=========================================================================
00049   //=========================================================================
00050   //=========================================================================
00051   BBTK_BLACK_BOX_IMPLEMENTATION(KWBlackBox,WidgetBlackBox<wxWindow>);
00052   //=========================================================================
00053   
00054   //==================================================================    
00056   void WxBlackBox::bbCreateDialogWindow()
00057   {
00058     KW::GetApplication();
00059     vtkKWBlackBoxDialog* win = vtkKWBlackBoxDialog::New();
00060     show = (Window*) win;
00061     win->bbSetBlackBox( GetThisPointer<KWBlackBox>());
00062     KW::GetApplication()->AddWindow((vtkKWWindowBase*)win);
00063     win->Create();
00064     win->SetResizable(0,0);
00065     
00066     bbUserCreateWidget(win->GetFrame());
00067     /*
00068       KW::GetApplication()->Script
00069       ("pack %s -expand yes -fill both",
00070       bbGetOutputWidget()->GetWidgetName());
00071     */
00072     
00073     KW::GetApplication()->Script("place %s -x 0 -y 0 -width %d -height %d",
00074                                  bbGetOutputWidget()->GetWidgetName(),
00075                                  bbGetInputWinWidth(),
00076                                  bbGetInputWinHeight());
00077   }
00078   //==================================================================    
00079 
00080   //==================================================================    
00082   void WxBlackBox::bbCreateFrameWindow()
00083   {
00084     bbtkWarning("KW: Frame windows not supported: creating a Dialog!");
00085     bbCreateDialogWindow();
00086   }
00087   //==================================================================    
00088 
00089 
00090   //==================================================================
00091   vtkKWWidget*  KWBlackBox::bbCreateWidgetOfInput(const std::string& in, 
00092                                                   vtkKWFrame* parent)
00093   {
00094     vtkKWWidget* w = 0;
00095     // If input is connected 
00096     BlackBoxInputConnector* c = bbGetInputConnectorMap().find(in)->second ;
00097     if ( c->IsConnected() )                     
00098       {
00099         // Get black box from 
00100         BlackBox::Pointer from = 
00101           c->GetConnection()->GetBlackBoxFrom();
00102         // Cast it into a KWBlackBox
00103         KWBlackBox::Pointer wfrom = boost::dynamic_pointer_cast<KWBlackBox>(from);
00104         // Call bbCreateWidget
00105         wfrom->bbUserCreateWidget(parent);
00106         // Get the widget created
00107         w = wfrom->bbGetOutputWidget();
00108       }
00109     return w;
00110   }
00111   //==================================================================
00112 
00113 
00114   //==================================================================
00115   //  void KWBlackBox::InitWindowManagerIfNeeded() { KW::
00116   void KWBlackBox::IncNbWindowsAlive() { KW::IncNbWindowsAlive(); }
00117   void KWBlackBox::DecNbWindowsAlive() { KW::DecNbWindowsAlive(); }
00118   int  KWBlackBox::GetNbWindowsAlive() { return KW::GetNbWindowsAlive(); }
00119   bool KWBlackBox::IsSomeWindowAlive() { return KW::IsSomeWindowAlive(); }
00120   
00121   void KWBlackBox::IncNbWindowsShown() { KW::IncNbWindowsShown(); }
00122   void KWBlackBox::DecNbWindowsShown() { KW::DecNbWindowsShown(); }
00123   int  KWBlackBox::GetNbWindowsShown() { return KW::GetNbWindowsShown(); }
00124   bool KWBlackBox::IsSomeWindowShown() { return KW::GetNbWindowsShown(); }
00125   //==================================================================
00126   
00127 }//namespace bbtk
00128 
00129 #endif
00130 

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