summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2003-12-09 18:05:04 +0000
committerSilenio Quarti <silenio>2003-12-09 18:05:04 +0000
commiteff0452b9c4f2f0872bc1f7e923d42bf52874d39 (patch)
treef6a509da9baa0a17b3ff0512c8e05c0f8b9ecb23
parent632489633baf3198c4fcd87bb8b0cb955b1415fc (diff)
downloadeclipse.platform.swt-eff0452b9c4f2f0872bc1f7e923d42bf52874d39.tar.gz
eclipse.platform.swt-eff0452b9c4f2f0872bc1f7e923d42bf52874d39.tar.xz
eclipse.platform.swt-eff0452b9c4f2f0872bc1f7e923d42bf52874d39.zip
thumb eating
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java37
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java37
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);
}
/**