diff options
author | Silenio Quarti <silenio> | 2009-10-20 18:24:26 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2009-10-20 18:24:26 +0000 |
commit | 63f803a737d416603789d25d5eba7834fce0e4c9 (patch) | |
tree | 11e8f83b9bbe9155b22756eb178ac70c2cdde90b /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java | |
parent | 3f16243f15249d0c5b9acd8d735db116a6188e83 (diff) | |
download | eclipse.platform.swt-63f803a737d416603789d25d5eba7834fce0e4c9.tar.gz eclipse.platform.swt-63f803a737d416603789d25d5eba7834fce0e4c9.tar.xz eclipse.platform.swt-63f803a737d416603789d25d5eba7834fce0e4c9.zip |
Bug 103863 - Support encapsulation in SWT layout mechanism
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java | 83 |
1 files changed, 51 insertions, 32 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java index 62cda3117c..23b10c1584 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java @@ -951,42 +951,61 @@ public void layout (boolean changed, boolean all) { public void layout (Control [] changed) { checkWidget (); if (changed == null) error (SWT.ERROR_INVALID_ARGUMENT); - for (int i=0; i<changed.length; i++) { - Control control = changed [i]; - if (control == null) error (SWT.ERROR_INVALID_ARGUMENT); - if (control.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); - boolean ancestor = false; - Composite composite = control.parent; - while (composite != null) { - ancestor = composite == this; - if (ancestor) break; - composite = composite.parent; + layout (changed, SWT.NONE); +} + +/*public*/ void layout (Control [] changed, int flags) { + checkWidget (); + if (changed != null) { + for (int i=0; i<changed.length; i++) { + Control control = changed [i]; + if (control == null) error (SWT.ERROR_INVALID_ARGUMENT); + if (control.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); + boolean ancestor = false; + Composite composite = control.parent; + while (composite != null) { + ancestor = composite == this; + if (ancestor) break; + composite = composite.parent; + } + if (!ancestor) error (SWT.ERROR_INVALID_PARENT); } - if (!ancestor) error (SWT.ERROR_INVALID_PARENT); - } - int updateCount = 0; - Composite [] update = new Composite [16]; - for (int i=0; i<changed.length; i++) { - Control child = changed [i]; - Composite composite = child.parent; - while (child != this) { - if (composite.layout != null) { - composite.state |= LAYOUT_NEEDED; - if (!composite.layout.flushCache (child)) { - composite.state |= LAYOUT_CHANGED; + int updateCount = 0; + Composite [] update = new Composite [16]; + for (int i=0; i<changed.length; i++) { + Control child = changed [i]; + Composite composite = child.parent; + while (child != this) { + if (composite.layout != null) { + composite.state |= LAYOUT_NEEDED; + if (!composite.layout.flushCache (child)) { + composite.state |= LAYOUT_CHANGED; + } } + if (updateCount == update.length) { + Composite [] newUpdate = new Composite [update.length + 16]; + System.arraycopy (update, 0, newUpdate, 0, update.length); + update = newUpdate; + } + child = update [updateCount++] = composite; + composite = child.parent; } - if (updateCount == update.length) { - Composite [] newUpdate = new Composite [update.length + 16]; - System.arraycopy (update, 0, newUpdate, 0, update.length); - update = newUpdate; - } - child = update [updateCount++] = composite; - composite = child.parent; } - } - for (int i=updateCount-1; i>=0; i--) { - update [i].updateLayout (false); + if ((flags & SWT.DEFER) != 0) { + setLayoutDeferred (true); + display.addLayoutDeferred (this); + } + for (int i=updateCount-1; i>=0; i--) { + update [i].updateLayout (false); + } + } else { + if (layout == null && (flags & SWT.ALL) == 0) return; + markLayout ((flags & SWT.CHANGED) != 0, (flags & SWT.ALL) != 0); + if ((flags & SWT.DEFER) != 0) { + setLayoutDeferred (true); + display.addLayoutDeferred (this); + } + updateLayout ((flags & SWT.ALL) != 0); } } |