Go to the documentation of this file.00001
00002 #ifndef wxSliderPanel_h_
00003 #define wxSliderPanel_h_
00004
00005
00006
00007
00008
00009
00010
00011 #include <wx/scrolwin.h>
00012 #include <vgui/vgui_observable.h>
00013 #include <vcl_vector.h>
00014
00015
00016 class wxSlider;
00017 class wxTextCtrl;
00018
00019
00020
00021
00022 class wxSliderPanel: public wxScrolledWindow, public vgui_observable
00023 {
00024 DECLARE_DYNAMIC_CLASS( wxSliderPanel )
00025 DECLARE_EVENT_TABLE()
00026
00027 public:
00028
00029 wxSliderPanel();
00030 wxSliderPanel(wxWindow* parent,
00031 wxWindowID id = wxID_ANY,
00032 wxWindowID base_id = 10100,
00033 const wxPoint& pos = wxDefaultPosition,
00034 const wxSize& size = wxDefaultSize,
00035 long style = wxVSCROLL|wxSUNKEN_BORDER|wxTAB_TRAVERSAL,
00036 const wxString& name = wxT("wxSliderPanel"));
00037
00038
00039 bool Create(wxWindow* parent,
00040 wxWindowID id = wxID_ANY,
00041 wxWindowID base_id = 10100,
00042 const wxPoint& pos = wxDefaultPosition,
00043 const wxSize& size = wxDefaultSize,
00044 long style = wxVSCROLL|wxSUNKEN_BORDER|wxTAB_TRAVERSAL,
00045 const wxString& name = wxT("wxSliderPanel"));
00046
00047
00048 ~wxSliderPanel();
00049
00050
00051 void Init();
00052
00053
00054 void CreateControls();
00055
00056
00057 void CreateSliders(const vcl_vector<double>& init_vals,
00058 const vcl_vector<double>& min_vals,
00059 const vcl_vector<double>& max_vals);
00060
00061
00062 void OnSliderTrack( wxScrollEvent& event );
00063
00064 void OnSliderChange( wxScrollEvent& event );
00065
00066 void OnChangeText( wxCommandEvent& event );
00067
00068 void OnEnterText( wxCommandEvent& event );
00069
00070
00071 int GetWidgets(const wxEvent& event, wxSlider*& slider, wxTextCtrl*& text);
00072
00073
00074 const vcl_vector<double>& data() const { return vals_; }
00075
00076
00077 void update_data(vcl_vector<double>& data,
00078 bool send_messages = true);
00079
00080 void update_data(unsigned int i, double val,
00081 bool send_messages = true);
00082
00083
00084 unsigned int size() const { return vals_.size(); }
00085
00086
00087 double sp_to_val(unsigned int idx, int sp) const;
00088
00089 int val_to_sp(unsigned int idx, double val) const;
00090
00091
00092 static bool ShowToolTips();
00093
00094
00095 static const char update[];
00096 static const char enter[];
00097
00098 private:
00099 wxWindowID base_id_;
00100 vcl_vector<double> vals_;
00101 vcl_vector<double> min_vals_;
00102 vcl_vector<double> max_vals_;
00103
00104
00105 bool send_messages_;
00106 };
00107
00108
00109 #endif // wxSliderPanel_h_