]> git.saurik.com Git - wxWidgets.git/blobdiff - src/palmos/slider.cpp
Committed Raise()Lower() fix.
[wxWidgets.git] / src / palmos / slider.cpp
index b71a9a400479b093c136a69f00bc2ae1cf6e11d3..ccc69ab7d76eef9bfe4e2a725ad87a0d42910c07 100644 (file)
@@ -2,10 +2,10 @@
 // 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
 /////////////////////////////////////////////////////////////////////////////
 
@@ -28,8 +28,7 @@
 #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 )
@@ -110,41 +109,86 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
            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);
@@ -155,12 +199,6 @@ void wxSlider::SetRange(int minValue, int maxValue)
 {
 }
 
-WXHBRUSH wxSlider::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
-            WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
-{
-    return 0;
-}
-
 void wxSlider::SetTickFreq(int n, int pos)
 {
 }
@@ -169,11 +207,6 @@ void wxSlider::SetPageSize(int pageSize)
 {
 }
 
-int wxSlider::GetPageSize() const
-{
-  return 0;
-}
-
 void wxSlider::ClearSel()
 {
 }
@@ -218,18 +251,20 @@ void wxSlider::SetTick(int tickPos)
 {
 }
 
-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