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