1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/slider.cpp
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by: Wlodzimierz ABX Skiba - native implementation
8 // Copyright: (c) William Osborne, Wlodzimierz Skiba
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/toplevel.h"
33 #if wxUSE_EXTENDED_RTTI
34 WX_DEFINE_FLAGS( wxSliderStyle
)
36 wxBEGIN_FLAGS( wxSliderStyle
)
37 // new style border flags, we put them first to
38 // use them for streaming out
39 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
40 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
41 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
42 wxFLAGS_MEMBER(wxBORDER_RAISED
)
43 wxFLAGS_MEMBER(wxBORDER_STATIC
)
44 wxFLAGS_MEMBER(wxBORDER_NONE
)
46 // old style border flags
47 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
48 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
49 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
50 wxFLAGS_MEMBER(wxRAISED_BORDER
)
51 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
52 wxFLAGS_MEMBER(wxBORDER
)
54 // standard window styles
55 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
56 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
57 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
58 wxFLAGS_MEMBER(wxWANTS_CHARS
)
59 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
60 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
61 wxFLAGS_MEMBER(wxVSCROLL
)
62 wxFLAGS_MEMBER(wxHSCROLL
)
64 wxFLAGS_MEMBER(wxSL_HORIZONTAL
)
65 wxFLAGS_MEMBER(wxSL_VERTICAL
)
66 wxFLAGS_MEMBER(wxSL_AUTOTICKS
)
67 wxFLAGS_MEMBER(wxSL_LABELS
)
68 wxFLAGS_MEMBER(wxSL_LEFT
)
69 wxFLAGS_MEMBER(wxSL_TOP
)
70 wxFLAGS_MEMBER(wxSL_RIGHT
)
71 wxFLAGS_MEMBER(wxSL_BOTTOM
)
72 wxFLAGS_MEMBER(wxSL_BOTH
)
73 wxFLAGS_MEMBER(wxSL_SELRANGE
)
75 wxEND_FLAGS( wxSliderStyle
)
77 IMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider
, wxControl
,"wx/scrolbar.h")
79 wxBEGIN_PROPERTIES_TABLE(wxSlider
)
80 wxEVENT_RANGE_PROPERTY( Scroll
, wxEVT_SCROLL_TOP
, wxEVT_SCROLL_ENDSCROLL
, wxScrollEvent
)
81 wxEVENT_PROPERTY( Updated
, wxEVT_COMMAND_SLIDER_UPDATED
, wxCommandEvent
)
83 wxPROPERTY( Value
, int , SetValue
, GetValue
, 0, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
84 wxPROPERTY( Minimum
, int , SetMin
, GetMin
, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
85 wxPROPERTY( Maximum
, int , SetMax
, GetMax
, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
86 wxPROPERTY( PageSize
, int , SetPageSize
, GetLineSize
, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
87 wxPROPERTY( LineSize
, int , SetLineSize
, GetLineSize
, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
88 wxPROPERTY( ThumbLength
, int , SetThumbLength
, GetThumbLength
, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
89 wxPROPERTY_FLAGS( WindowStyle
, wxSliderStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
90 wxEND_PROPERTIES_TABLE()
92 wxBEGIN_HANDLERS_TABLE(wxSlider
)
93 wxEND_HANDLERS_TABLE()
95 wxCONSTRUCTOR_8( wxSlider
, wxWindow
* , Parent
, wxWindowID
, Id
, int , Value
, int , Minimum
, int , Maximum
, wxPoint
, Position
, wxSize
, Size
, long , WindowStyle
)
97 IMPLEMENT_DYNAMIC_CLASS(wxSlider
, wxControl
)
105 bool wxSlider::Create(wxWindow
*parent
, wxWindowID id
,
106 int value
, int minValue
, int maxValue
,
108 const wxSize
& size
, long style
,
109 const wxValidator
& validator
,
110 const wxString
& name
)
112 wxWindow
* parentTLW
= GetParent();
113 while ( parentTLW
&& !parentTLW
->IsTopLevel() )
115 parentTLW
= parentTLW
->GetParent();
117 wxTopLevelWindowPalm
* tlw
= wxDynamicCast(parentTLW
, wxTopLevelWindowPalm
);
120 FormType
* form
= tlw
->GetForm();
124 SliderControlType
*slider
= CtlNewSliderControl (
141 m_control
= (ControlType
*) slider
;
150 wxSlider::~wxSlider()
154 int wxSlider::GetMin() const
157 CtlGetSliderValues(m_control
, &ret
, NULL
, NULL
, NULL
);
161 int wxSlider::GetMax() const
164 CtlGetSliderValues(m_control
, NULL
, &ret
, NULL
, NULL
);
168 int wxSlider::GetPageSize() const
171 CtlGetSliderValues(m_control
, NULL
, NULL
, &ret
, NULL
);
175 int wxSlider::GetValue() const
178 CtlGetSliderValues(m_control
, NULL
, NULL
, NULL
, &ret
);
182 void wxSlider::SetValue(int value
)
186 void wxSlider::DoGetSize(int *width
, int *height
) const
190 void wxSlider::GetPosition(int *x
, int *y
) const
194 void wxSlider::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
199 wxSize
wxSlider::DoGetBestSize() const
205 void wxSlider::SetRange(int minValue
, int maxValue
)
209 void wxSlider::SetTickFreq(int n
, int pos
)
213 void wxSlider::SetPageSize(int pageSize
)
217 void wxSlider::ClearSel()
221 void wxSlider::ClearTicks()
225 void wxSlider::SetLineSize(int lineSize
)
229 int wxSlider::GetLineSize() const
234 int wxSlider::GetSelEnd() const
239 int wxSlider::GetSelStart() const
244 void wxSlider::SetSelection(int minPos
, int maxPos
)
248 void wxSlider::SetThumbLength(int len
)
252 int wxSlider::GetThumbLength() const
257 void wxSlider::SetTick(int tickPos
)
261 void wxSlider::Command (wxCommandEvent
& event
)
265 #endif // wxUSE_SLIDER