// Name: src/palmos/slider.cpp
// Purpose: wxSlider
// Author: William Osborne - minimal working wxPalmOS port
-// Modified by:
+// Modified by: Wlodzimierz ABX Skiba - native implementation
// Created: 10/13/04
// RCS-ID: $Id$
-// Copyright: (c) William Osborne
+// Copyright: (c) William Osborne, Wlodzimierz Skiba
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/slider.h"
#endif
-#include "wx/palmos/slider.h"
-#include "wx/palmos/private.h"
+#include "wx/toplevel.h"
#if wxUSE_EXTENDED_RTTI
WX_DEFINE_FLAGS( wxSliderStyle )
const wxValidator& validator,
const wxString& name)
{
- return false;
-}
-
-bool wxSlider::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam,
- WXWORD WXUNUSED(pos), WXHWND control)
-{
- return false;
+ if(!wxControl::Create(parent, id, pos, size, style, validator, name))
+ return false;
+
+ FormType* form = GetParentForm();
+ if(form==NULL)
+ return false;
+
+ SliderControlType *slider = CtlNewSliderControl (
+ (void **)&form,
+ GetId(),
+ feedbackSliderCtl,
+ NULL,
+ 0,
+ 0,
+ pos.x,
+ pos.y,
+ size.x,
+ size.y,
+ minValue,
+ maxValue,
+ 1,
+ value
+ );
+
+ if(slider==NULL)
+ return false;
+
+ Show();
+ return true;
}
wxSlider::~wxSlider()
{
}
-int wxSlider::GetValue() const
+int wxSlider::GetMin() const
{
- return 0;
+ ControlType *control = (ControlType *)GetObjectPtr();
+ if(control==NULL)
+ return 0;
+ uint16_t ret;
+ CtlGetSliderValues(control, &ret, NULL, NULL, NULL);
+ return ret;
}
-void wxSlider::SetValue(int value)
+int wxSlider::GetMax() const
{
+ ControlType *control = (ControlType *)GetObjectPtr();
+ if(control==NULL)
+ return 0;
+ uint16_t ret;
+ CtlGetSliderValues(control, NULL, &ret, NULL, NULL);
+ return ret;
}
-void wxSlider::DoGetSize(int *width, int *height) const
+int wxSlider::GetPageSize() const
{
+ ControlType *control = (ControlType *)GetObjectPtr();
+ if(control==NULL)
+ return 0;
+ uint16_t ret;
+ CtlGetSliderValues(control, NULL, NULL, &ret, NULL);
+ return ret;
}
-void wxSlider::GetPosition(int *x, int *y) const
+int wxSlider::GetValue() const
{
+ ControlType *control = (ControlType *)GetObjectPtr();
+ if(control==NULL)
+ return 0;
+ uint16_t ret;
+ CtlGetSliderValues(control, NULL, NULL, NULL, &ret);
+ return ret;
}
-void wxSlider::DoSetSize(int x, int y, int width, int height, int sizeFlags)
+void wxSlider::SetValue(int value)
{
+ SetIntValue(value);
}
-
wxSize wxSlider::DoGetBestSize() const
{
return wxSize(0,0);
{
}
-WXHBRUSH wxSlider::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
- WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
-{
- return 0;
-}
-
void wxSlider::SetTickFreq(int n, int pos)
{
}
{
}
-int wxSlider::GetPageSize() const
-{
- return 0;
-}
-
void wxSlider::ClearSel()
{
}
{
}
-bool wxSlider::ContainsHWND(WXHWND hWnd) const
-{
- return false;
-}
+// ----------------------------------------------------------------------------
+// helpers
+// ----------------------------------------------------------------------------
-void wxSlider::Command (wxCommandEvent & event)
+bool wxSlider::SendUpdatedEvent()
{
+ wxCommandEvent event(wxEVT_COMMAND_SLIDER_UPDATED, GetId());
+ event.SetEventObject(this);
+ event.SetInt(GetValue());
+ return ProcessCommand(event);
}
-bool wxSlider::Show(bool show)
+void wxSlider::Command (wxCommandEvent & event)
{
- return false;
}
#endif // wxUSE_SLIDER