ToolMap
Loading...
Searching...
No Matches
tmsliderwithtxt.h
1/***************************************************************************
2 tmsliderwithtxt.h
3 Display a slider with associed text control
4 Updating value in one control reflect on the other
5 -------------------
6 copyright : (C) 2007 CREALP Lucien Schreiber
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
34#ifndef _TM_SLIDERWITHTXT_H_
35#define _TM_SLIDERWITHTXT_H_
36
37// For compilers that support precompilation, includes "wx/wx.h".
38#include <wx/wxprec.h>
39
40// Include wxWidgets' headers
41#ifndef WX_PRECOMP
42#include <wx/wx.h>
43#endif
44
45#define SYMBOL_TMSLIDERWITHTEXT_STYLE wxTAB_TRAVERSAL
46
47class tmSliderWithText : public wxPanel {
48 private:
49 wxSlider* m_Slider;
50 wxTextCtrl* m_Text;
51 wxStaticText* m_UnitValue;
52
53 int m_iLimitMin;
54 int m_iLimitMax;
55
56 void Init();
57
58 void CreateControls(int ivalue, int imin, int imax, const wxString& unitvalue);
59
60 // event function
61 void OnTextUpdated(wxCommandEvent& event);
62
63 void OnSliderUpdated(wxScrollEvent& event);
64
65 DECLARE_DYNAMIC_CLASS(tmSliderWithText)
66
67 protected:
68 int SetSliderValue(int iNewValue);
69
70 public:
72
73 tmSliderWithText(wxWindow* parent, wxWindowID id, int ivalue, int imin, int imax,
74 const wxString& unitvalue = _T(""), const wxPoint& pos = wxDefaultPosition,
75 const wxSize& size = wxDefaultSize, long style = SYMBOL_TMSLIDERWITHTEXT_STYLE);
76
77 bool Create(wxWindow* parent, wxWindowID id, int ivalue, int imin, int imax, const wxString& unitvalue = _T(""),
78 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
79 long style = SYMBOL_TMSLIDERWITHTEXT_STYLE);
80
82
83 int GetValue();
84
85 bool SetValue(int iValue);
86};
87
88#endif
Definition tmsliderwithtxt.h:47