Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeronika Irvine2005-01-24 22:00:37 +0000
committerVeronika Irvine2005-01-24 22:00:37 +0000
commitee0cb80834cac32edcf0c85c329a5ea5bf7010af (patch)
tree462267cd6dca299bc27f508934945a58d60bb20c
parente75492e625dddbd6d127fd15b1010ffeec2f2902 (diff)
downloadeclipse.platform.swt-ee0cb80834cac32edcf0c85c329a5ea5bf7010af.tar.gz
eclipse.platform.swt-ee0cb80834cac32edcf0c85c329a5ea5bf7010af.tar.xz
eclipse.platform.swt-ee0cb80834cac32edcf0c85c329a5ea5bf7010af.zip
bug 49426 - add exclude to GridData and RowData
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridLayout.java44
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java18
-rwxr-xr-xbundles/org.eclipse.swt/buildnotes_swt.html5
5 files changed, 76 insertions, 19 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java
index b0aff6063f..02b8998750 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridData.java
@@ -209,6 +209,19 @@ public final class GridData {
public int minimumHeight = 0;
/**
+ * exclude is used to stop a widget from being managed by the
+ * layout. If this value is <code>true</code>, the widget size and
+ * position will not be managed by the layout. If this value is
+ * <code>false</code>, then the size and position of the widget will
+ * be modified by the layout.
+ *
+ * The default value is <code>false</code>.
+ *
+ * @since 3.1
+ */
+ public boolean exclude = false;
+
+ /**
* Value for horizontalAlignment or verticalAlignment.
* Position the control at the top or left of the cell.
* Not recommended. Use SWT.BEGINNING, SWT.TOP or SWT.LEFT instead.
@@ -519,6 +532,7 @@ public String toString () {
if (grabExcessVerticalSpace) string += "grabExcessVerticalSpace="+grabExcessVerticalSpace+" ";
if (heightHint != SWT.DEFAULT) string += "heightHint="+heightHint+" ";
if (minimumHeight != 0) string += "minimumHeight="+minimumHeight+" ";
+ if (exclude) string += "exclude="+exclude+" ";
string = string.trim();
string += "}";
return string;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridLayout.java
index 1c49fecd44..d30968bb54 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/GridLayout.java
@@ -187,9 +187,19 @@ protected void layout (Composite composite, boolean flushCache) {
}
Point layout (Composite composite, boolean move, int x, int y, int width, int height, boolean flushCache) {
- if (numColumns < 1) return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom);
+ if (numColumns < 1) {
+ return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom);
+ }
+ int count = 0;
Control [] children = composite.getChildren ();
for (int i=0; i<children.length; i++) {
+ Control control = children [i];
+ GridData data = (GridData) control.getLayoutData ();
+ if (data == null || !data.exclude) {
+ children [count++] = children [i];
+ }
+ }
+ for (int i=0; i<count; i++) {
Control child = children [i];
GridData data = (GridData) child.getLayoutData ();
if (data == null) child.setLayoutData (data = new GridData ());
@@ -217,7 +227,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
/* Build the grid */
int row = 0, column = 0, rowCount = 0, columnCount = numColumns;
Control [][] grid = new Control [4] [columnCount];
- for (int i=0; i<children.length; i++) {
+ for (int i=0; i<count; i++) {
Control child = children [i];
GridData data = (GridData) child.getLayoutData ();
int hSpan = Math.max (1, Math.min (data.horizontalSpan, columnCount));
@@ -357,9 +367,9 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
for (int i=0; i<columnCount; i++) {
totalWidth += widths [i];
}
- int count = expandCount;
- int delta = (availableWidth - totalWidth) / count;
- int remainder = (availableWidth - totalWidth) % count;
+ int c = expandCount;
+ int delta = (availableWidth - totalWidth) / c;
+ int remainder = (availableWidth - totalWidth) % c;
int last = -1;
while (totalWidth != availableWidth) {
for (int j=0; j<columnCount; j++) {
@@ -369,7 +379,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
} else {
widths [j] = minWidths [j];
expandColumn [j] = false;
- count--;
+ c--;
}
}
}
@@ -408,13 +418,13 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
}
}
}
- if (count == 0) break;
+ if (c == 0) break;
totalWidth = 0;
for (int i=0; i<columnCount; i++) {
totalWidth += widths [i];
}
- delta = (availableWidth - totalWidth) / count;
- remainder = (availableWidth - totalWidth) % count;
+ delta = (availableWidth - totalWidth) / c;
+ remainder = (availableWidth - totalWidth) % c;
last = -1;
}
}
@@ -450,7 +460,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
if (data.grabExcessVerticalSpace && data.minimumHeight > 0) {
data.cacheHeight = Math.max (data.cacheHeight, data.minimumHeight);
}
- if (flush == null) flush = new GridData [children.length];
+ if (flush == null) flush = new GridData [count];
flush [flushLength++] = data;
}
}
@@ -542,9 +552,9 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
for (int i=0; i<rowCount; i++) {
totalHeight += heights [i];
}
- int count = expandCount;
- int delta = (availableHeight - totalHeight) / count;
- int remainder = (availableHeight - totalHeight) % count;
+ int c = expandCount;
+ int delta = (availableHeight - totalHeight) / c;
+ int remainder = (availableHeight - totalHeight) % c;
int last = -1;
while (totalHeight != availableHeight) {
for (int i=0; i<rowCount; i++) {
@@ -554,7 +564,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
} else {
heights [i] = minHeights [i];
expandRow [i] = false;
- count--;
+ c--;
}
}
}
@@ -593,13 +603,13 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
}
}
}
- if (count == 0) break;
+ if (c == 0) break;
totalHeight = 0;
for (int i=0; i<rowCount; i++) {
totalHeight += heights [i];
}
- delta = (availableHeight - totalHeight) / count;
- remainder = (availableHeight - totalHeight) % count;
+ delta = (availableHeight - totalHeight) / c;
+ remainder = (availableHeight - totalHeight) % c;
last = -1;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java
index 7f44f65b11..de48bc1a1f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowData.java
@@ -52,6 +52,19 @@ public final class RowData {
*/
public int height = SWT.DEFAULT;
+ /**
+ * exclude is used to stop a widget from being managed by the
+ * layout. If this value is <code>true</code>, the widget size and
+ * position will not be managed by the layout. If this value is
+ * <code>false</code>, then the size and position of the widget will
+ * be modified by the layout.
+ *
+ * The default value is <code>false</code>.
+ *
+ * @since 3.1
+ */
+ public boolean exclude = false;
+
public RowData () {
}
@@ -75,6 +88,7 @@ public String toString () {
String string = getName ()+" {";
if (width != SWT.DEFAULT) string += "width="+width+" ";
if (height != SWT.DEFAULT) string += "height="+height+" ";
+ if (exclude) string += "exclude="+exclude+" ";
string = string.trim();
string += "}";
return string;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java
index 1d7d95a5a0..469410d1b3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/RowLayout.java
@@ -227,8 +227,15 @@ protected void layout (Composite composite, boolean flushCache) {
}
Point layoutHorizontal (Composite composite, boolean move, boolean wrap, int width, boolean flushCache) {
+ int count = 0;
Control [] children = composite.getChildren ();
- int count = children.length;
+ for (int i=0; i<children.length; i++) {
+ Control control = children [i];
+ RowData data = (RowData) control.getLayoutData ();
+ if (data == null || !data.exclude) {
+ children [count++] = children [i];
+ }
+ }
int childWidth = 0, childHeight = 0, maxHeight = 0;
if (!pack) {
for (int i=0; i<count; i++) {
@@ -324,8 +331,15 @@ Point layoutHorizontal (Composite composite, boolean move, boolean wrap, int wid
}
Point layoutVertical (Composite composite, boolean move, boolean wrap, int height, boolean flushCache) {
+ int count = 0;
Control [] children = composite.getChildren ();
- int count = children.length;
+ for (int i=0; i<children.length; i++) {
+ Control control = children [i];
+ RowData data = (RowData) control.getLayoutData ();
+ if (data == null || !data.exclude) {
+ children [count++] = children [i];
+ }
+ }
int childWidth = 0, childHeight = 0, maxWidth = 0;
if (!pack) {
for (int i=0; i<count; i++) {
diff --git a/bundles/org.eclipse.swt/buildnotes_swt.html b/bundles/org.eclipse.swt/buildnotes_swt.html
index 7fef52929a..29efd2d8cd 100755
--- a/bundles/org.eclipse.swt/buildnotes_swt.html
+++ b/bundles/org.eclipse.swt/buildnotes_swt.html
@@ -13,6 +13,11 @@ Eclipse Platform Build Notes<br>
SWT</h1>
<h2> SWT Build 3.1 019c - Tuesday January 18th, 2005 </h2>
+<h3><a NAME="New APIs"></a>New APIs</h3>
+<blockquote>
+RowData.exclude and GridData.exclude have been added to allow applications to
+selectively exclude widgets from a Layout operation.
+</blockquote>
<h3><a NAME="Problem reports fixed"></a>Problem reports fixed</h3>
<blockquote>
<br>22646: Cheese appears in table when using mouse wheel

Back to the top