]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/slider.h
Cast for argument to delete[] - VC6 doesn't want to delete a const pointer
[wxWidgets.git] / include / wx / msw / slider.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/slider.h
3 // Purpose: wxSlider class implementation using trackbar control
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_SLIDER_H_
13 #define _WX_SLIDER_H_
14
15 class WXDLLIMPEXP_FWD_CORE wxSubwindows;
16
17 // Slider
18 class WXDLLIMPEXP_CORE wxSlider : public wxSliderBase
19 {
20 public:
21 wxSlider() { Init(); }
22
23 wxSlider(wxWindow *parent,
24 wxWindowID id,
25 int value,
26 int minValue,
27 int maxValue,
28 const wxPoint& pos = wxDefaultPosition,
29 const wxSize& size = wxDefaultSize,
30 long style = wxSL_HORIZONTAL,
31 const wxValidator& validator = wxDefaultValidator,
32 const wxString& name = wxSliderNameStr)
33 {
34 Init();
35
36 (void)Create(parent, id, value, minValue, maxValue,
37 pos, size, style, validator, name);
38 }
39
40 bool Create(wxWindow *parent,
41 wxWindowID id,
42 int value,
43 int minValue, int maxValue,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize,
46 long style = wxSL_HORIZONTAL,
47 const wxValidator& validator = wxDefaultValidator,
48 const wxString& name = wxSliderNameStr);
49
50 virtual ~wxSlider();
51
52 // slider methods
53 virtual int GetValue() const;
54 virtual void SetValue(int);
55
56 void SetRange(int minValue, int maxValue);
57
58 int GetMin() const { return m_rangeMin; }
59 int GetMax() const { return m_rangeMax; }
60
61 // Win32-specific slider methods
62 void SetTickFreq(int n, int pos);
63 int GetTickFreq() const { return m_tickFreq; }
64 void SetPageSize(int pageSize);
65 int GetPageSize() const;
66 void ClearSel();
67 void ClearTicks();
68 void SetLineSize(int lineSize);
69 int GetLineSize() const;
70 int GetSelEnd() const;
71 int GetSelStart() const;
72 void SetSelection(int minPos, int maxPos);
73 void SetThumbLength(int len);
74 int GetThumbLength() const;
75 void SetTick(int tickPos);
76
77 // implementation only from now on
78 WXHWND GetStaticMin() const;
79 WXHWND GetStaticMax() const;
80 WXHWND GetEditValue() const;
81 virtual bool ContainsHWND(WXHWND hWnd) const;
82
83 // we should let background show through the slider (and its labels)
84 virtual bool HasTransparentBackground() { return true; }
85
86 // returns true if the platform should explicitly apply a theme border
87 virtual bool CanApplyThemeBorder() const { return false; }
88
89 void Command(wxCommandEvent& event);
90 virtual bool MSWOnScroll(int orientation, WXWORD wParam,
91 WXWORD pos, WXHWND control);
92
93 virtual bool Show(bool show = true);
94 virtual bool Enable(bool show = true);
95 virtual bool SetFont(const wxFont& font);
96
97 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
98
99 protected:
100 // common part of all ctors
101 void Init();
102
103 // format an integer value as string
104 static wxString Format(int n) { return wxString::Format(_T("%d"), n); }
105
106 // get the boundig box for the slider and possible labels
107 wxRect GetBoundingBox() const;
108
109 // get the height and, if the pointer is not NULL, width of our labels
110 int GetLabelsSize(int *width = NULL) const;
111
112
113 // overridden base class virtuals
114 virtual void DoGetPosition(int *x, int *y) const;
115 virtual void DoGetSize(int *width, int *height) const;
116 virtual void DoMoveWindow(int x, int y, int width, int height);
117 virtual wxSize DoGetBestSize() const;
118
119 // the labels windows, if any
120 wxSubwindows *m_labels;
121
122 int m_rangeMin;
123 int m_rangeMax;
124 int m_pageSize;
125 int m_lineSize;
126 int m_tickFreq;
127
128 // flag needed to detect whether we're getting THUMBRELEASE event because
129 // of dragging the thumb or scrolling the mouse wheel
130 bool m_isDragging;
131
132 DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider)
133 };
134
135 #endif // _WX_SLIDER_H_
136