comparison dwt/widgets/ProgressBar.d @ 320:da968414c383

Merge changes SWT 3.4.1
author Frank Benoit <benoit@tionex.de>
date Mon, 03 Nov 2008 21:58:40 +0100
parents fd9c62a2998e
children
comparison
equal deleted inserted replaced
319:71b78d56f01f 320:da968414c383
338 */ 338 */
339 public void setSelection (int value) { 339 public void setSelection (int value) {
340 checkWidget (); 340 checkWidget ();
341 /* 341 /*
342 * Feature in Vista. When the progress bar is not in 342 * Feature in Vista. When the progress bar is not in
343 * a normal state, PBM_SETPOS does not set the position. 343 * a normal state, PBM_SETPOS does not set the position
344 * of the bar when the selection is equal to the minimum.
344 * This is undocumented. The fix is to temporarily 345 * This is undocumented. The fix is to temporarily
345 * set the state to PBST_NORMAL, set the position, then 346 * set the state to PBST_NORMAL, set the position, then
346 * reset the state. 347 * reset the state.
347 */ 348 */
348 int /*long*/ state = 0; 349 int /*long*/ state = 0;
350 bool fixSelection = false;
349 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { 351 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
350 state = OS.SendMessage (handle, OS.PBM_GETSTATE, 0, 0); 352 int /*long*/ minumum = OS.SendMessage (handle, OS.PBM_GETRANGE, 1, 0);
351 OS.SendMessage (handle, OS.PBM_SETSTATE, OS.PBST_NORMAL, 0); 353 int /*long*/ selection = OS.SendMessage (handle, OS.PBM_GETPOS, 0, 0);
354 if (selection is minumum) {
355 fixSelection = true;
356 state = OS.SendMessage (handle, OS.PBM_GETSTATE, 0, 0);
357 OS.SendMessage (handle, OS.PBM_SETSTATE, OS.PBST_NORMAL, 0);
358 }
352 } 359 }
353 OS.SendMessage (handle, OS.PBM_SETPOS, value, 0); 360 OS.SendMessage (handle, OS.PBM_SETPOS, value, 0);
354 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { 361 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
355 OS.SendMessage (handle, OS.PBM_SETSTATE, state, 0); 362 if (fixSelection) OS.SendMessage (handle, OS.PBM_SETSTATE, state, 0);
356 } 363 }
357 } 364 }
358 365
359 /** 366 /**
360 * Sets the state of the receiver. The state must be one of these values: 367 * Sets the state of the receiver. The state must be one of these values: