TBTK
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 
23 #ifndef COM_DAFER45_TBTK_PARAMETER_SLIDER_PANEL
24 #define COM_DAFER45_TBTK_PARAMETER_SLIDER_PANEL
25 
26 #include <wx/wx.h>
27 #include <wx/sizer.h>
28 
29 namespace TBTK{
30 
31 class ParameterSliderPanel : public wxPanel{
32 public:
35  wxWindow *parent,
36  wxWindowID id,
37  const std::string &parameterName,
38  double lowerBound,
39  double upperBound,
40  unsigned int numTicks,
41  double value
42  );
43 
46 
48  void onPaintEvent(wxPaintEvent &event);
49 
51  void onSizeEvent(wxSizeEvent &event);
52 
54  void onSliderChange(wxScrollEvent &event);
55 
57  double getValue() const;
58 
60  unsigned int getTick() const;
61 protected:
62  DECLARE_EVENT_TABLE();
63 private:
65  double value;
66 
68  double lowerBound;
69 
71  double upperBound;
72 
74  unsigned int numTicks;
75 
77  wxStaticText label;
78 
80  wxSlider slider;
81 
83  wxStaticText valuePanel;
84 
85  static const wxWindowID SLIDER_ID;
86 };
87 
88 inline double ParameterSliderPanel::getValue() const{
89  return value;
90 }
91 
92 inline unsigned int ParameterSliderPanel::getTick() const{
93  return slider.GetValue();
94 }
95 
96 }; //End namespace TBTK
97 
98 #endif
unsigned int getTick() const
Definition: ParameterSliderPanel.h:92
ParameterSliderPanel(wxWindow *parent, wxWindowID id, const std::string &parameterName, double lowerBound, double upperBound, unsigned int numTicks, double value)
void onSizeEvent(wxSizeEvent &event)
void onSliderChange(wxScrollEvent &event)
void onPaintEvent(wxPaintEvent &event)
Definition: ModelFactory.h:35
Definition: ParameterSliderPanel.h:31
double getValue() const
Definition: ParameterSliderPanel.h:88