1 /*=========================================================================
3 Module: $RCSfile: bbtkKWBlackBox.cxx,v $
5 Date: $Date: 2010/01/14 13:17:27 $
6 Version: $Revision: 1.10 $
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
14 * This software is governed by the CeCILL-B license under French law and
15 * abiding by the rules of distribution of free software. You can use,
16 * modify and/ or redistribute the software under the terms of the CeCILL-B
17 * license as circulated by CEA, CNRS and INRIA at the following URL
18 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
19 * or in the file LICENSE.txt.
21 * As a counterpart to the access to the source code and rights to copy,
22 * modify and redistribute granted by the license, users are provided only
23 * with a limited warranty and the software's author, the holder of the
24 * economic rights, and the successive licensors have only limited
27 * The fact that you are presently reading this means that you have had
28 * knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */
37 #include "bbtkKWBlackBox.h"
38 #include "bbtkBlackBoxOutputConnector.h"
39 #include "vtkKWBlackBoxDialog.h"
43 //=========================================================================
45 //=========================================================================
47 //=========================================================================
48 //=========================================================================
49 //=========================================================================
50 //=========================================================================
51 BBTK_BLACK_BOX_IMPLEMENTATION(KWBlackBox,WidgetBlackBox<wxWindow>);
52 //=========================================================================
54 //==================================================================
55 /// Callback for creating a Dialog window (modal)
56 void WxBlackBox::bbCreateDialogWindow()
59 vtkKWBlackBoxDialog* win = vtkKWBlackBoxDialog::New();
61 win->bbSetBlackBox( GetThisPointer<KWBlackBox>());
62 KW::GetApplication()->AddWindow((vtkKWWindowBase*)win);
64 win->SetResizable(0,0);
66 bbUserCreateWidget(win->GetFrame());
68 KW::GetApplication()->Script
69 ("pack %s -expand yes -fill both",
70 bbGetOutputWidget()->GetWidgetName());
73 KW::GetApplication()->Script("place %s -x 0 -y 0 -width %d -height %d",
74 bbGetOutputWidget()->GetWidgetName(),
76 bbGetInputWinHeight());
78 //==================================================================
80 //==================================================================
81 /// Callback for creating a Frame window
82 void WxBlackBox::bbCreateFrameWindow()
84 bbtkWarning("KW: Frame windows not supported: creating a Dialog!");
85 bbCreateDialogWindow();
87 //==================================================================
90 //==================================================================
91 vtkKWWidget* KWBlackBox::bbCreateWidgetOfInput(const std::string& in,
95 // If input is connected
96 BlackBoxInputConnector* c = bbGetInputConnectorMap().find(in)->second ;
97 if ( c->IsConnected() )
100 BlackBox::Pointer from =
101 c->GetConnection()->GetBlackBoxFrom();
102 // Cast it into a KWBlackBox
103 KWBlackBox::Pointer wfrom = boost::dynamic_pointer_cast<KWBlackBox>(from);
104 // Call bbCreateWidget
105 wfrom->bbUserCreateWidget(parent);
106 // Get the widget created
107 w = wfrom->bbGetOutputWidget();
111 //==================================================================
114 //==================================================================
115 // void KWBlackBox::InitWindowManagerIfNeeded() { KW::
116 void KWBlackBox::IncNbWindowsAlive() { KW::IncNbWindowsAlive(); }
117 void KWBlackBox::DecNbWindowsAlive() { KW::DecNbWindowsAlive(); }
118 int KWBlackBox::GetNbWindowsAlive() { return KW::GetNbWindowsAlive(); }
119 bool KWBlackBox::IsSomeWindowAlive() { return KW::IsSomeWindowAlive(); }
121 void KWBlackBox::IncNbWindowsShown() { KW::IncNbWindowsShown(); }
122 void KWBlackBox::DecNbWindowsShown() { KW::DecNbWindowsShown(); }
123 int KWBlackBox::GetNbWindowsShown() { return KW::GetNbWindowsShown(); }
124 bool KWBlackBox::IsSomeWindowShown() { return KW::GetNbWindowsShown(); }
125 //==================================================================