diff os2/dw.c @ 1190:76262040ed5f

Added DW_PERCENT_INDETERMINATE which can be passed to dw_percent_set_pos() to show a rotating or otherwise indeterminate percent bar on supported platforms. Platforms which don't support it will either show no progress or potentially growing and contracting progress in the future if that doesn't look too weird. Committed from Windows so may be fixes coming for the other platforms soon.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 28 Sep 2011 08:22:48 +0000
parents 0f85796c6988
children 9b021f787ad1
line wrap: on
line diff
--- a/os2/dw.c	Tue Sep 27 22:38:25 2011 +0000
+++ b/os2/dw.c	Wed Sep 28 08:22:48 2011 +0000
@@ -6725,10 +6725,18 @@
 void API dw_percent_set_pos(HWND handle, unsigned int position)
 {
    int range = _dw_percent_get_range(handle);
-   int mypos = ((float)position/100)*range;
-
-   if(range)
-   {
+
+   /* OS/2 doesn't really support indeterminate... */
+   if(position == DW_PERCENT_INDETERMINATE)
+   {
+      /* So set the position to 0 */
+      WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)0);
+   }
+   else if(range)
+   {
+      /* Otherwise set the position as usual */
+      int mypos = ((float)position/100)*range;
+  
       _dw_int_set(handle, mypos);
       WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)mypos);
    }