summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2003-02-28 23:42:23 +0000
committerSilenio Quarti <silenio>2003-02-28 23:42:23 +0000
commit84255bf5f83ec4c813df37e8e145b1c015d891af (patch)
tree89ea71c505c23caf4623c060635021df8c4cef12
parente58d7637fbb8fed2fe8bc6ad0932fc1e80976625 (diff)
downloadeclipse.platform.swt-84255bf5f83ec4c813df37e8e145b1c015d891af.tar.gz
eclipse.platform.swt-84255bf5f83ec4c813df37e8e145b1c015d891af.tar.xz
eclipse.platform.swt-84255bf5f83ec4c813df37e8e145b1c015d891af.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/List.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon2/org/eclipse/swt/widgets/Table.java18
2 files changed, 34 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/List.java
index e2656ed34b..0550d49bbf 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/List.java
@@ -617,6 +617,22 @@ public void selectAll () {
ignoreSelect = false;
}
+int setBounds (int control, int x, int y, int width, int height, boolean move, boolean resize, boolean events) {
+ /*
+ * Ensure that the top item is visible when the tree is resized
+ * from a zero size to a size that can show the selection.
+ */
+ //TODO - optimize
+ int index = -1;
+ if (resize && control == handle) {
+ Rectangle rect = getClientArea ();
+ if (rect.height < getItemHeight ()) index = getTopIndex ();
+ }
+ int result = super.setBounds (control, x, y, width, height, move, resize, events);
+ if (index != -1) showIndex (index);
+ return result;
+}
+
public void setItem (int index, String string) {
checkWidget();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
@@ -714,7 +730,7 @@ void showIndex (int index) {
OS.GetControlBounds (handle, rect);
OS.GetDataBrowserScrollBarInset (handle, inset);
OS.SetDataBrowserTableViewNamedColumnWidth (handle, COLUMN_ID, (short)(rect.right - rect.left - inset.left - inset.right));
- OS.RevealDataBrowserItem (handle, index + 1, COLUMN_ID, (byte) OS.kDataBrowserRevealWithoutSelecting);
+ OS.RevealDataBrowserItem (handle, index + 1, COLUMN_ID, (byte) (OS.kDataBrowserRevealWithoutSelecting | OS.kDataBrowserRevealAndCenterInView));
OS.SetDataBrowserTableViewNamedColumnWidth (handle, COLUMN_ID, (short)width [0]);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon2/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon2/org/eclipse/swt/widgets/Table.java
index 951b44f8ec..547ac8acbd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon2/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon2/org/eclipse/swt/widgets/Table.java
@@ -908,6 +908,22 @@ public void selectAll () {
ignoreSelect = false;
}
+int setBounds (int control, int x, int y, int width, int height, boolean move, boolean resize, boolean events) {
+ /*
+ * Ensure that the top item is visible when the tree is resized
+ * from a zero size to a size that can show the selection.
+ */
+ //TODO - optimize
+ int index = -1;
+ if (resize && control == handle) {
+ Rectangle rect = getClientArea ();
+ if (rect.height < getItemHeight ()) index = getTopIndex ();
+ }
+ int result = super.setBounds (control, x, y, width, height, move, resize, events);
+ if (index != -1) showIndex (index);
+ return result;
+}
+
public void setHeaderVisible (boolean show) {
checkWidget ();
int height = show ? headerHeight : 0;
@@ -996,7 +1012,7 @@ void showIndex (int index) {
OS.GetControlBounds (handle, rect);
OS.GetDataBrowserScrollBarInset (handle, inset);
OS.SetDataBrowserTableViewNamedColumnWidth (handle, id, (short)(rect.right - rect.left - inset.left - inset.right));
- OS.RevealDataBrowserItem (handle, index + 1, COLUMN_ID, (byte) OS.kDataBrowserRevealWithoutSelecting);
+ OS.RevealDataBrowserItem (handle, index + 1, COLUMN_ID, (byte) (OS.kDataBrowserRevealWithoutSelecting | OS.kDataBrowserRevealAndCenterInView));
OS.SetDataBrowserTableViewNamedColumnWidth (handle, id, (short)width [0]);
}
}