summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
diff options
context:
space:
mode:
authorGrant Gayed <ggayed>2003-06-20 17:04:30 +0000
committerGrant Gayed <ggayed>2003-06-20 17:04:30 +0000
commit2f42616f1c94fd1e484a68f6500b42d25cb99d05 (patch)
tree236d15b68e9aadf4c0c3a4b1a3e89d161d449c98 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
parenteb863de24e3cb5e6e3ded8569fcb78d4c4f41ae1 (diff)
downloadeclipse.platform.swt-2f42616f1c94fd1e484a68f6500b42d25cb99d05.tar.gz
eclipse.platform.swt-2f42616f1c94fd1e484a68f6500b42d25cb99d05.tar.xz
eclipse.platform.swt-2f42616f1c94fd1e484a68f6500b42d25cb99d05.zip
36610
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java46
1 files changed, 42 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
index eb8a8763e5..a24c5dd419 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
@@ -523,7 +523,49 @@ void resizeRectangles (int xChange, int yChange) {
} else if (yChange > 0 && ((style & SWT.DOWN) != 0) && ((cursorOrientation & SWT.UP) == 0)) {
cursorOrientation |= SWT.DOWN;
}
+
Rectangle bounds = computeBounds ();
+ // if the bounds will flip about the x or y axis then apply the adjustment
+ // up to the axis (ie.- where bounds width/height becomes 0) and change the
+ // cursor's orientation accordingly
+ if ((cursorOrientation & SWT.LEFT) != 0) {
+ if (xChange > bounds.width) {
+ if ((style & SWT.RIGHT) == 0) return;
+ cursorOrientation |= SWT.RIGHT;
+ cursorOrientation &= ~SWT.LEFT;
+ bounds.x += bounds.width;
+ xChange -= bounds.width;
+ bounds.width = 0;
+ }
+ } else if ((cursorOrientation & SWT.RIGHT) != 0) {
+ if (bounds.width < -xChange) {
+ if ((style & SWT.LEFT) == 0) return;
+ cursorOrientation |= SWT.LEFT;
+ cursorOrientation &= ~SWT.RIGHT;
+ xChange += bounds.width;
+ bounds.width = 0;
+ }
+ }
+ if ((cursorOrientation & SWT.UP) != 0) {
+ if (yChange > bounds.height) {
+ if ((style & SWT.DOWN) == 0) return;
+ cursorOrientation |= SWT.DOWN;
+ cursorOrientation &= ~SWT.UP;
+ bounds.y += bounds.height;
+ yChange -= bounds.height;
+ bounds.height = 0;
+ }
+ } else if ((cursorOrientation & SWT.DOWN) != 0) {
+ if (bounds.height < -yChange) {
+ if ((style & SWT.UP) == 0) return;
+ cursorOrientation |= SWT.UP;
+ cursorOrientation &= ~SWT.DOWN;
+ yChange += bounds.height;
+ bounds.height = 0;
+ }
+ }
+
+ // apply the bounds adjustment
if ((cursorOrientation & SWT.LEFT) != 0) {
bounds.x += xChange;
bounds.width -= xChange;
@@ -536,10 +578,6 @@ void resizeRectangles (int xChange, int yChange) {
} else if ((cursorOrientation & SWT.DOWN) != 0) {
bounds.height += yChange;
}
- /*
- * The following are conditions under which the resize should not be applied
- */
- if (bounds.width < 0 || bounds.height < 0) return;
Rectangle [] newRects = new Rectangle [rectangles.length];
for (int i = 0; i < rectangles.length; i++) {