comparison win/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 4b94c9f5ddeb
children 53547c9c99a2
comparison
equal deleted inserted replaced
1189:c5419ef79a77 1190:76262040ed5f
7059 * handle: Handle to the percent bar to be set. 7059 * handle: Handle to the percent bar to be set.
7060 * position: Position of the percent bar withing the range. 7060 * position: Position of the percent bar withing the range.
7061 */ 7061 */
7062 void API dw_percent_set_pos(HWND handle, unsigned int position) 7062 void API dw_percent_set_pos(HWND handle, unsigned int position)
7063 { 7063 {
7064 SendMessage(handle, PBM_SETPOS, (WPARAM)position, 0); 7064 if(position == DW_PERCENT_INDETERMINATE)
7065 {
7066 /* If our common controls supports it... */
7067 if((dwComctlVer >= PACKVERSION(6,0)))
7068 {
7069 /* Enable the style on the control */
7070 SetWindowLong(handle, GWL_STYLE, GetWindowLong(handle, GWL_STYLE) | PBS_MARQUEE);
7071 /* Start the bar going */
7072 SendMessage(handle, PBM_SETMARQUEE, 1, 100);
7073 }
7074 else
7075 SendMessage(handle, PBM_SETPOS, 0, 0);
7076 }
7077 else
7078 {
7079 if((dwComctlVer >= PACKVERSION(6,0)))
7080 {
7081 unsigned long style = GetWindowLong(handle, GWL_STYLE);
7082
7083 if(style & PBS_MARQUEE)
7084 {
7085 /* Stop the bar */
7086 SendMessage(handle, PBM_SETMARQUEE, 0, 0);
7087 /* Disable the style on the control */
7088 SetWindowLong(handle, GWL_STYLE, style & ~PBS_MARQUEE);
7089 }
7090 }
7091 /* Otherwise just set the position */
7092 SendMessage(handle, PBM_SETPOS, (WPARAM)position, 0);
7093 }
7065 } 7094 }
7066 7095
7067 /* 7096 /*
7068 * Returns the position of the slider. 7097 * Returns the position of the slider.
7069 * Parameters: 7098 * Parameters: