]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/slider.cpp
Committing in .
[wxWidgets.git] / src / palmos / slider.cpp
CommitLineData
ffecfa5a 1/////////////////////////////////////////////////////////////////////////////
e2731512 2// Name: src/palmos/slider.cpp
ffecfa5a 3// Purpose: wxSlider
e2731512 4// Author: William Osborne - minimal working wxPalmOS port
bdb54365 5// Modified by: Wlodzimierz ABX Skiba - native implementation
ffecfa5a 6// Created: 10/13/04
e2731512 7// RCS-ID: $Id$
bdb54365 8// Copyright: (c) William Osborne, Wlodzimierz Skiba
ffecfa5a
JS
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13#pragma implementation "slider.h"
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
20#pragma hdrstop
21#endif
22
23#if wxUSE_SLIDER
24
25#ifndef WX_PRECOMP
26#include "wx/utils.h"
27#include "wx/brush.h"
28#include "wx/slider.h"
29#endif
30
bdb54365 31#include "wx/toplevel.h"
ffecfa5a
JS
32
33#if wxUSE_EXTENDED_RTTI
34WX_DEFINE_FLAGS( wxSliderStyle )
35
36wxBEGIN_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)
e2731512 45
ffecfa5a
JS
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)
53
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)
63
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)
74
75wxEND_FLAGS( wxSliderStyle )
76
77IMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider, wxControl,"wx/scrolbar.h")
78
79wxBEGIN_PROPERTIES_TABLE(wxSlider)
80 wxEVENT_RANGE_PROPERTY( Scroll , wxEVT_SCROLL_TOP , wxEVT_SCROLL_ENDSCROLL , wxScrollEvent )
81 wxEVENT_PROPERTY( Updated , wxEVT_COMMAND_SLIDER_UPDATED , wxCommandEvent )
82
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
90wxEND_PROPERTIES_TABLE()
91
92wxBEGIN_HANDLERS_TABLE(wxSlider)
93wxEND_HANDLERS_TABLE()
94
95wxCONSTRUCTOR_8( wxSlider , wxWindow* , Parent , wxWindowID , Id , int , Value , int , Minimum , int , Maximum , wxPoint , Position , wxSize , Size , long , WindowStyle )
96#else
97IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
98#endif
99
100// Slider
101wxSlider::wxSlider()
102{
103}
104
105bool wxSlider::Create(wxWindow *parent, wxWindowID id,
106 int value, int minValue, int maxValue,
107 const wxPoint& pos,
108 const wxSize& size, long style,
109 const wxValidator& validator,
110 const wxString& name)
111{
a152561c
WS
112 if(!wxControl::Create(parent, id, pos, size, style, validator, name))
113 return false;
114
ba889513
WS
115 FormType* form = GetParentForm();
116 if(form==NULL)
117 return false;
bdb54365
WS
118
119 SliderControlType *slider = CtlNewSliderControl (
120 (void **)&form,
ba889513 121 GetId(),
bdb54365
WS
122 feedbackSliderCtl,
123 NULL,
124 0,
125 0,
126 pos.x,
127 pos.y,
128 size.x,
129 size.y,
130 minValue,
131 maxValue,
132 1,
133 value
134 );
135
ba889513 136 if(slider==NULL)
bdb54365
WS
137 return false;
138
139 Show();
140 return true;
ffecfa5a
JS
141}
142
bdb54365 143wxSlider::~wxSlider()
ffecfa5a 144{
ffecfa5a
JS
145}
146
bdb54365
WS
147int wxSlider::GetMin() const
148{
a152561c
WS
149 ControlType *control = (ControlType *)GetObjectPtr();
150 if(control==NULL)
151 return 0;
bdb54365 152 uint16_t ret;
a152561c 153 CtlGetSliderValues(control, &ret, NULL, NULL, NULL);
bdb54365
WS
154 return ret;
155}
156
157int wxSlider::GetMax() const
158{
a152561c
WS
159 ControlType *control = (ControlType *)GetObjectPtr();
160 if(control==NULL)
161 return 0;
bdb54365 162 uint16_t ret;
a152561c 163 CtlGetSliderValues(control, NULL, &ret, NULL, NULL);
bdb54365
WS
164 return ret;
165}
166
167int wxSlider::GetPageSize() const
ffecfa5a 168{
a152561c
WS
169 ControlType *control = (ControlType *)GetObjectPtr();
170 if(control==NULL)
171 return 0;
bdb54365 172 uint16_t ret;
a152561c 173 CtlGetSliderValues(control, NULL, NULL, &ret, NULL);
bdb54365 174 return ret;
ffecfa5a
JS
175}
176
177int wxSlider::GetValue() const
178{
a152561c
WS
179 ControlType *control = (ControlType *)GetObjectPtr();
180 if(control==NULL)
181 return 0;
bdb54365 182 uint16_t ret;
a152561c 183 CtlGetSliderValues(control, NULL, NULL, NULL, &ret);
bdb54365 184 return ret;
ffecfa5a
JS
185}
186
187void wxSlider::SetValue(int value)
188{
ba889513 189 SetIntValue(value);
ffecfa5a
JS
190}
191
ffecfa5a
JS
192wxSize wxSlider::DoGetBestSize() const
193{
194 return wxSize(0,0);
195}
196
197
198void wxSlider::SetRange(int minValue, int maxValue)
199{
200}
201
ffecfa5a
JS
202void wxSlider::SetTickFreq(int n, int pos)
203{
204}
205
206void wxSlider::SetPageSize(int pageSize)
207{
208}
209
ffecfa5a
JS
210void wxSlider::ClearSel()
211{
212}
213
214void wxSlider::ClearTicks()
215{
216}
217
218void wxSlider::SetLineSize(int lineSize)
219{
220}
221
222int wxSlider::GetLineSize() const
223{
224 return 0;
225}
226
227int wxSlider::GetSelEnd() const
228{
229 return 0;
230}
231
232int wxSlider::GetSelStart() const
233{
234 return 0;
235}
236
237void wxSlider::SetSelection(int minPos, int maxPos)
238{
239}
240
241void wxSlider::SetThumbLength(int len)
242{
243}
244
245int wxSlider::GetThumbLength() const
246{
247 return 0;
248}
249
250void wxSlider::SetTick(int tickPos)
251{
252}
253
ffecfa5a
JS
254void wxSlider::Command (wxCommandEvent & event)
255{
256}
257
ffecfa5a 258#endif // wxUSE_SLIDER