]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/slider95.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/slider95.h
3 // Purpose: wxSlider class, using the Win95 (and later) trackbar control
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_SLIDER95_H_
13 #define _WX_SLIDER95_H_
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "slider95.h"
19 class WXDLLEXPORT wxSubwindows
;
22 class WXDLLEXPORT wxSlider
: public wxSliderBase
25 wxSlider() { Init(); }
27 wxSlider(wxWindow
*parent
,
32 const wxPoint
& pos
= wxDefaultPosition
,
33 const wxSize
& size
= wxDefaultSize
,
34 long style
= wxSL_HORIZONTAL
,
35 const wxValidator
& validator
= wxDefaultValidator
,
36 const wxString
& name
= wxSliderNameStr
)
40 (void)Create(parent
, id
, value
, minValue
, maxValue
,
41 pos
, size
, style
, validator
, name
);
44 bool Create(wxWindow
*parent
,
47 int minValue
, int maxValue
,
48 const wxPoint
& pos
= wxDefaultPosition
,
49 const wxSize
& size
= wxDefaultSize
,
50 long style
= wxSL_HORIZONTAL
,
51 const wxValidator
& validator
= wxDefaultValidator
,
52 const wxString
& name
= wxSliderNameStr
);
57 virtual int GetValue() const;
58 virtual void SetValue(int);
60 void SetRange(int minValue
, int maxValue
);
62 int GetMin() const { return m_rangeMin
; }
63 int GetMax() const { return m_rangeMax
; }
65 // Win32-specific slider methods
66 void SetTickFreq(int n
, int pos
);
67 int GetTickFreq() const { return m_tickFreq
; }
68 void SetPageSize(int pageSize
);
69 int GetPageSize() const;
72 void SetLineSize(int lineSize
);
73 int GetLineSize() const;
74 int GetSelEnd() const;
75 int GetSelStart() const;
76 void SetSelection(int minPos
, int maxPos
);
77 void SetThumbLength(int len
);
78 int GetThumbLength() const;
79 void SetTick(int tickPos
);
81 // implementation only from now on
82 WXHWND
GetStaticMin() const;
83 WXHWND
GetStaticMax() const;
84 WXHWND
GetEditValue() const;
85 virtual bool ContainsHWND(WXHWND hWnd
) const;
87 // we should let background show through the slider (and its labels)
88 virtual bool HasTransparentBackground() { return true; }
91 void Command(wxCommandEvent
& event
);
92 virtual bool MSWOnScroll(int orientation
, WXWORD wParam
,
93 WXWORD pos
, WXHWND control
);
95 virtual bool Show(bool show
= true);
96 virtual bool Enable(bool show
= true);
97 virtual bool SetFont(const wxFont
& font
);
100 // common part of all ctors
103 // format an integer value as string
104 static wxString
Format(int n
) { return wxString::Format(_T("%d"), n
); }
106 // get the boundig box for the slider and possible labels
107 wxRect
GetBoundingBox() const;
109 // get the height and, if the pointer is not NULL, width of our labels
110 int GetLabelsSize(int *width
= NULL
) const;
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;
119 virtual wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
121 virtual WXDWORD
MSWGetStyle(long flags
, WXDWORD
*exstyle
= NULL
) const;
124 // the labels windows, if any
125 wxSubwindows
*m_labels
;
134 DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider
)
137 #endif // _WX_SLIDER95_H_