X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkKWBlackBox.cxx;h=6a7ae09abc7783f91d21e651068dc4dd5b0bb8bb;hb=03cc68dd6b831aa98e1e0fad20a977ffa074be39;hp=08679361b1b485a4123fd916b7c12f5ba0e38066;hpb=0897b03d2911d6dd99259895548a44d9020f50cd;p=bbtk.git diff --git a/kernel/src/bbtkKWBlackBox.cxx b/kernel/src/bbtkKWBlackBox.cxx index 0867936..6a7ae09 100644 --- a/kernel/src/bbtkKWBlackBox.cxx +++ b/kernel/src/bbtkKWBlackBox.cxx @@ -1,32 +1,39 @@ -/*========================================================================= +/* + # --------------------------------------------------------------------- + # + # 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. + # ------------------------------------------------------------------------ */ + + +/*========================================================================= Program: bbtk Module: $RCSfile: bbtkKWBlackBox.cxx,v $ Language: C++ - Date: $Date: 2008/12/18 11:54:44 $ - Version: $Revision: 1.8 $ + Date: $Date: 2012/11/16 08:49:01 $ + Version: $Revision: 1.11 $ =========================================================================*/ -/* --------------------------------------------------------------------- -* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) -* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux -* -* 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. -* ------------------------------------------------------------------------ */ /** * \file * \brief @@ -34,18 +41,12 @@ #ifdef USE_KWWIDGETS - - - - #include "bbtkKWBlackBox.h" #include "bbtkBlackBoxOutputConnector.h" #include "vtkKWBlackBoxDialog.h" - namespace bbtk { - //========================================================================= // KWBlackBox //========================================================================= @@ -54,172 +55,48 @@ namespace bbtk //========================================================================= //========================================================================= //========================================================================= - BBTK_BLACK_BOX_IMPLEMENTATION(KWBlackBox,AtomicBlackBox); + BBTK_BLACK_BOX_IMPLEMENTATION(KWBlackBox,WidgetBlackBox); //========================================================================= - //========================================================================= - void KWBlackBox::bbUserConstructor() - { - bbtkDebugMessage("Kernel",9,"KWBlackBox::bbUserConstructor()"< KWBlackBox::bbUserDestructor() ["<bbClose(); - bbSetWindow(0); - } - bbtkDebugMessage("kw",9,"<== KWBlackBox::bbUserDestructor() ["<bbSetBlackBox( GetThisPointer()); + KW::GetApplication()->AddWindow((vtkKWWindowBase*)win); + win->Create(); + win->SetResizable(0,0); + + bbUserCreateWidget(win->GetFrame()); + /* + KW::GetApplication()->Script + ("pack %s -expand yes -fill both", + bbGetOutputWidget()->GetWidgetName()); + */ + + KW::GetApplication()->Script("place %s -x 0 -y 0 -width %d -height %d", + bbGetOutputWidget()->GetWidgetName(), + bbGetInputWinWidth(), + bbGetInputWinHeight()); } - //========================================================================= - + //================================================================== - - //========================================================================= - /** - * \brief Initialize the attributes of the class - * - */ - void KWBlackBox::bbInitAttributes() + //================================================================== + /// Callback for creating a Frame window + void WxBlackBox::bbCreateFrameWindow() { - bbmWindow = 0; - // bbmWidget = 0; - // bbSetInputWinParent(0); - bbSetInputWinTitle(bbGetName()); - bbSetInputWinWidth(800); - bbSetInputWinHeight(800); - bbSetInputWinDialog(false); - bbSetOutputWidget(0); - - // bbSetWidgetEventHandler(0); - // bbSetUpdateTransferedToParent(false); + bbtkWarning("KW: Frame windows not supported: creating a Dialog!"); + bbCreateDialogWindow(); } - //========================================================================= + //================================================================== - //========================================================================= - void KWBlackBox::bbProcess() - { - - this->bbUserProcess(); - - // If output widget not connected create the window - if ( (*bbGetOutputConnectorMap().find("Widget")).second - ->GetConnectionVector().size() == 0 ) - { - Window* show = 0; - // If the window already exists : no need creating it - if (bbGetWindow()!=0) - { - bbtkDebugMessage("kw",2, - "-> Window already exists" - < Creating the window" - <bbSetBlackBox( GetThisPointer()); - KW::GetApplication()->AddWindow((vtkKWWindowBase*)win); - win->Create(); - win->SetResizable(0,0); - - bbUserCreateWidget(win->GetFrame()); - /* - KW::GetApplication()->Script - ("pack %s -expand yes -fill both", - bbGetOutputWidget()->GetWidgetName()); - */ - - KW::GetApplication()->Script("place %s -x 0 -y 0 -width %d -height %d", - bbGetOutputWidget()->GetWidgetName(), - bbGetInputWinWidth(), - bbGetInputWinHeight()); - - - - - - /* - bbGetOutputWidget()->SetParent(win); - bbGetOutputWidget()->Create(); - KW::GetApplication()->Script("pack %s -side left -anchor c -expand y", - - //"pack %s -side top -anchor nw -expand y -fill none -padx 2 -pady 2", - bbGetOutputWidget()->GetWidgetName()); - */ - /* - } - - // Input WinDialog set to false : creating a Frame - else - { - bbtkDebugMessage("process",2, - " Input WinDialog set to false : creating a Frame" - <bbSetBlackBox( GetThisPointer()); - // win->SetName( bbGetInputWinTitle() + " - bbtk (c) CREATIS LRMN" ); - // win->SetWidth( bbGetInputWinWidth() ); - // win->SetHeight( bbGetInputWinHeight() ); - KW::GetApplication()->AddWindow((vtkKWWindowBase*)win); - win->Create(); - - bbGetOutputWidget()->SetParent(win); - bbGetOutputWidget()->Create(); - KW::GetApplication()->Script("pack %s -side top -anchor nw -expand y -fill none -padx 2 -pady 2", - bbGetOutputWidget()->GetWidgetName()); } - */ - - // win->Invoke(); - } - - // Show the window - - show->bbShow(); - // std::cout << "KW::GetApplication()->Start();"<Start(); - // std::cout << "AFTER KW::GetApplication()->Start();"< KWBlackBox::bbHideWindow() [" - <bbHide(); - - bbtkDebugMessageDec("kw",2,"<= KWBlackBox::bbHideWindow() [" - < KWBlackBox::bbCloseWindow() [" - <bbClose(); - - bbtkDebugMessageDec("kw",2,"<= KWBlackBox::bbCloseWindow() [" - <second->GetConnectionVector().size() != 0 ) - { - return boost::static_pointer_cast - (i->second->GetConnectionVector().front() //.lock() - ->GetBlackBoxTo())->bbGetContainingWindow(); - } - return 0; - } - //================================================================== - - - //================================================================== - bool KWBlackBox::bbIsShown() - { - if (bbGetContainingWindow()!=0) - return bbGetContainingWindow()->bbIsShown(); - return false; - } + // void KWBlackBox::InitWindowManagerIfNeeded() { KW:: + void KWBlackBox::IncNbWindowsAlive() { KW::IncNbWindowsAlive(); } + void KWBlackBox::DecNbWindowsAlive() { KW::DecNbWindowsAlive(); } + int KWBlackBox::GetNbWindowsAlive() { return KW::GetNbWindowsAlive(); } + bool KWBlackBox::IsSomeWindowAlive() { return KW::IsSomeWindowAlive(); } + + void KWBlackBox::IncNbWindowsShown() { KW::IncNbWindowsShown(); } + void KWBlackBox::DecNbWindowsShown() { KW::DecNbWindowsShown(); } + int KWBlackBox::GetNbWindowsShown() { return KW::GetNbWindowsShown(); } + bool KWBlackBox::IsSomeWindowShown() { return KW::GetNbWindowsShown(); } //================================================================== - - + }//namespace bbtk - #endif