1 /////////////////////////////////////////////////////////////////////////////
4 // Author: William Osborne
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "slider.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
28 #include "wx/slider.h"
31 #include "wx/palmos/slider.h"
32 #include "wx/palmos/private.h"
34 #if wxUSE_EXTENDED_RTTI
35 WX_DEFINE_FLAGS( wxSliderStyle
)
37 wxBEGIN_FLAGS( wxSliderStyle
)
38 // new style border flags, we put them first to
39 // use them for streaming out
40 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
41 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
42 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
43 wxFLAGS_MEMBER(wxBORDER_RAISED
)
44 wxFLAGS_MEMBER(wxBORDER_STATIC
)
45 wxFLAGS_MEMBER(wxBORDER_NONE
)
47 // old style border flags
48 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
49 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
50 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
51 wxFLAGS_MEMBER(wxRAISED_BORDER
)
52 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
53 wxFLAGS_MEMBER(wxBORDER
)
55 // standard window styles
56 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
57 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
58 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
59 wxFLAGS_MEMBER(wxWANTS_CHARS
)
60 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
61 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
62 wxFLAGS_MEMBER(wxVSCROLL
)
63 wxFLAGS_MEMBER(wxHSCROLL
)
65 wxFLAGS_MEMBER(wxSL_HORIZONTAL
)
66 wxFLAGS_MEMBER(wxSL_VERTICAL
)
67 wxFLAGS_MEMBER(wxSL_AUTOTICKS
)
68 wxFLAGS_MEMBER(wxSL_LABELS
)
69 wxFLAGS_MEMBER(wxSL_LEFT
)
70 wxFLAGS_MEMBER(wxSL_TOP
)
71 wxFLAGS_MEMBER(wxSL_RIGHT
)
72 wxFLAGS_MEMBER(wxSL_BOTTOM
)
73 wxFLAGS_MEMBER(wxSL_BOTH
)
74 wxFLAGS_MEMBER(wxSL_SELRANGE
)
76 wxEND_FLAGS( wxSliderStyle
)
78 IMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider
, wxControl
,"wx/scrolbar.h")
80 wxBEGIN_PROPERTIES_TABLE(wxSlider
)
81 wxEVENT_RANGE_PROPERTY( Scroll
, wxEVT_SCROLL_TOP
, wxEVT_SCROLL_ENDSCROLL
, wxScrollEvent
)
82 wxEVENT_PROPERTY( Updated
, wxEVT_COMMAND_SLIDER_UPDATED
, wxCommandEvent
)
84 wxPROPERTY( Value
, int , SetValue
, GetValue
, 0, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
85 wxPROPERTY( Minimum
, int , SetMin
, GetMin
, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
86 wxPROPERTY( Maximum
, int , SetMax
, GetMax
, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
87 wxPROPERTY( PageSize
, int , SetPageSize
, GetLineSize
, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
88 wxPROPERTY( LineSize
, int , SetLineSize
, GetLineSize
, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
89 wxPROPERTY( ThumbLength
, int , SetThumbLength
, GetThumbLength
, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
90 wxPROPERTY_FLAGS( WindowStyle
, wxSliderStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
91 wxEND_PROPERTIES_TABLE()
93 wxBEGIN_HANDLERS_TABLE(wxSlider
)
94 wxEND_HANDLERS_TABLE()
96 wxCONSTRUCTOR_8( wxSlider
, wxWindow
* , Parent
, wxWindowID
, Id
, int , Value
, int , Minimum
, int , Maximum
, wxPoint
, Position
, wxSize
, Size
, long , WindowStyle
)
98 IMPLEMENT_DYNAMIC_CLASS(wxSlider
, wxControl
)
106 bool wxSlider::Create(wxWindow
*parent
, wxWindowID id
,
107 int value
, int minValue
, int maxValue
,
109 const wxSize
& size
, long style
,
110 const wxValidator
& validator
,
111 const wxString
& name
)
116 bool wxSlider::MSWOnScroll(int WXUNUSED(orientation
), WXWORD wParam
,
117 WXWORD
WXUNUSED(pos
), WXHWND control
)
122 wxSlider::~wxSlider()
126 int wxSlider::GetValue() const
131 void wxSlider::SetValue(int value
)
135 void wxSlider::DoGetSize(int *width
, int *height
) const
139 void wxSlider::GetPosition(int *x
, int *y
) const
143 void wxSlider::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
148 wxSize
wxSlider::DoGetBestSize() const
154 void wxSlider::SetRange(int minValue
, int maxValue
)
158 WXHBRUSH
wxSlider::OnCtlColor(WXHDC pDC
, WXHWND pWnd
, WXUINT nCtlColor
,
159 WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
164 void wxSlider::SetTickFreq(int n
, int pos
)
168 void wxSlider::SetPageSize(int pageSize
)
172 int wxSlider::GetPageSize() const
177 void wxSlider::ClearSel()
181 void wxSlider::ClearTicks()
185 void wxSlider::SetLineSize(int lineSize
)
189 int wxSlider::GetLineSize() const
194 int wxSlider::GetSelEnd() const
199 int wxSlider::GetSelStart() const
204 void wxSlider::SetSelection(int minPos
, int maxPos
)
208 void wxSlider::SetThumbLength(int len
)
212 int wxSlider::GetThumbLength() const
217 void wxSlider::SetTick(int tickPos
)
221 bool wxSlider::ContainsHWND(WXHWND hWnd
) const
226 void wxSlider::Command (wxCommandEvent
& event
)
230 bool wxSlider::Show(bool show
)
235 #endif // wxUSE_SLIDER