1 /*=========================================================================
3 Module: $RCSfile: bbkwSlider.h,v $
5 Date: $Date: 2008/11/29 21:41:58 $
6 Version: $Revision: 1.1 $
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 * ------------------------------------------------------------------------ */
33 * \brief Short description in one line
35 * Long description which
36 * can span multiple lines
43 * \class bbkw::SliderWidget
49 // Prevents multiple inclusions : use symbols of the form
50 // __FILENAME_INCLUDED__
51 // where FILENAME must be replaced by the actual file name
52 #ifndef __bbkwSlider_h_INCLUDED__
53 #define __bbkwSlider_h_INCLUDED__
55 // Include KWBlackBox definition
56 #include "bbtkKWBlackBox.h"
60 // Namespace of the package "kw" is "bbkw"
61 // Namespace associated to packages should be of the form :
67 /* //--------------------------------------------------------------------------
68 // Forward declaration of the box
71 //--------------------------------------------------------------------------
72 // The widget created by the box
73 class SliderWidget : public kwPanel
76 /// Ctor with the two first params the parent window and the creator box
77 /// which must be passed to the KwBlackBoxWidget constructor.
78 /// The other params initialize the widget
79 SliderWidget(Slider* box, kwWindow *parent,
81 bool changeresolution,
91 /// Called when the slider is moved
92 void OnSliderTrack(kwScrollEvent& event);
93 /// Called when the slider is released
94 void OnSliderRelease(kwScrollEvent& event);
95 /// Called when the little slider which controls the resolution
96 /// of the main slider is moved (if activated)
97 void OnResolutionOfSlider(kwScrollEvent& event);
100 int GetValue() { return mkwSlider->GetValue(); }
101 void SetRange(int min, int max);
102 // Update the texts which display the min/max/current values of the slider
103 void RefreshLabels();
108 kwSlider *mResolutionOfSlider;
112 kwStaticText *label_vertical;
113 kwStaticText *label_min;
114 kwStaticText *label_max;
116 //------------------------------------------------------------------------
117 //------------------------------------------------------------------------
118 //------------------------------------------------------------------------
123 //------------------------------------------------------------------------
125 class /*BBTK_EXPORT*/ Slider : public bbtk::KWBlackBox
128 BBTK_BLACK_BOX_INTERFACE(Slider,bbtk::KWBlackBox);
129 BBTK_DECLARE_INPUT(In,int);
130 BBTK_DECLARE_INPUT(Min,int);
131 BBTK_DECLARE_INPUT(Max,int);
132 BBTK_DECLARE_INPUT(Label,bool);
133 BBTK_DECLARE_INPUT(Title,std::string);
134 BBTK_DECLARE_INPUT(Orientation,std::string);
135 BBTK_DECLARE_INPUT(ChangeResolution,bool);
136 BBTK_DECLARE_INPUT(ReactiveOnTrack,int);
137 BBTK_DECLARE_OUTPUT(Out,int);
138 BBTK_PROCESS(Process);
139 BBTK_CREATE_KWWIDGET(CreateWidget);
141 void CreateWidget(vtkKWWidget*);
144 virtual void bbUserConstructor();
146 //=================================================================
148 //=================================================================
149 // the black box description
150 BBTK_BEGIN_DESCRIBE_BLACK_BOX(Slider,bbtk::KWBlackBox);
152 BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr");
153 // Already inserted for any KWBlackBox BBTK_CATEGORY("widget");
154 BBTK_DESCRIPTION("Slider widget (vtkKWScale)");
155 BBTK_INPUT(Slider,In,"Initial position of the slider (default 0)",int,"");
156 BBTK_INPUT(Slider,Min,"Minimum value of the slider (default 0)",int,"");
157 BBTK_INPUT(Slider,Max,"Maximum value of the slider (default 500)",int,"");
158 BBTK_INPUT(Slider,Label,"Show slider labels ? (default FALSE) ",bool,"");
159 BBTK_INPUT(Slider,Title,"Title shown above the slider (default '') ", std::string,"");
160 BBTK_INPUT(Slider,Orientation, "Orientation : (default H) 0=H=HORIZONTAL, 1=V=VERTICAL ",std::string,"");
161 BBTK_INPUT(Slider,ChangeResolution, "Can the user change the resolution of the slider ? (default FALSE) ",bool,"");
162 BBTK_INPUT(Slider,ReactiveOnTrack, "Slider sends info when track moves (default 0 = no)",int,"");
163 BBTK_OUTPUT(Slider,Out,"Current position of the slider",int,"");
164 BBTK_END_DESCRIBE_BLACK_BOX(Slider);
165 //=================================================================
171 #endif //__bbtkkwSlider_h_INCLUDED__
173 #endif // USE_KWWIDGETS