diff options
author | Veronika Irvine <veronika> | 2004-11-26 17:48:36 +0000 |
---|---|---|
committer | Veronika Irvine <veronika> | 2004-11-26 17:48:36 +0000 |
commit | eb6afd67c15e0bfac3a9e5e111ad90814cd06603 (patch) | |
tree | c1367adf53fa264ec832e8969f02bc9d23ceb356 /bundles/org.eclipse.swt/Eclipse SWT Custom Widgets | |
parent | 53589931c57a2758ce0fb761e62dab57822faf93 (diff) | |
download | eclipse.platform.swt-eb6afd67c15e0bfac3a9e5e111ad90814cd06603.tar.gz eclipse.platform.swt-eb6afd67c15e0bfac3a9e5e111ad90814cd06603.tar.xz eclipse.platform.swt-eb6afd67c15e0bfac3a9e5e111ad90814cd06603.zip |
improve support for drag minimum
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Custom Widgets')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java index 3cedb7f0ae..29965749b3 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java @@ -157,17 +157,6 @@ Control[] getControls(boolean onlyVisible) { return result; } void onDragSash(Event event) { - if (event.detail == SWT.DRAG) { - // constrain feedback - Rectangle area = getClientArea(); - if (getOrientation() == SWT.HORIZONTAL) { - event.x = Math.min(Math.max(DRAG_MINIMUM, event.x), area.width - DRAG_MINIMUM - SASH_WIDTH); - } else { - event.y = Math.min(Math.max(DRAG_MINIMUM, event.y), area.height - DRAG_MINIMUM - SASH_WIDTH); - } - return; - } - Sash sash = (Sash)event.widget; int sashIndex = -1; for (int i= 0; i < sashes.length; i++) { @@ -191,6 +180,7 @@ void onDragSash(Event event) { b2.x += shift; b2.width -= shift; if (b1.width < DRAG_MINIMUM || b2.width < DRAG_MINIMUM) { + event.x = b1.x + DRAG_MINIMUM; event.doit = false; return; } @@ -202,16 +192,18 @@ void onDragSash(Event event) { b2.y += shift; b2.height -= shift; if (b1.height < DRAG_MINIMUM || b2.height < DRAG_MINIMUM) { + event.y = b1.y + DRAG_MINIMUM; event.doit = false; return; } c1.setData(LAYOUT_RATIO, new Long((((long)b1.height << 16) + area.height - 1) / area.height)); c2.setData(LAYOUT_RATIO, new Long((((long)b2.height << 16) + area.height - 1) / area.height)); } - - c1.setBounds(b1); - sash.setBounds(event.x, event.y, event.width, event.height); - c2.setBounds(b2); + if (event.detail != SWT.DRAG) { + c1.setBounds(b1); + sash.setBounds(event.x, event.y, event.width, event.height); + c2.setBounds(b2); + } } /** * If orientation is SWT.HORIZONTAL, lay the controls in the SashForm |