]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/slider.h
added some wxMSW stuff
[wxWidgets.git] / include / wx / msw / slider.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: slider.h
3 // Purpose: wxSlider class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __SLIDERH__
13 #define __SLIDERH__
14
15 #ifdef __GNUG__
16 #pragma interface "slider.h"
17 #endif
18
19 #include "wx/control.h"
20
21 WXDLLEXPORT_DATA(extern const char*) wxSliderNameStr;
22
23 // Slider
24 class WXDLLEXPORT wxSlider: public wxControl
25 {
26 DECLARE_DYNAMIC_CLASS(wxSlider)
27
28 public:
29 wxSlider(void);
30
31 inline wxSlider(wxWindow *parent, const wxWindowID id,
32 const int value, const int minValue, const int maxValue,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 const long style = wxSL_HORIZONTAL,
36 const wxValidator& validator = wxDefaultValidator,
37 const wxString& name = wxSliderNameStr)
38 {
39 Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name);
40 }
41
42 ~wxSlider(void);
43
44 bool Create(wxWindow *parent, const wxWindowID id,
45 const int value, const int minValue, const int maxValue,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize,
48 const long style = wxSL_HORIZONTAL,
49 const wxValidator& validator = wxDefaultValidator,
50 const wxString& name = wxSliderNameStr);
51
52 virtual int GetValue(void) const ;
53 virtual void SetValue(const int);
54 void GetSize(int *x, int *y) const ;
55 void SetSize(const int x, const int y, const int width, const int height, const int sizeFlags = wxSIZE_AUTO);
56 void GetPosition(int *x, int *y) const ;
57 bool Show(const bool show);
58
59 void SetRange(const int minValue, const int maxValue);
60
61 inline int GetMin(void) const { return m_rangeMin; }
62 inline int GetMax(void) const { return m_rangeMax; }
63
64 // For trackbars only
65 void SetTickFreq(const int n, const int pos);
66 inline int GetTickFreq(void) const { return m_tickFreq; }
67 void SetPageSize(const int pageSize);
68 int GetPageSize(void) const ;
69 void ClearSel(void) ;
70 void ClearTicks(void) ;
71 void SetLineSize(const int lineSize);
72 int GetLineSize(void) const ;
73 int GetSelEnd(void) const ;
74 int GetSelStart(void) const ;
75 void SetSelection(const int minPos, const int maxPos);
76 void SetThumbLength(const int len) ;
77 int GetThumbLength(void) const ;
78 void SetTick(const int tickPos) ;
79
80 // IMPLEMENTATION
81 inline WXHWND GetStaticMin() const { return m_staticMin; }
82 inline WXHWND GetStaticMax() const { return m_staticMax; }
83 inline WXHWND GetEditValue() const { return m_staticValue; }
84 virtual bool ContainsHWND(WXHWND hWnd) const;
85
86 // Backward compatibility: translate to familiar wxEVT_COMMAND_SLIDER_UPDATED
87 #if WXWIN_COMPATIBILITY
88 void OnScroll(wxScrollEvent& event);
89 #endif
90
91 void Command(wxCommandEvent& event);
92 virtual WXHBRUSH OnCtlColor(const WXHDC pDC, const WXHWND pWnd, const WXUINT nCtlColor,
93 WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
94 void MSWOnVScroll(const WXWORD wParam, const WXWORD pos, const WXHWND control);
95 void MSWOnHScroll(const WXWORD wParam, const WXWORD pos, const WXHWND control);
96
97 protected:
98 WXHWND m_staticMin;
99 WXHWND m_staticMax;
100 WXHWND m_staticValue;
101 int m_rangeMin;
102 int m_rangeMax;
103 int m_pageSize;
104 int m_lineSize;
105 int m_tickFreq;
106 DECLARE_EVENT_TABLE()
107 };
108
109 #endif
110 // __SLIDERH__