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 # ------------------------------------------------------------------------ */
28 /*=========================================================================
30 Module: $RCSfile: bbtkKWBlackBox.cxx,v $
32 Date: $Date: 2012/11/16 08:49:01 $
33 Version: $Revision: 1.11 $
34 =========================================================================*/
44 #include "bbtkKWBlackBox.h"
45 #include "bbtkBlackBoxOutputConnector.h"
46 #include "vtkKWBlackBoxDialog.h"
50 //=========================================================================
52 //=========================================================================
54 //=========================================================================
55 //=========================================================================
56 //=========================================================================
57 //=========================================================================
58 BBTK_BLACK_BOX_IMPLEMENTATION(KWBlackBox,WidgetBlackBox<wxWindow>);
59 //=========================================================================
61 //==================================================================
62 /// Callback for creating a Dialog window (modal)
63 void WxBlackBox::bbCreateDialogWindow()
66 vtkKWBlackBoxDialog* win = vtkKWBlackBoxDialog::New();
68 win->bbSetBlackBox( GetThisPointer<KWBlackBox>());
69 KW::GetApplication()->AddWindow((vtkKWWindowBase*)win);
71 win->SetResizable(0,0);
73 bbUserCreateWidget(win->GetFrame());
75 KW::GetApplication()->Script
76 ("pack %s -expand yes -fill both",
77 bbGetOutputWidget()->GetWidgetName());
80 KW::GetApplication()->Script("place %s -x 0 -y 0 -width %d -height %d",
81 bbGetOutputWidget()->GetWidgetName(),
83 bbGetInputWinHeight());
85 //==================================================================
87 //==================================================================
88 /// Callback for creating a Frame window
89 void WxBlackBox::bbCreateFrameWindow()
91 bbtkWarning("KW: Frame windows not supported: creating a Dialog!");
92 bbCreateDialogWindow();
94 //==================================================================
97 //==================================================================
98 vtkKWWidget* KWBlackBox::bbCreateWidgetOfInput(const std::string& in,
102 // If input is connected
103 BlackBoxInputConnector* c = bbGetInputConnectorMap().find(in)->second ;
104 if ( c->IsConnected() )
106 // Get black box from
107 BlackBox::Pointer from =
108 c->GetConnection()->GetBlackBoxFrom();
109 // Cast it into a KWBlackBox
110 KWBlackBox::Pointer wfrom = boost::dynamic_pointer_cast<KWBlackBox>(from);
111 // Call bbCreateWidget
112 wfrom->bbUserCreateWidget(parent);
113 // Get the widget created
114 w = wfrom->bbGetOutputWidget();
118 //==================================================================
121 //==================================================================
122 // void KWBlackBox::InitWindowManagerIfNeeded() { KW::
123 void KWBlackBox::IncNbWindowsAlive() { KW::IncNbWindowsAlive(); }
124 void KWBlackBox::DecNbWindowsAlive() { KW::DecNbWindowsAlive(); }
125 int KWBlackBox::GetNbWindowsAlive() { return KW::GetNbWindowsAlive(); }
126 bool KWBlackBox::IsSomeWindowAlive() { return KW::IsSomeWindowAlive(); }
128 void KWBlackBox::IncNbWindowsShown() { KW::IncNbWindowsShown(); }
129 void KWBlackBox::DecNbWindowsShown() { KW::DecNbWindowsShown(); }
130 int KWBlackBox::GetNbWindowsShown() { return KW::GetNbWindowsShown(); }
131 bool KWBlackBox::IsSomeWindowShown() { return KW::GetNbWindowsShown(); }
132 //==================================================================