diff options
author | Silenio Quarti <silenio> | 2003-12-09 18:05:04 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2003-12-09 18:05:04 +0000 |
commit | eff0452b9c4f2f0872bc1f7e923d42bf52874d39 (patch) | |
tree | f6a509da9baa0a17b3ff0512c8e05c0f8b9ecb23 | |
parent | 632489633baf3198c4fcd87bb8b0cb955b1415fc (diff) | |
download | eclipse.platform.swt-eff0452b9c4f2f0872bc1f7e923d42bf52874d39.tar.gz eclipse.platform.swt-eff0452b9c4f2f0872bc1f7e923d42bf52874d39.tar.xz eclipse.platform.swt-eff0452b9c4f2f0872bc1f7e923d42bf52874d39.zip |
thumb eating
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java | 37 | ||||
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java | 37 |
2 files changed, 70 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java index 7267c3a82a..4db6119f3b 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java @@ -525,7 +525,23 @@ public void setIncrement (int value) { */ public void setMaximum (int value) { checkWidget(); - OS.PtSetResource (handle, OS.Pt_ARG_MAXIMUM, value - 1, 0); + int [] args = { + OS.Pt_ARG_MAXIMUM, 0, 0, + OS.Pt_ARG_MINIMUM, 0, 0, + OS.Pt_ARG_SLIDER_SIZE, 0, 0, + OS.Pt_ARG_GAUGE_VALUE, 0, 0, + }; + OS.PtGetResources (handle, args.length / 3, args); + int minimum = args [4]; + if (value <= minimum) return; + int thumb = args [7]; + thumb = Math.min (thumb, value - minimum); + int selection = args [10]; + selection = Math.min (selection, value - thumb); + args [1] = value - 1; + args [7] = thumb; + args [10] = selection; + OS.PtSetResources (handle, args.length / 3, args); } /** @@ -542,7 +558,24 @@ public void setMaximum (int value) { */ public void setMinimum (int value) { checkWidget(); - OS.PtSetResource (handle, OS.Pt_ARG_MINIMUM, value, 0); + if (value < 0) return; + int [] args = { + OS.Pt_ARG_MAXIMUM, 0, 0, + OS.Pt_ARG_MINIMUM, 0, 0, + OS.Pt_ARG_SLIDER_SIZE, 0, 0, + OS.Pt_ARG_GAUGE_VALUE, 0, 0, + }; + OS.PtGetResources (handle, args.length / 3, args); + int maximum = args [1] + 1; + if (value >= maximum) return; + int thumb = args [7]; + thumb = Math.min (thumb, maximum - value); + int selection = args [10]; + selection = Math.max (selection, value); + args [4] = value; + args [7] = thumb; + args [10] = selection; + OS.PtSetResources (handle, args.length / 3, args); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java index 5fdd08f104..bbec9a391e 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java @@ -393,7 +393,23 @@ public void setIncrement (int value) { */ public void setMaximum (int value) { checkWidget(); - OS.PtSetResource (handle, OS.Pt_ARG_MAXIMUM, value - 1, 0); + int [] args = { + OS.Pt_ARG_MAXIMUM, 0, 0, + OS.Pt_ARG_MINIMUM, 0, 0, + OS.Pt_ARG_SLIDER_SIZE, 0, 0, + OS.Pt_ARG_GAUGE_VALUE, 0, 0, + }; + OS.PtGetResources (handle, args.length / 3, args); + int minimum = args [4]; + if (value <= minimum) return; + int thumb = args [7]; + thumb = Math.min (thumb, value - minimum); + int selection = args [10]; + selection = Math.min (selection, value - thumb); + args [1] = value - 1; + args [7] = thumb; + args [10] = selection; + OS.PtSetResources (handle, args.length / 3, args); } /** @@ -410,7 +426,24 @@ public void setMaximum (int value) { */ public void setMinimum (int value) { checkWidget(); - OS.PtSetResource (handle, OS.Pt_ARG_MINIMUM, value, 0); + if (value < 0) return; + int [] args = { + OS.Pt_ARG_MAXIMUM, 0, 0, + OS.Pt_ARG_MINIMUM, 0, 0, + OS.Pt_ARG_SLIDER_SIZE, 0, 0, + OS.Pt_ARG_GAUGE_VALUE, 0, 0, + }; + OS.PtGetResources (handle, args.length / 3, args); + int maximum = args [1] + 1; + if (value >= maximum) return; + int thumb = args [7]; + thumb = Math.min (thumb, maximum - value); + int selection = args [10]; + selection = Math.max (selection, value); + args [4] = value; + args [7] = thumb; + args [10] = selection; + OS.PtSetResources (handle, args.length / 3, args); } /** |