Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PanelForDoubleValueWx.hh
1 /*
2  This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4  Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10  BIAS is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation; either version 2.1 of the License, or
13  (at your option) any later version.
14 
15  BIAS is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with BIAS; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  */
24 
25 #ifndef __PANEL_FOR_DOUBLE_VALUE_WX_HH_
26 #define __PANEL_FOR_DOUBLE_VALUE_WX_HH_
27 
28 #include <bias_config.h>
29 #include <wx/panel.h>
30 #include <wx/stattext.h>
31 #include <wx/textctrl.h>
32 #include <wx/spinbutt.h>
33 #include <wx/spinctrl.h>
34 #include <wx/slider.h>
35 #include <wx/sizer.h>
36 
37 namespace BIAS {
38 
39 /**
40  * @class PanelForDoubleValueWx
41  * @brief Helper Class For Parameter Input To Take Floating Point Numbers
42  * @author jfernand 08/09
43  */
44 class BIASGui_EXPORT PanelForDoubleValueWx : public wxPanel
45 {
46 public:
47 
49  wxWindowID id = wxID_ANY,
50  const wxString& label = wxT("LABEL:"),
51  const double minlimit = 0.0,
52  const double maxlimit = 1.0,
53  const double initialval = 0.5,
54  const int stepsize = 10000,
55  const wxPoint& pos = wxDefaultPosition,
56  const wxSize& size = wxDefaultSize,
57  long style = wxTAB_TRAVERSAL);
59 
60  /**
61  * @return the assigned value for a parameter
62  */
63  double GetParamValue() const;
64 
65  /**
66  * @return the maximum limit for a parameter
67  */
68  double GetParamMaxLimit() const;
69 
70  /**
71  * @return the minimum limit for a parameter
72  */
73  double GetParamMinLimit() const;
74 
75  /**
76  * @return the RANGE for the slider beginning at ZERO
77  * (unfortunately the name is a little bit misleading)
78  */
79  int GetStepSize() const;
80 
81  /**
82  * Sets the maximum limit for a parameter
83  * @return TRUE if setting was successful otherwise FALSE
84  */
85  bool SetParamMaxLimit(const double maxlimit);
86 
87  /**
88  * Sets the minimum limit for a parameter
89  * @return TRUE if setting was successful otherwise FALSE
90  */
91  bool SetParamMinLimit(const double minlimit);
92 
93  /**
94  * Gives the parameter a name
95  */
96  void SetParamLabel(const wxString& label);
97 
98  /**
99  * Sets the RANGE for the slider for precision
100  * (and also here: name is misleading)
101  */
102  void SetStepSize(const int stepsize);
103 
104 
105 private:
106 
107  void OnTextCtrl(wxCommandEvent& event);
108  void OnSlider(wxCommandEvent& event);
109  void OnSpinCtrl(wxSpinEvent& event);
110  void UpdateSlider();
111 
112  wxBoxSizer* MainSizer;
113 
114  wxStaticText* Label;
115  wxStaticText* StepSizeLabel;
116  wxTextCtrl* TextCtrl;
117  wxSlider* Slider;
118  wxSpinCtrl* SpinCtrl;
119 
120  int StepSize;
121  double TextCtrlValue;
122  double ParamMaxLimit;
123  double ParamMinLimit;
124 
125  enum BSCD_IDs {
126  ID_TEXT_CTRL = 358426,
127  ID_SLIDER,
128  ID_SPIN_CTRL
129  };
130 
131 };
132 
133 } // end namespace BIAS
134 
135 #endif // __PANEL_FOR_DOUBLE_VALUE_WX_HH_
Helper Class For Parameter Input To Take Floating Point Numbers.
does a connected component analysis and labels all connected regions
Definition: Label.hh:84