1 /*=========================================================================
4 Module: $RCSfile: bbwxSlider.h,v $
6 Date: $Date: 2008/02/12 10:31:58 $
7 Version: $Revision: 1.8 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*//**
20 * \brief Short description in one line
22 * Long description which
23 * can span multiple lines
30 * \class bbwx::SliderWidget
35 #ifdef _USE_WXWIDGETS_
38 // Prevents multiple inclusions : use symbols of the form
39 // __FILENAME_INCLUDED__
40 // where FILENAME must be replaced by the actual file name
41 #ifndef __bbwxSlider_h_INCLUDED__
42 #define __bbwxSlider_h_INCLUDED__
44 // Include wxBlackBox definition
45 #include "bbtkWxBlackBox.h"
49 // Namespace of the package "wx" is "bbwx"
50 // Namespace associated to packages should be of the form :
55 //--------------------------------------------------------------------------
56 // Forward declaration of the box
59 //--------------------------------------------------------------------------
60 // The widget created by the box
61 class SliderWidget : public wxPanel
64 /// Ctor with the two first params the parent window and the creator box
65 /// which must be passed to the WxBlackBoxWidget constructor.
66 /// The other params initialize the widget
67 SliderWidget(Slider* box, wxWindow *parent,
69 bool changeresolution,
79 /// Called when the slider is moved
80 void OnSliderTrack(wxScrollEvent& event);
81 /// Called when the slider is released
82 void OnSliderRelease(wxScrollEvent& event);
83 /// Called when the little slider which controls the resolution
84 /// of the main slider is moved (if activated)
85 void OnResolutionOfSlider(wxScrollEvent& event);
88 int GetValue() { return mwxSlider->GetValue(); }
89 void SetRange(int min, int max);
90 // Update the texts which display the min/max/current values of the slider
96 wxSlider *mResolutionOfSlider;
100 wxStaticText *label_vertical;
101 wxStaticText *label_min;
102 wxStaticText *label_max;
104 //------------------------------------------------------------------------
105 //------------------------------------------------------------------------
106 //------------------------------------------------------------------------
111 //------------------------------------------------------------------------
113 class /*BBTK_EXPORT*/ Slider : public bbtk::WxBlackBox
116 BBTK_USER_BLACK_BOX_INTERFACE(Slider,bbtk::WxBlackBox);
117 BBTK_DECLARE_INPUT(In,int);
118 BBTK_DECLARE_INPUT(Min,int);
119 BBTK_DECLARE_INPUT(Max,int);
120 BBTK_DECLARE_INPUT(Label,bool);
121 BBTK_DECLARE_INPUT(Title,std::string);
122 BBTK_DECLARE_INPUT(Orientation,std::string);
123 BBTK_DECLARE_INPUT(ChangeResolution,bool);
124 BBTK_DECLARE_INPUT(ReactiveOnTrack,int);
125 BBTK_DECLARE_OUTPUT(Out,int);
126 BBTK_PROCESS(Process);
127 BBTK_CREATE_WIDGET(CreateWidget);
132 virtual void bbUserConstructor();
134 //=================================================================
136 //=================================================================
137 // the black box description
138 BBTK_BEGIN_DESCRIBE_BLACK_BOX(Slider,bbtk::WxBlackBox);
140 BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
141 // Already inserted for any WxBlackBox BBTK_CATEGORY("widget");
142 BBTK_DESCRIPTION("Slider widget (wxSlider)");
143 BBTK_INPUT(Slider,In,"Initial position of the slider (default 0)",int);
144 BBTK_INPUT(Slider,Min,"Minimum value of the slider (default 0)",int);
145 BBTK_INPUT(Slider,Max,"Maximum value of the slider (default 500)",int);
146 BBTK_INPUT(Slider,Label,"Show slider labels ? (default FALSE) ",bool);
147 BBTK_INPUT(Slider,Title,"Title shown above the slider (default '') ", std::string);
148 BBTK_INPUT(Slider,Orientation, "Orientation : (default H) 0=H=HORIZONTAL, 1=V=VERTICAL ",std::string);
149 BBTK_INPUT(Slider,ChangeResolution, "Can the user change the resolution of the slider ? (default FALSE) ",bool);
150 BBTK_INPUT(Slider,ReactiveOnTrack, "Slider sends info when track moves (default 0 = no)",int);
151 BBTK_OUTPUT(Slider,Out,"Current position of the slider",int);
152 BBTK_END_DESCRIBE_BLACK_BOX(Slider);
153 //=================================================================
159 #endif //__bbtkwxSlider_h_INCLUDED__
161 #endif //_USE_WXWIDGETS_