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