]> Creatis software - bbtk.git/blob - packages/kw/src/bbkwSlider.h
33f40f97c40c3a74655380046548e51800b4e4d4
[bbtk.git] / packages / kw / src / bbkwSlider.h
1 /*=========================================================================                                                                               
2   Program:   bbtk
3   Module:    $RCSfile: bbkwSlider.h,v $
4   Language:  C++
5   Date:      $Date: 2008/11/29 21:41:58 $
6   Version:   $Revision: 1.1 $
7 =========================================================================*/
8
9 /* ---------------------------------------------------------------------
10
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
13 *
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.
20 *
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
25 *  liability. 
26 *
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 * ------------------------------------------------------------------------ */                                                                         
30
31 /**
32  * \file 
33  * \brief Short description in one line
34  * 
35  * Long description which 
36  * can span multiple lines
37 */
38
39 /**
40  * \class bbkw::Slider
41  * \brief 
42
43  * \class bbkw::SliderWidget
44  * \brief 
45  */
46
47 #ifdef USE_KWWIDGETS
48
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__
54
55 // Include KWBlackBox definition
56 #include "bbtkKWBlackBox.h"
57
58
59
60 // Namespace of the package "kw" is "bbkw" 
61 // Namespace associated to packages should be of the form :
62 // bbPACKAGENAME
63 namespace bbkw
64 {
65   
66
67   /*  //--------------------------------------------------------------------------
68   // Forward declaration of the box
69   class Slider;
70   
71   //--------------------------------------------------------------------------
72   // The widget created by the box 
73   class SliderWidget : public kwPanel 
74   {
75   public:
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,
80                  int orientation,
81                  bool changeresolution,
82                  bool label, 
83                  kwString title,
84                  int vmin,
85                  int vmax,
86                  int value,
87        int track);
88     /// Dtor
89     ~SliderWidget();
90     /// Events callbacks
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);
98
99     // Accessors
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();
104         
105   private:
106     Slider*    mBox;
107     kwSlider   *mkwSlider;
108     kwSlider   *mResolutionOfSlider;
109     int        min;
110     int        max;
111     int        reactiveOnTrack;
112     kwStaticText        *label_vertical;
113     kwStaticText        *label_min;
114     kwStaticText        *label_max;
115   };
116   //------------------------------------------------------------------------
117   //------------------------------------------------------------------------
118   //------------------------------------------------------------------------
119
120   */
121   
122   
123   //------------------------------------------------------------------------
124   // The black box
125   class /*BBTK_EXPORT*/ Slider : public bbtk::KWBlackBox
126   {
127     
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);
140     void Process();
141     void CreateWidget(vtkKWWidget*);
142
143   protected:
144     virtual void bbUserConstructor();
145   };
146   //=================================================================
147  
148   //=================================================================
149   // the black box description
150   BBTK_BEGIN_DESCRIBE_BLACK_BOX(Slider,bbtk::KWBlackBox);
151   BBTK_NAME("Slider");
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   //=================================================================
166   
167
168
169 } //namespace bbkw
170
171 #endif  //__bbtkkwSlider_h_INCLUDED__
172
173 #endif // USE_KWWIDGETS