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 #include <bbwxSlider.h>
29 #include <bbwxOutputText.h>
31 //=========================================================================
32 // Different examples of using black boxes in C++
33 // Here we do not use wxWidgets however WxBlackBox work in **Dialog** mode
34 //=========================================================================
36 //=========================================================================
37 void SimpleSliderDialog()
39 std::cout << "============== Simple Slider dialog 1" << std::endl;
42 bbwx::Slider::Pointer slider = bbwx::Slider::New("slider");
43 std::cout << "============== Simple Slider dialog " << std::endl;
44 // slider->bbGetHelp();
45 slider->bbSetInputWinDialog(true); // mandatory
46 std::cout << "============== Simple Slider dialog 3" << std::endl;
48 std::cout << "Slider Output = "<< slider->bbGetOutputOut() << std::endl;
50 catch (bbtk::Exception e)
55 //=========================================================================
57 //=========================================================================
58 void SliderOutputTextWithoutFactory()
60 std::cout << "============== Slider->OutputText without Factory"
64 bbwx::Slider::Pointer slider = bbwx::Slider::New("slider");
65 bbwx::OutputText::Pointer text = bbwx::OutputText::New("text");
66 bbtk::Connection::Pointer s2t = bbtk::Connection::New(slider,"Out",
70 catch (bbtk::Exception e)
72 bbtk::MessageManager::SetMessageLevel("Error",1);
76 //=========================================================================
79 //=========================================================================
80 #include <bbtkFactory.h>
81 #include <bbwxLayoutLine.h>
82 void SliderOutputTextWithFactory()
84 std::cout << "============== Slider->OutputText **WITH** Factory"
88 bbtk::Factory::Pointer factory = bbtk::Factory::New();
90 factory->LoadPackage("std");
92 bbwx::Slider::Pointer slider = bbwx::Slider::New("slider");
93 bbwx::OutputText::Pointer text = bbwx::OutputText::New("text");
94 bbtk::Connection::Pointer s2t = bbtk::Connection::New(slider,"Out",
97 bbwx::LayoutLine::Pointer layout = bbwx::LayoutLine::New("layout");
98 bbtk::Connection::Pointer c1 = bbtk::Connection::New(slider,"Widget",
100 bbtk::Connection::Pointer c2 = bbtk::Connection::New(text,"Widget",
103 bbtk::Connection::Pointer c3 = bbtk::Connection::New(slider,"BoxChange",
106 // text->bbSetInputBoxProcessMode("Reactive");
108 layout->bbSetInputWinDialog(true);
111 catch (bbtk::Exception e)
113 bbtk::MessageManager::SetMessageLevel("Error",1);
117 //=========================================================================
119 //=========================================================================
120 int main(int argv, char* argc[])
123 // bbtk::MessageManager::SetMessageLevel("all",9);
125 SimpleSliderDialog();
126 SliderOutputTextWithoutFactory();
127 SliderOutputTextWithFactory();
129 // To get the list of bbtk object still allocated after main ends
130 // bbtk::StaticInitTime::PrintObjectListInfo = true;
131 // bbtk::MessageManager::SetMessageLevel("object",1);
133 //=========================================================================