TBTK
Need a break? Support the development by playing Polarity Puzzles
ParameterSliderPanel.h
1 /* Copyright 2017 Kristofer Björnson
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
17 
24 #ifndef COM_DAFER45_TBTK_PARAMETER_SLIDER_PANEL
25 #define COM_DAFER45_TBTK_PARAMETER_SLIDER_PANEL
26 
27 #include <wx/wx.h>
28 #include <wx/sizer.h>
29 
30 namespace TBTK{
31 
32 class ParameterSliderPanel : public wxPanel{
33 public:
35  ParameterSliderPanel(
36  wxWindow *parent,
37  wxWindowID id,
38  const std::string &parameterName,
39  double lowerBound,
40  double upperBound,
41  unsigned int numTicks,
42  double value
43  );
44 
46  ~ParameterSliderPanel();
47 
49  void onPaintEvent(wxPaintEvent &event);
50 
52  void onSizeEvent(wxSizeEvent &event);
53 
55  void onSliderChange(wxScrollEvent &event);
56 
58  double getValue() const;
59 
61  unsigned int getTick() const;
62 protected:
63  DECLARE_EVENT_TABLE();
64 private:
66  double value;
67 
69  double lowerBound;
70 
72  double upperBound;
73 
75  unsigned int numTicks;
76 
78  wxStaticText label;
79 
81  wxSlider slider;
82 
84  wxStaticText valuePanel;
85 
86  static const wxWindowID SLIDER_ID;
87 };
88 
89 inline double ParameterSliderPanel::getValue() const{
90  return value;
91 }
92 
93 inline unsigned int ParameterSliderPanel::getTick() const{
94  return slider.GetValue();
95 }
96 
97 }; //End namespace TBTK
98 
99 #endif
100 
Definition: Boolean.h:32