diff options
author | Grant Gayed <ggayed> | 2003-01-15 22:47:35 +0000 |
---|---|---|
committer | Grant Gayed <ggayed> | 2003-01-15 22:47:35 +0000 |
commit | 157401f39542db381bc74d57026c5f7c876a31d7 (patch) | |
tree | 37baad211a2793e1b76d77ecb5596b45bb82fcbe /bundles/org.eclipse.swt/Eclipse SWT | |
parent | 018f88f0b9ca95232a21f542c51ddb6d56091dea (diff) | |
download | eclipse.platform.swt-157401f39542db381bc74d57026c5f7c876a31d7.tar.gz eclipse.platform.swt-157401f39542db381bc74d57026c5f7c876a31d7.tar.xz eclipse.platform.swt-157401f39542db381bc74d57026c5f7c876a31d7.zip |
*** empty log message ***
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT')
4 files changed, 23 insertions, 25 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java index 080b63bd12..f02ca33d11 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java @@ -28,7 +28,7 @@ import org.eclipse.swt.internal.gtk.*; * </p> */ public class ProgressBar extends Control { - int timerId, min = 0, max = 100, value = 0; + int timerId, minimum = 0, maximum = 100, selection = 0; static final int DELAY = 100; /** @@ -101,7 +101,7 @@ void createHandle (int index) { */ public int getMaximum () { checkWidget (); - return max; + return maximum; } /** @@ -116,7 +116,7 @@ public int getMaximum () { */ public int getMinimum () { checkWidget (); - return min; + return minimum; } /** @@ -131,7 +131,7 @@ public int getMinimum () { */ public int getSelection () { checkWidget (); - return value; + return selection; } void releaseWidget () { @@ -152,12 +152,12 @@ void releaseWidget () { * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setMaximum (int maximum) { +public void setMaximum (int value) { checkWidget (); - if (maximum <= min) return; - max = maximum; - if (value > maximum) value = maximum; - updateBar (value, min, max); + if (value <= minimum) return; + maximum = value; + selection = Math.min (selection, maximum); + updateBar (selection, minimum, maximum); } /** @@ -172,12 +172,12 @@ public void setMaximum (int maximum) { * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setMinimum (int minimum) { +public void setMinimum (int value) { checkWidget (); - if (minimum < 0 || minimum >= max) return; - if (value < minimum) value = minimum; - min = minimum; - updateBar (value, min, max); + if (value < 0 || value >= maximum) return; + minimum = value; + selection = Math.max (selection, minimum); + updateBar (selection, minimum, maximum); } /** @@ -192,12 +192,10 @@ public void setMinimum (int minimum) { * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setSelection (int x) { +public void setSelection (int value) { checkWidget (); - if (x < min) x = min; - if (x > max) x = max; - value = x; - updateBar (value, min, max); + selection = Math.max (minimum, Math.min (maximum, value)); + updateBar (selection, minimum, maximum); } int timerProc (int widget) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java index 41b06d67aa..31b1f263ae 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java @@ -317,11 +317,11 @@ public void setMaximum (int value) { OS.memmove (adjustment, hAdjustment); if (value <= adjustment.lower) return; adjustment.upper = (float) value; + adjustment.value = Math.min (adjustment.value, value); OS.memmove (hAdjustment, adjustment); OS.g_signal_handlers_block_matched (hAdjustment, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); OS.gtk_adjustment_changed (hAdjustment); OS.g_signal_handlers_unblock_matched (hAdjustment, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); - if (value < getSelection()) setSelection(value); } /** @@ -344,11 +344,11 @@ public void setMinimum (int value) { OS.memmove (adjustment, hAdjustment); if (value >= adjustment.upper) return; adjustment.lower = (float) value; + adjustment.value = Math.max (adjustment.value, value); OS.memmove (hAdjustment, adjustment); OS.g_signal_handlers_block_matched (hAdjustment, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); OS.gtk_adjustment_changed (hAdjustment); OS.g_signal_handlers_unblock_matched (hAdjustment, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); - if (value > getSelection()) setSelection(value); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java index 69bace2810..5d9a61308a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java @@ -499,11 +499,11 @@ public void setMaximum (int value) { OS.memmove (adjustment, handle); if (value <= adjustment.lower) return; adjustment.upper = (float) value; + adjustment.value = Math.min (adjustment.value, value - adjustment.page_size); OS.memmove (handle, adjustment); OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); OS.gtk_adjustment_changed (handle); OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); - if (value < getSelection() + getThumb()) setSelection (value - getThumb()); } /** @@ -525,11 +525,11 @@ public void setMinimum (int value) { OS.memmove (adjustment, handle); if (value >= adjustment.upper) return; adjustment.lower = (float) value; + adjustment.value = Math.max (adjustment.value, value); OS.memmove (handle, adjustment); OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); OS.gtk_adjustment_changed (handle); OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); - if (value > getSelection()) setSelection (value); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java index 870650ab71..487ddcdecc 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java @@ -377,11 +377,11 @@ public void setMaximum (int value) { OS.memmove (adjustment, hAdjustment); if (value <= adjustment.lower) return; adjustment.upper = (double) value; + adjustment.value = Math.min (adjustment.value, value - adjustment.page_size); OS.memmove (hAdjustment, adjustment); OS.g_signal_handlers_block_matched (hAdjustment, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); OS.gtk_adjustment_changed (hAdjustment); OS.g_signal_handlers_unblock_matched (hAdjustment, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); - if (value < getSelection() + getThumb()) setSelection (value - getThumb()); } /** @@ -404,11 +404,11 @@ public void setMinimum (int value) { OS.memmove (adjustment, hAdjustment); if (value >= adjustment.upper) return; adjustment.lower = (double) value; + adjustment.value = Math.max (adjustment.value, value); OS.memmove (hAdjustment, adjustment); OS.g_signal_handlers_block_matched (hAdjustment, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); OS.gtk_adjustment_changed (hAdjustment); OS.g_signal_handlers_unblock_matched (hAdjustment, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); - if (value > getSelection()) setSelection (value); } /** |