diff options
author | Silenio Quarti <silenio> | 2002-12-10 17:37:26 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2002-12-10 17:37:26 +0000 |
commit | e526124eb0b0190d5dc2144aa7a1d11a550bee18 (patch) | |
tree | 05b748f678139b8e9ba8912817f7a1f1cb7811d3 | |
parent | beb3ad500cc19d18084de96ff8d7282cdd3bf773 (diff) | |
download | eclipse.platform.swt-e526124eb0b0190d5dc2144aa7a1d11a550bee18.tar.gz eclipse.platform.swt-e526124eb0b0190d5dc2144aa7a1d11a550bee18.tar.xz eclipse.platform.swt-e526124eb0b0190d5dc2144aa7a1d11a550bee18.zip |
setBounds
8 files changed, 40 insertions, 36 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Composite.java index 8f4095cae6..c5e2f1c46a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Composite.java @@ -285,11 +285,9 @@ void releaseWidget () { tabList = null; } -int setBounds (int control, int x, int y, int width, int height, boolean move, boolean resize) { - int result = super.setBounds(control, x, y, width, height, move, resize); - if (resize && layout != null && (result & RESIZED) != 0) { - layout.layout (this, false); - } +int setBounds (int control, int x, int y, int width, int height, boolean move, boolean resize, boolean events) { + int result = super.setBounds(control, x, y, width, height, move, resize, events); + if (layout != null && (result & RESIZED) != 0) layout.layout (this, false); return result; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java index bd7234d563..1941683557 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java @@ -891,9 +891,7 @@ public void setBackground (Color color) { public void setBounds (int x, int y, int width, int height) { checkWidget(); - int result = setBounds (topHandle (), x, y, width, height, true, true); - if ((result & MOVED) != 0) sendEvent (SWT.Move); - if ((result & RESIZED) != 0) sendEvent (SWT.Resize); + setBounds (topHandle (), x, y, width, height, true, true, true); } public void setBounds (Rectangle rect) { @@ -1012,9 +1010,7 @@ public void setLayoutData (Object layoutData) { public void setLocation (int x, int y) { checkWidget(); - if (setBounds (topHandle (), x, y, 0, 0, true, false) != 0) { - sendEvent (SWT.Move); - } + setBounds (topHandle (), x, y, 0, 0, true, false, true); } public void setLocation (Point location) { @@ -1063,9 +1059,7 @@ boolean setRadioSelection (boolean value){ public void setSize (int width, int height) { checkWidget(); - if (setBounds (topHandle (), 0, 0, width, height, false, true) != 0) { - sendEvent (SWT.Resize); - } + setBounds (topHandle (), 0, 0, width, height, false, true, true); } public void setSize (Point size) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Scrollable.java index 67254e631b..c58fadacc1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Scrollable.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Scrollable.java @@ -148,12 +148,12 @@ void layoutControl () { int width = Math.max (0, rect.right - rect.left - vWidth - inset.left - inset.right); int height = Math.max (0, rect.bottom - rect.top - hHeight - inset.top - inset.bottom); if (isVisibleHBar) { - setBounds (horizontalBar.handle, inset.left, inset.top + height, width, hHeight, true, true); + setBounds (horizontalBar.handle, inset.left, inset.top + height, width, hHeight, true, true, false); } if (isVisibleVBar) { - setBounds (verticalBar.handle, inset.left + width, inset.top, vWidth, height, true, true); + setBounds (verticalBar.handle, inset.left + width, inset.top, vWidth, height, true, true, false); } - setBounds (handle, inset.left, inset.top, width, height, true, true); + setBounds (handle, inset.left, inset.top, width, height, true, true, false); } } @@ -174,9 +174,15 @@ void releaseWidget () { super.releaseWidget (); } -int setBounds (int control, int x, int y, int width, int height, boolean move, boolean resize) { - int result = super.setBounds(control, x, y, width, height, move, resize); - if (control == scrolledHandle) layoutControl (); +int setBounds (int control, int x, int y, int width, int height, boolean move, boolean resize, boolean events) { + int result = super.setBounds(control, x, y, width, height, move, resize, false); + if ((result & MOVED) != 0) { + if (events) sendEvent (SWT.Move); + } + if ((result & RESIZED) != 0) { + if (control == scrolledHandle) layoutControl (); + if (events) sendEvent (SWT.Resize); + } return result; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java index 7be4e2acec..6140ccacf2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java @@ -411,7 +411,7 @@ void layoutControl () { Rect rect = new Rect (); OS.GetWindowBounds (shellHandle, (short) OS.kWindowContentRgn, rect); int control = scrolledHandle != 0 ? scrolledHandle : handle; - setBounds (control, 0, 0, rect.right - rect.left, rect.bottom - rect.top, false, true); + setBounds (control, 0, 0, rect.right - rect.left, rect.bottom - rect.top, false, true, false); super.layoutControl (); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TabFolder.java index a33870598d..689cfa4e2b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TabFolder.java @@ -435,8 +435,8 @@ public void removeSelectionListener (SelectionListener listener) { eventTable.unhook (SWT.DefaultSelection,listener); } -int setBounds (int c, int x, int y, int width, int height, boolean move, boolean resize) { - int result = super.setBounds(c, x, y, width, height, move, resize); +int setBounds (int c, int x, int y, int width, int height, boolean move, boolean resize, boolean events) { + int result = super.setBounds(c, x, y, width, height, move, resize, events); if ((result & RESIZED) != 0) { int index = OS.GetControl32BitValue (handle) - 1; if (index != -1) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolBar.java index 013c050784..d31fa10c83 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolBar.java @@ -238,9 +238,9 @@ void releaseWidget () { super.releaseWidget (); } -int setBounds (int control, int x, int y, int width, int height, boolean move, boolean resize) { - int result = super.setBounds(control, x, y, width, height, move, resize); - if (resize && (result & RESIZED) != 0) { +int setBounds (int control, int x, int y, int width, int height, boolean move, boolean resize, boolean events) { + int result = super.setBounds (control, x, y, width, height, move, resize, events); + if ((result & RESIZED) != 0) { Rectangle rect = getClientArea (); relayout (rect.width, rect.height); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolItem.java index 15db86e366..a50f4d1722 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolItem.java @@ -372,7 +372,7 @@ void selectRadio () { void setBounds (int x, int y, int width, int height) { if (control != null) control.setBounds (x, y, width, height); - setBounds (handle, x, y, width, height, true, true); + setBounds (handle, x, y, width, height, true, true, false); if ((style & SWT.SEPARATOR) != 0) return; int space = 0; int inset = 3; @@ -399,22 +399,22 @@ void setBounds (int x, int y, int width, int height) { if ((parent.style & SWT.RIGHT) != 0) { int imageX = inset; int imageY = inset + (height - (inset * 2) - imageHeight) / 2; - setBounds (iconHandle, imageX, imageY, imageWidth, imageHeight, true, true); + setBounds (iconHandle, imageX, imageY, imageWidth, imageHeight, true, true, false); int labelX = imageX + imageWidth + space; int labelY = inset + (height - (inset * 2) - stringHeight) / 2; - setBounds (labelHandle, labelX, labelY, stringWidth, stringHeight, true, true); + setBounds (labelHandle, labelX, labelY, stringWidth, stringHeight, true, true, false); } else { int imageX = inset + (width - (inset * 2) - (arrowWidth + 3) - imageWidth) / 2; int imageY = inset; - setBounds (iconHandle, imageX, imageY, imageWidth, imageHeight, true, true); + setBounds (iconHandle, imageX, imageY, imageWidth, imageHeight, true, true, false); int labelX = inset + (width - (inset * 2) - (arrowWidth + 3) - stringWidth) / 2; int labelY = imageY + imageHeight + space; - setBounds (labelHandle, labelX, labelY, stringWidth, stringHeight, true, true); + setBounds (labelHandle, labelX, labelY, stringWidth, stringHeight, true, true, false); } if ((style & SWT.DROP_DOWN) != 0) { int arrowX = width - inset - arrowWidth; int arrowY = inset + (height - (inset * 2) - arrowHeight) / 2; - setBounds (arrowHandle, arrowX, arrowY, arrowWidth, arrowHeight, true, true); + setBounds (arrowHandle, arrowX, arrowY, arrowWidth, arrowHeight, true, true, false); } } @@ -502,7 +502,7 @@ void setSize (int width, int height, boolean layout) { Rect rect = new Rect(); OS.GetControlBounds (handle, rect); if ((rect.right - rect.left) != width || (rect.bottom - rect.top) != height) { - setBounds (handle, 0, 0, width, height, false, true); + setBounds (handle, 0, 0, width, height, false, true, false); if (layout) parent.relayout (); } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java index c67fbcaca4..dd4ac80733 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java @@ -717,7 +717,7 @@ void sendEvent (int eventType, Event event, boolean send) { } } -int setBounds (int control, int x, int y, int width, int height, boolean move, boolean resize) { +int setBounds (int control, int x, int y, int width, int height, boolean move, boolean resize, boolean events) { Rect inset = getInset (); Rect oldBounds = new Rect (); OS.GetControlBounds (control, oldBounds); @@ -763,8 +763,14 @@ int setBounds (int control, int x, int y, int width, int height, boolean move, b OS.SetControlBounds (control, newBounds); if (visible) OS.InvalWindowRect (window, newBounds); int result = 0; - if (!sameOrigin) result |= MOVED; - if (!sameExtent) result |= RESIZED; + if (move && !sameOrigin) { + if (events) sendEvent (SWT.Move); + result |= MOVED; + } + if (resize && !sameExtent) { + if (events) sendEvent (SWT.Move); + result |= RESIZED; + } return result; } |