1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 #include "bbmaracasvisuSliderMinMax.h"
27 #include "bbcreaMaracasVisuPackage.h"
30 namespace bbcreaMaracasVisu
33 //------------------------------------------------------------------------------------------------------------------------------------
34 // Event handling auxiliar class
35 //------------------------------------------------------------------------------------------------------------------------------------
37 //--------------------------------------------------------------------------------------------------------------------------------
38 // Constructors ans destructors
39 //--------------------------------------------------------------------------------------------------------------------------------
40 wxWidgetSliderMinMax :: wxWidgetSliderMinMax(SliderMinMax *bbParent,mBarRange * modelBarRange)
43 modBarRange = modelBarRange;
44 mbbtkSliderMinMax = bbParent;
45 Connect(modBarRange->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onBarrange );
46 // Connect(modBarRange->GetId(),98765,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onActualChange_Bar );
47 Connect(modBarRange->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onActualChange_Bar );
48 Connect(modBarRange->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onStartChange_Bar );
49 Connect(modBarRange->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onEndChange_Bar );
50 Connect(modBarRange->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onSelectionEnd );
51 Connect(modBarRange->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction) &wxWidgetSliderMinMax::onMovedBar );
54 wxWidgetSliderMinMax :: ~wxWidgetSliderMinMax()
58 void wxWidgetSliderMinMax::PushEventHandler()
60 modBarRange->PushEventHandler(this);
63 //--------------------------------------------------------------------------------------------------------------------------------
64 // Min-Max Barrange received events
65 //--------------------------------------------------------------------------------------------------------------------------------
66 void wxWidgetSliderMinMax :: onBarrange(wxCommandEvent& event)
70 void wxWidgetSliderMinMax :: onActualChange_Bar(wxCommandEvent& event)
72 mbbtkSliderMinMax->bbSetOutputOutActual(modBarRange->GetActual());
73 mbbtkSliderMinMax->bbSignalOutputModification(std::string("OutActual"));
76 void wxWidgetSliderMinMax :: onStartChange_Bar(wxCommandEvent& event)
78 mbbtkSliderMinMax->bbSetOutputOutStart(modBarRange->GetStart());
79 mbbtkSliderMinMax->bbSetInputInMinShow(modBarRange->GetStart());
80 mbbtkSliderMinMax->bbSignalOutputModification(std::string("OutStart"));
83 void wxWidgetSliderMinMax :: onEndChange_Bar(wxCommandEvent& event)
85 mbbtkSliderMinMax->bbSetOutputOutEnd(modBarRange->GetEnd());
86 mbbtkSliderMinMax->bbSignalOutputModification(std::string("OutEnd"));
89 void wxWidgetSliderMinMax :: onSelectionEnd(wxCommandEvent& event)
93 void wxWidgetSliderMinMax :: onMovedBar(wxCommandEvent& event)
98 //--------------------------------------------------------------------------
99 //-------------------------------------------------------------------------
100 //--------------------------------------------------------------------------
101 //--------------------------------------------------------------------------
104 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,SliderMinMax)
105 BBTK_BLACK_BOX_IMPLEMENTATION(SliderMinMax,bbtk::WxBlackBox);
107 //------------------------------------------------------
108 void SliderMinMax::Process()
112 mwxwidget -> setRepresentedValues( bbGetInputInMin(), bbGetInputInMax() );
116 mwxwidget -> SetStart(bbGetInputInMinShow());
117 mwxwidget -> SetEnd(bbGetInputInMaxShow());
119 bbSetOutputOutStart(mwxwidget->GetStart());
120 bbSetOutputOutEnd(mwxwidget->GetEnd());
121 bbSetOutputOutActual(mwxwidget->GetActual());
125 //------------------------------------------------------
126 void SliderMinMax::CreateWidget(wxWindow* parent)
128 bbtkDebugMessageInc("Core",9,"SliderMinMax::CreateWidget()"<<std::endl);
130 mwxwidget = new mBarRange(parent ,bbGetInputInW(), bbGetInputInH());
131 mwxwidget -> SetOrientation( bbGetInputOrientation()==1 );
132 mwxwidget -> setActiveStateTo(true);
133 mwxwidget -> setVisibleLabels( bbGetInputShowLabels()==1 );
134 mwxwidget -> setDeviceEndMargin(10);
135 // mwxwidget -> setRepresentedValues(bbGetInputInMin(), bbGetInputInMax());
136 mwxwidget -> setDeviceBlitStart(10,10);
137 mwxwidget -> setIfWithActualDrawed(bbGetInputShowActual());
138 // mwxwidget -> SetStart(bbGetInputInMinShow());
139 // mwxwidget -> SetEnd(bbGetInputInMaxShow());
140 wxWidgetSliderMinMax *eventHandler = new wxWidgetSliderMinMax(this, mwxwidget);
141 eventHandler->PushEventHandler();
142 mwxwidget->setRepresentedValues( bbGetInputInMin(), bbGetInputInMax() );
143 mwxwidget->SetStart(bbGetInputInMinShow());
144 mwxwidget->SetEnd(bbGetInputInMaxShow());
145 bbSetOutputOutStart( mwxwidget->GetStart() );
146 bbSetOutputOutEnd( mwxwidget->GetEnd() );
147 bbSetOutputOutActual( mwxwidget->GetActual() );
148 bbtkDebugDecTab("Core",9);
149 bbSetOutputWidget( mwxwidget );
152 //------------------------------------------------------
153 void SliderMinMax::bbUserSetDefaultValues()
157 bbSetInputOrientation(1);
160 bbSetInputInMax(200);
162 bbSetInputInMaxShow(200);
163 bbSetInputInMinShow(1);
164 bbSetInputShowLabels(1);
165 bbSetInputShowActual(true);
166 bbSetOutputOutStart(0);
167 bbSetOutputOutEnd(0);
168 bbSetOutputOutActual(0);
172 //-----------------------------------------------------------------
173 void SliderMinMax::bbUserInitializeProcessing()
177 //-----------------------------------------------------------------
178 void SliderMinMax::bbUserFinalizeProcessing()
182 //-----------------------------------------------------------------
183 } // EO namespace bbcreaMaracasVisu