summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2005-10-20 14:47:06 +0000
committerSilenio Quarti <silenio>2005-10-20 14:47:06 +0000
commita5a369c7bd82e9d09b8470c072222ae85e612988 (patch)
tree05063781c43a15a619333ac37657f1439c25f7da
parent4d9fbf05303a7824df9a584be26163b319e79621 (diff)
downloadeclipse.platform.swt-a5a369c7bd82e9d09b8470c072222ae85e612988.tar.gz
eclipse.platform.swt-a5a369c7bd82e9d09b8470c072222ae85e612988.tar.xz
eclipse.platform.swt-a5a369c7bd82e9d09b8470c072222ae85e612988.zip
51736 - Tree.setTopItem() fails (and wrong border value)
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/List.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java24
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllCarbonTests.java2
4 files changed, 14 insertions, 21 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 5be4f0b0a4..5815275f30 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
@@ -221,8 +221,6 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
int [] outMetric = new int [1];
OS.GetThemeMetric (OS.kThemeMetricFocusRectOutset, outMetric);
border += outMetric [0];
- OS.GetThemeMetric (OS.kThemeMetricEditTextFrameOutset, outMetric);
- border += outMetric [0];
}
Rect rect = new Rect ();
OS.GetDataBrowserScrollBarInset (handle, rect);
@@ -466,8 +464,6 @@ public Rectangle getClientArea () {
int [] outMetric = new int [1];
OS.GetThemeMetric (OS.kThemeMetricFocusRectOutset, outMetric);
border += outMetric [0];
- OS.GetThemeMetric (OS.kThemeMetricEditTextFrameOutset, outMetric);
- border += outMetric [0];
}
Rect rect = new Rect (), inset = new Rect ();
OS.GetControlBounds (handle, rect);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java
index d8fdadaa03..65dec9ba2a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java
@@ -424,8 +424,6 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
int [] outMetric = new int [1];
OS.GetThemeMetric (OS.kThemeMetricFocusRectOutset, outMetric);
border += outMetric [0];
- OS.GetThemeMetric (OS.kThemeMetricEditTextFrameOutset, outMetric);
- border += outMetric [0];
}
Rect rect = new Rect ();
OS.GetDataBrowserScrollBarInset (handle, rect);
@@ -1020,9 +1018,6 @@ public Rectangle getClientArea () {
int [] outMetric = new int [1];
OS.GetThemeMetric (OS.kThemeMetricFocusRectOutset, outMetric);
border += outMetric [0];
- OS.GetThemeMetric (OS.kThemeMetricEditTextFrameOutset, outMetric);
- border += outMetric [0];
- border = 3;
}
Rect rect = new Rect (), inset = new Rect ();
OS.GetControlBounds (handle, rect);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
index 24bc5f13f3..562531fffa 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java
@@ -271,8 +271,6 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
int [] outMetric = new int [1];
OS.GetThemeMetric (OS.kThemeMetricFocusRectOutset, outMetric);
border += outMetric [0];
- OS.GetThemeMetric (OS.kThemeMetricEditTextFrameOutset, outMetric);
- border += outMetric [0];
}
Rect rect = new Rect ();
OS.GetDataBrowserScrollBarInset (handle, rect);
@@ -827,8 +825,6 @@ public Rectangle getClientArea () {
int [] outMetric = new int [1];
OS.GetThemeMetric (OS.kThemeMetricFocusRectOutset, outMetric);
border += outMetric [0];
- OS.GetThemeMetric (OS.kThemeMetricEditTextFrameOutset, outMetric);
- border += outMetric [0];
}
Rect rect = new Rect (), inset = new Rect ();
OS.GetControlBounds (handle, rect);
@@ -2512,12 +2508,20 @@ public void setTopItem (TreeItem item) {
showItem (item, false);
int columnId = (columnCount == 0) ? column_id : columns [0].id;
OS.RevealDataBrowserItem (handle, item.id, columnId, (byte) OS.kDataBrowserRevealWithoutSelecting);
-// Rect rect = new Rect ();
-// OS.GetControlBounds (handle, rect);
-// int x = rect.left, y = rect.top;
-// if (OS.GetDataBrowserItemPartBounds (handle, item.id, column_id, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
-// OS.SetDataBrowserScrollPosition (handle, rect.top - y - 3, 0);
-// }
+ Rect rect = new Rect ();
+ if (OS.GetDataBrowserItemPartBounds (handle, item.id, column_id, OS.kDataBrowserPropertyEnclosingPart, rect) == OS.noErr) {
+ int border = 0;
+ byte [] hasBorder = new byte [1];
+ OS.GetControlData (handle, (short) OS.kControlEntireControl, OS.kControlDataBrowserIncludesFrameAndFocusTag, 1, hasBorder, null);
+ if (hasBorder [0] != 0) {
+ int [] outMetric = new int [1];
+ OS.GetThemeMetric (OS.kThemeMetricFocusRectOutset, outMetric);
+ border += outMetric [0];
+ }
+ int [] top = new int [1], left = new int [1];
+ OS.GetDataBrowserScrollPosition (handle, top, left);
+ OS.SetDataBrowserScrollPosition (handle, top [0] + rect.top - border, left [0]);
+ }
}
/**
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllCarbonTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllCarbonTests.java
index be72adc78d..53c30607a7 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllCarbonTests.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllCarbonTests.java
@@ -38,8 +38,6 @@ static String[] excludeTests = {
"test_setDoubleClickEnabledZ(org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Text)",
"test_setTabsI(org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Text)",
"test_setTopIndexI(org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Text)",
- "test_setSelection$Lorg_eclipse_swt_widgets_TreeItem(org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Tree)",
- "test_setTopItemLorg_eclipse_swt_widgets_TreeItem(org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Tree)",
"test_clearSelection(org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Combo)",
"test_copy(org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Combo)",
"test_cut(org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Combo)",