summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Barnes <krbarnes>2007-08-22 18:44:17 +0000
committerKevin Barnes <krbarnes>2007-08-22 18:44:17 +0000
commitc49ba6cb6492cb93eb51d880dd4bc2efa218d7e5 (patch)
tree24a7d34f7f833f349ec10fbd83efa0964fe9d58c
parent73afbc11d644f3a6a19b56b1895d8f85e15587c1 (diff)
downloadeclipse.platform.swt-c49ba6cb6492cb93eb51d880dd4bc2efa218d7e5.tar.gz
eclipse.platform.swt-c49ba6cb6492cb93eb51d880dd4bc2efa218d7e5.tar.xz
eclipse.platform.swt-c49ba6cb6492cb93eb51d880dd4bc2efa218d7e5.zip
200694 - TableItem.getBounds() wrong
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.wpf.OS.properties7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_custom.cpp34
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.cpp9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.h5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/OS.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Table.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TableColumn.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TableItem.java49
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Tree.java68
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TreeItem.java47
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Widget.java4
11 files changed, 136 insertions, 125 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.wpf.OS.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.wpf.OS.properties
index 7c79514cf7..0232e5f642 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.wpf.OS.properties
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.wpf.OS.properties
@@ -2347,9 +2347,9 @@ OS_SWTCanvas_1Visual__II=flags=no_gen setter
OS_SWTCanvas_1Visual__II_0=cast=SWTCanvas^,flags=gcobject
OS_SWTCanvas_1Visual__II_1=cast=DrawingVisual^,flags=gcobject
-OS_SWTStackPanel_JNIRefProperty=flags=no_gen
+OS_SWTDockPanel_JNIRefProperty=flags=no_gen
-OS_SWTStackPanel_typeid=accessor=SWTStackPanel::typeid,flags=no_gen gcobject const
+OS_SWTDockPanel_typeid=flags=no_gen
OS_SWTTextRunProperties_ForegroundBrush=flags=no_gen setter
OS_SWTTextRunProperties_ForegroundBrush_0=cast=SWTTextRunProperties^,flags=gcobject
@@ -3967,9 +3967,6 @@ OS_gcnew_SWTSafeHandle=flags=no_gen gcnew
OS_gcnew_SWTSafeHandle_0=cast=IntPtr
OS_gcnew_SWTSafeHandle_1=
-OS_gcnew_SWTStackPanel=flags=no_gen
-OS_gcnew_SWTStackPanel_0=
-
OS_gcnew_SWTTextEmbeddedObject=flags=no_gen gcnew
OS_gcnew_SWTTextEmbeddedObject_0=cast=TextRunProperties^,flags=gcobject
OS_gcnew_SWTTextEmbeddedObject_1=
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_custom.cpp b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_custom.cpp
index d74775a4b2..42fc8ecdf7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_custom.cpp
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_custom.cpp
@@ -184,9 +184,9 @@ public:
/* Table and Tree Classes */
/* */
-public ref class SWTStackPanel : StackPanel {
+public ref class SWTDockPanel : DockPanel {
public:
- static DependencyProperty^ JNIRefProperty = DependencyProperty::Register("JNIRef", Int32::typeid, SWTStackPanel::typeid);
+ static DependencyProperty^ JNIRefProperty = DependencyProperty::Register("JNIRef", Int32::typeid, SWTDockPanel::typeid);
private:
jmethodID OnRenderMID;
JniRefCookie^ cookie;
@@ -206,7 +206,7 @@ private:
}
if (env != NULL) {
if (cookie == nullptr) {
- cookie = gcnew JniRefCookie(env, (jint)(Int32)GetValue(SWTStackPanel::JNIRefProperty));
+ cookie = gcnew JniRefCookie(env, (jint)(Int32)GetValue(SWTDockPanel::JNIRefProperty));
}
jobject object = cookie->object;
if (object == NULL) {
@@ -229,7 +229,7 @@ private:
}
protected:
virtual void OnRender(DrawingContext^ drawingContext) override {
- this->StackPanel::OnRender(drawingContext);
+ this->DockPanel::OnRender(drawingContext);
callin(OnRenderMID, drawingContext);
}
};
@@ -316,7 +316,7 @@ protected:
}
width = Math::Max (0.0, width);
Point^ loc = gcnew Point (x, 0);
- Size^ size = gcnew Size (width, child->DesiredSize.Height);
+ Size^ size = gcnew Size (width, arrangeSize.Height);
Rect^ rect = gcnew Rect (*loc, *size);
child->Arrange (*rect);
availableWidth -= width;
@@ -1039,28 +1039,28 @@ JNIEXPORT jint JNICALL OS_NATIVE(gcnew_1SWTCanvas)
}
#endif
-#ifndef NO_SWTStackPanel_1JNIRefProperty
-extern "C" JNIEXPORT jint JNICALL OS_NATIVE(SWTStackPanel_1JNIRefProperty)(JNIEnv *env, jclass that);
-JNIEXPORT jint JNICALL OS_NATIVE(SWTStackPanel_1JNIRefProperty)
+#ifndef NO_SWTDockPanel_1JNIRefProperty
+extern "C" JNIEXPORT jint JNICALL OS_NATIVE(SWTDockPanel_1JNIRefProperty)(JNIEnv *env, jclass that);
+JNIEXPORT jint JNICALL OS_NATIVE(SWTDockPanel_1JNIRefProperty)
(JNIEnv *env, jclass that)
{
jint rc = 0;
- OS_NATIVE_ENTER(env, that, SWTStackPanel_1JNIRefProperty_FUNC);
- rc = (jint)TO_HANDLE(SWTStackPanel::JNIRefProperty);
- OS_NATIVE_EXIT(env, that, SWTStackPanel_1JNIRefProperty_FUNC);
+ OS_NATIVE_ENTER(env, that, SWTDockPanel_1JNIRefProperty_FUNC);
+ rc = (jint)TO_HANDLE(SWTDockPanel::JNIRefProperty);
+ OS_NATIVE_EXIT(env, that, SWTDockPanel_1JNIRefProperty_FUNC);
return rc;
}
#endif
-#ifndef NO_SWTStackPanel_1typeid
-extern "C" JNIEXPORT jint JNICALL OS_NATIVE(SWTStackPanel_1typeid)(JNIEnv *env, jclass that);
-JNIEXPORT jint JNICALL OS_NATIVE(SWTStackPanel_1typeid)
+#ifndef NO_SWTDockPanel_1typeid
+extern "C" JNIEXPORT jint JNICALL OS_NATIVE(SWTDockPanel_1typeid)(JNIEnv *env, jclass that);
+JNIEXPORT jint JNICALL OS_NATIVE(SWTDockPanel_1typeid)
(JNIEnv *env, jclass that)
{
jint rc = 0;
- OS_NATIVE_ENTER(env, that, SWTStackPanel_1typeid_FUNC);
- rc = (jint)TO_HANDLE(SWTStackPanel::typeid);
- OS_NATIVE_EXIT(env, that, SWTStackPanel_1typeid_FUNC);
+ OS_NATIVE_ENTER(env, that, SWTDockPanel_1typeid_FUNC);
+ rc = (jint)TO_HANDLE(SWTDockPanel::typeid);
+ OS_NATIVE_EXIT(env, that, SWTDockPanel_1typeid_FUNC);
return rc;
}
#endif
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.cpp b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.cpp
index e55ad1b950..139e69ead0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.cpp
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.cpp
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 1274;
-int OS_nativeFunctionCallCount[1274];
+int OS_nativeFunctionCount = 1273;
+int OS_nativeFunctionCallCount[1273];
char * OS_nativeFunctionNames[] = {
"AccessText_1AccessKey",
"AccessText_1Text",
@@ -722,8 +722,8 @@ char * OS_nativeFunctionNames[] = {
"Run_1Text",
"SWTCanvas_1Visual__I",
"SWTCanvas_1Visual__II",
- "SWTStackPanel_1JNIRefProperty",
- "SWTStackPanel_1typeid",
+ "SWTDockPanel_1JNIRefProperty",
+ "SWTDockPanel_1typeid",
"SWTTextRunProperties_1ForegroundBrush",
"ScrollBar_1Orientation__I",
"ScrollBar_1Orientation__II",
@@ -1223,7 +1223,6 @@ char * OS_nativeFunctionNames[] = {
"gcnew_1Run",
"gcnew_1SWTCanvas",
"gcnew_1SWTSafeHandle",
- "gcnew_1SWTStackPanel",
"gcnew_1SWTTextEmbeddedObject",
"gcnew_1SWTTextParagraphProperties",
"gcnew_1SWTTextRunProperties",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.h
index 8db422671c..299befff18 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/library/os_stats.h
@@ -730,8 +730,8 @@ typedef enum {
Run_1Text_FUNC,
SWTCanvas_1Visual__I_FUNC,
SWTCanvas_1Visual__II_FUNC,
- SWTStackPanel_1JNIRefProperty_FUNC,
- SWTStackPanel_1typeid_FUNC,
+ SWTDockPanel_1JNIRefProperty_FUNC,
+ SWTDockPanel_1typeid_FUNC,
SWTTextRunProperties_1ForegroundBrush_FUNC,
ScrollBar_1Orientation__I_FUNC,
ScrollBar_1Orientation__II_FUNC,
@@ -1231,7 +1231,6 @@ typedef enum {
gcnew_1Run_FUNC,
gcnew_1SWTCanvas_FUNC,
gcnew_1SWTSafeHandle_FUNC,
- gcnew_1SWTStackPanel_FUNC,
gcnew_1SWTTextEmbeddedObject_FUNC,
gcnew_1SWTTextParagraphProperties_FUNC,
gcnew_1SWTTextRunProperties_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/OS.java
index be0580ea79..63e6508dbd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/wpf/org/eclipse/swt/internal/wpf/OS.java
@@ -1150,8 +1150,8 @@ public static final native int String_Length(int sender);
public static final native int Style_Setters(int sender);
public static final native int SWTCanvas_Visual(int sender);
public static final native void SWTCanvas_Visual(int sender, int visual);
-public static final native int SWTStackPanel_JNIRefProperty();
-public static final native int SWTStackPanel_typeid();
+public static final native int SWTDockPanel_JNIRefProperty();
+public static final native int SWTDockPanel_typeid();
public static final native void SWTTextRunProperties_ForegroundBrush(int sender, int brush);
public static final native int SystemColors_ControlBrush();
public static final native int SystemColors_ControlColor();
@@ -1605,7 +1605,7 @@ public static final native int gcnew_String(char[] value, int startIndex, int le
public static final native int gcnew_Style();
public static final native int gcnew_SWTCanvas(int jniRef);
public static final native int gcnew_SWTSafeHandle(int handle, boolean isIcon);
-public static final native int gcnew_SWTStackPanel(int jniRef);
+//public static final native int gcnew_SWTDockPanel(int jniRef);
public static final native int gcnew_SWTTextSource(int jniRef);
public static final native int gcnew_SWTTextEmbeddedObject(int properties, int lenght, double width, double height, double baseline);
public static final native int gcnew_SWTTextRunProperties(int typeface, double size, double hittingSize, int textDecorations, int foregroundBrush, int backgroundBrush, int baselineAlignment, int culture);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Table.java
index db34030935..27410fa2d5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Table.java
@@ -68,8 +68,8 @@ public class Table extends Composite {
static final String CHECKBOX_PART_NAME = "SWT_PART_CHECKBOX";
static final String IMAGE_PART_NAME = "SWT_PART_IMAGE";
static final String TEXT_PART_NAME = "SWT_PART_TEXT";
- static final String DOCKPANEL_PART_NAME = "SWT_PART_DOCKPANEL";
- static final String RENDER_PANEL_NAME = "SWTStackPanel";
+ static final String CONTENTPANEL_PART_NAME = "SWT_PART_CONTENTPANEL";
+ static final String RENDER_PANEL_NAME = "SWT_PART_RENDERPANEL";
/**
* Constructs a new instance of this class given its parent
@@ -361,22 +361,25 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
int createCellTemplate (int index) {
int template = OS.gcnew_DataTemplate ();
- int swtStackPanelType = OS.SWTStackPanel_typeid ();
- int swtstackPanelName = createDotNetString(RENDER_PANEL_NAME, false);
- int onRenderNode = OS.gcnew_FrameworkElementFactory (swtStackPanelType, swtstackPanelName);
- OS.GCHandle_Free(swtstackPanelName);
- OS.GCHandle_Free (swtStackPanelType);
- int jniRefProperty = OS.SWTStackPanel_JNIRefProperty ();
+ int renderPanelType = OS.SWTDockPanel_typeid ();
+ int renderPanelName = createDotNetString(RENDER_PANEL_NAME, false);
+ int onRenderNode = OS.gcnew_FrameworkElementFactory (renderPanelType, renderPanelName);
+ OS.GCHandle_Free(renderPanelName);
+ OS.GCHandle_Free (renderPanelType);
+ int jniRefProperty = OS.SWTDockPanel_JNIRefProperty ();
OS.FrameworkElementFactory_SetValueInt (onRenderNode, jniRefProperty, jniRef);
OS.GCHandle_Free (jniRefProperty);
- int dockPanelName = createDotNetString (DOCKPANEL_PART_NAME, false);
- int dockPanelType = OS.DockPanel_typeid ();
- int cellContentNode = OS.gcnew_FrameworkElementFactory (dockPanelType, dockPanelName);
- OS.GCHandle_Free (dockPanelType);
- OS.GCHandle_Free (dockPanelName);
+ int contentPanelName = createDotNetString (CONTENTPANEL_PART_NAME, false);
+ int contentPanelType = OS.StackPanel_typeid ();
+ int cellContentNode = OS.gcnew_FrameworkElementFactory (contentPanelType, contentPanelName);
+ OS.GCHandle_Free (contentPanelType);
+ OS.GCHandle_Free (contentPanelName);
int clipProperty = OS.UIElement_ClipToBoundsProperty ();
OS.FrameworkElementFactory_SetValue (cellContentNode, clipProperty, true);
OS.GCHandle_Free (clipProperty);
+ int orientationProperty = OS.StackPanel_OrientationProperty ();
+ OS.FrameworkElementFactory_SetValueOrientation (cellContentNode, orientationProperty, OS.Orientation_Horizontal);
+ OS.GCHandle_Free (orientationProperty);
if (index == 0 && (style & SWT.CHECK) != 0) {
int checkBoxType = OS.CheckBox_typeid ();
int checkBoxName = createDotNetString (CHECKBOX_PART_NAME, false);
@@ -463,7 +466,7 @@ void createHandle () {
int createHeaderTemplate (int columnJniRef) {
int template = OS.gcnew_DataTemplate ();
int stackPanelType = OS.StackPanel_typeid ();
- int stackPanelName = createDotNetString (DOCKPANEL_PART_NAME, false);
+ int stackPanelName = createDotNetString (CONTENTPANEL_PART_NAME, false);
int stackPanelNode = OS.gcnew_FrameworkElementFactory (stackPanelType, stackPanelName);
int textType = OS.TextBlock_typeid ();
int textName = createDotNetString(TEXT_PART_NAME, false);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TableColumn.java
index b6bf06177b..6346f0cfb7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TableColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TableColumn.java
@@ -565,6 +565,7 @@ public void setToolTipText (String string) {
public void setWidth (int width) {
checkWidget ();
if (width < 0) return;
+ updateLayout (parent.handle);
OS.GridViewColumn_Width (handle, width);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TableItem.java
index 7fba16e1fd..ff49b62c33 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TableItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TableItem.java
@@ -216,8 +216,8 @@ void createHandle () {
}
OS.Control_HorizontalContentAlignment (handle, OS.HorizontalAlignment_Stretch);
OS.Control_VerticalContentAlignment (handle, OS.VerticalAlignment_Stretch);
-
}
+
void clear () {
strings = null;
images = null;
@@ -335,18 +335,7 @@ public Color getBackground (int index) {
*/
public Rectangle getBounds () {
checkWidget();
- if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED);
- int parentHandle = parent.topHandle ();
- int point = OS.gcnew_Point (0, 0);
- if (point == 0) error (SWT.ERROR_NO_HANDLES);
- int location = OS.UIElement_TranslatePoint (handle, point, parentHandle);
- int x = (int) OS.Point_X (location);
- int y = (int) OS.Point_Y (location);
- OS.GCHandle_Free (point);
- OS.GCHandle_Free (location);
- int width = (int) OS.FrameworkElement_ActualWidth (handle);
- int height = (int) OS.FrameworkElement_ActualHeight (handle);
- return new Rectangle (x, y, width, height);
+ return getTextBounds (0);
}
/**
@@ -622,19 +611,29 @@ public Rectangle getTextBounds (int index) {
checkWidget ();
if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED);
if (index != 0 && !(0 <= index && index < parent.columnCount)) return new Rectangle (0, 0, 0, 0);
- int parentHandle = parent.topHandle ();
- int part = findPart (index, Table.TEXT_PART_NAME);
+ int parentHandle = parent.topHandle ();
int point = OS.gcnew_Point (0, 0);
if (point == 0) error (SWT.ERROR_NO_HANDLES);
- int location = OS.UIElement_TranslatePoint (part, point, parentHandle);
- int x = (int) OS.Point_X (location);
- int y = (int) OS.Point_Y (location);
+ int textBlock = findPart (index, Table.TEXT_PART_NAME);
+ int renderPanel = findPart (index, Table.RENDER_PANEL_NAME);
+ Rectangle result = new Rectangle (0, 0, 0, 0);
+ if (textBlock != 0 && renderPanel != 0) {
+ int location = OS.UIElement_TranslatePoint (textBlock, point, parentHandle);
+ int x = (int) OS.Point_X (location);
+ int y = (int) OS.Point_Y (location);
+ OS.GCHandle_Free (location);
+ double textWidth = OS.FrameworkElement_ActualWidth (textBlock);
+ int panelLocation = OS.UIElement_TranslatePoint (textBlock, point, renderPanel);
+ double visibleWidth = Math.max (0, OS.FrameworkElement_ActualWidth (renderPanel) - OS.Point_X (panelLocation));
+ OS.GCHandle_Free (panelLocation);
+ int width = (int) Math.min (textWidth, visibleWidth);
+ int height = (int) OS.FrameworkElement_ActualHeight (textBlock);
+ result = new Rectangle (x, y, width, height);
+ }
OS.GCHandle_Free (point);
- OS.GCHandle_Free (location);
- int width = (int) OS.FrameworkElement_ActualWidth (part);
- int height = (int) OS.FrameworkElement_ActualHeight (part);
- OS.GCHandle_Free (part);
- return new Rectangle (x, y, width, height);
+ if (textBlock != 0) OS.GCHandle_Free (textBlock);
+ if (renderPanel != 0) OS.GCHandle_Free (renderPanel);
+ return result;
}
public String getText () {
@@ -1072,7 +1071,7 @@ public void setText (String string) {
}
void updateBackground (int index) {
- int panel = findPart (index, Table.DOCKPANEL_PART_NAME);
+ int panel = findPart (index, Table.CONTENTPANEL_PART_NAME);
if (panel != 0) {
if (cellBackground != null && cellBackground [index] != null) {
int brush = OS.gcnew_SolidColorBrush (cellBackground [index].handle);
@@ -1178,9 +1177,7 @@ void updateText (int index) {
if (textBlock != 0) {
if (strings != null && strings [index] != null) {
int strPtr = createDotNetString (strings [index], false);
- int text = OS.TextBlock_Text (textBlock);
OS.TextBlock_Text (textBlock, strPtr);
- OS.GCHandle_Free (text);
OS.GCHandle_Free (strPtr);
} else {
int property = OS.TextBlock_TextProperty ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Tree.java
index c0b339cad8..0e5870994d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Tree.java
@@ -75,12 +75,12 @@ public class Tree extends Composite {
boolean ignoreSelection, shiftDown, ctrlDown;
static final String HEADER_PART_NAME = "SWT_PART_HEADER";
+ static final String SCROLLVIEWER_PART_NAME = "SWT_PART_SCROLLVIEWER";
static final String CHECKBOX_PART_NAME = "SWT_PART_CHECKBOX";
static final String IMAGE_PART_NAME = "SWT_PART_IMAGE";
static final String TEXT_PART_NAME = "SWT_PART_TEXT";
- static final String SCROLLVIEWER_PART_NAME = "SWT_PART_SCROLLVIEWER";
- static final String STACKPANEL_PART_NAME = "SWT_PART_STACKPANEL";
- static final String RENDER_PANEL_NAME = "SWTStackPanel";
+ static final String CONTENTPANEL_PART_NAME = "SWT_PART_CONTENTPANEL";
+ static final String RENDER_PANEL_NAME = "SWT_PART_RENDERPANEL";
static String scrollViewerStyle = "<Style TargetType=\"ScrollViewer\" " +
"xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" " +
@@ -349,57 +349,73 @@ void clearAll (TreeItem parentItem, boolean all) {
int createCellTemplate (int index) {
int template = OS.gcnew_DataTemplate ();
- int swtStackPanelType = OS.SWTStackPanel_typeid ();
- int swtstackPanelName = createDotNetString(RENDER_PANEL_NAME, false);
- int onRenderNode = OS.gcnew_FrameworkElementFactory (swtStackPanelType, swtstackPanelName);
- OS.GCHandle_Free (swtStackPanelType);
- OS.GCHandle_Free(swtstackPanelName);
- int jniRefProperty = OS.SWTStackPanel_JNIRefProperty ();
+ int renderPanelType = OS.SWTDockPanel_typeid ();
+ int renderPanelName = createDotNetString(RENDER_PANEL_NAME, false);
+ int onRenderNode = OS.gcnew_FrameworkElementFactory (renderPanelType, renderPanelName);
+ OS.GCHandle_Free(renderPanelName);
+ OS.GCHandle_Free (renderPanelType);
+ int jniRefProperty = OS.SWTDockPanel_JNIRefProperty ();
OS.FrameworkElementFactory_SetValueInt (onRenderNode, jniRefProperty, jniRef);
OS.GCHandle_Free (jniRefProperty);
- int stackPanelName = createDotNetString (STACKPANEL_PART_NAME, false);
- int dockPanelType = OS.DockPanel_typeid ();
- int cellContentNode = OS.gcnew_FrameworkElementFactory (dockPanelType, stackPanelName);
- OS.GCHandle_Free (dockPanelType);
- OS.GCHandle_Free (stackPanelName);
+ int contentPanelName = createDotNetString (CONTENTPANEL_PART_NAME, false);
+ int contentPanelType = OS.StackPanel_typeid ();
+ int cellContentNode = OS.gcnew_FrameworkElementFactory (contentPanelType, contentPanelName);
+ OS.GCHandle_Free (contentPanelType);
+ OS.GCHandle_Free (contentPanelName);
int clipProperty = OS.UIElement_ClipToBoundsProperty ();
OS.FrameworkElementFactory_SetValue (cellContentNode, clipProperty, true);
OS.GCHandle_Free (clipProperty);
+ int orientationProperty = OS.StackPanel_OrientationProperty ();
+ OS.FrameworkElementFactory_SetValueOrientation (cellContentNode, orientationProperty, OS.Orientation_Horizontal);
+ OS.GCHandle_Free (orientationProperty);
+
+
+// int vert = OS.FrameworkElement_VerticalAlignmentProperty();
+// OS.FrameworkElementFactory_SetValueVerticalAlignment(onRenderNode, vert, OS.VerticalAlignment_Stretch);
+// OS.GCHandle_Free (vert);
+//
+// int dp = OS.Panel_BackgroundProperty();
+// int red = OS.Brushes_Red();
+// int navy = OS.Brushes_Navy();
+// OS.FrameworkElementFactory_SetValue(cellContentNode, dp, red);
+// OS.FrameworkElementFactory_SetValue(onRenderNode, dp, navy);
+// OS.GCHandle_Free (dp);
+// OS.GCHandle_Free (red);
+// OS.GCHandle_Free (navy);
+
+
if (index == 0 && (style & SWT.CHECK) != 0) {
int checkBoxType = OS.CheckBox_typeid ();
int checkBoxName = createDotNetString (CHECKBOX_PART_NAME, false);
int checkBoxNode = OS.gcnew_FrameworkElementFactory (checkBoxType, checkBoxName);
- OS.GCHandle_Free (checkBoxType);
int verticalAlignmentProperty = OS.FrameworkElement_VerticalAlignmentProperty ();
OS.FrameworkElementFactory_SetValueVerticalAlignment (checkBoxNode, verticalAlignmentProperty, OS.VerticalAlignment_Center);
- OS.GCHandle_Free (verticalAlignmentProperty);
int marginProperty = OS.FrameworkElement_MarginProperty ();
int thickness = OS.gcnew_Thickness (0,0,4,0);
OS.FrameworkElementFactory_SetValue (checkBoxNode, marginProperty, thickness);
- OS.GCHandle_Free (marginProperty);
- OS.GCHandle_Free (thickness);
- int threeStateProperty = OS.ToggleButton_IsThreeStateProperty ();
- OS.FrameworkElementFactory_SetValue (checkBoxNode, threeStateProperty, true);
- OS.GCHandle_Free (threeStateProperty);
OS.FrameworkElementFactory_AppendChild (cellContentNode, checkBoxNode);
- int fooProperty = OS.FrameworkElement_NameProperty();
- OS.FrameworkElementFactory_SetValue (checkBoxNode, fooProperty, checkBoxName);
+ OS.GCHandle_Free (thickness);
+ OS.GCHandle_Free (marginProperty);
+ OS.GCHandle_Free (verticalAlignmentProperty);
OS.GCHandle_Free (checkBoxName);
- OS.GCHandle_Free (fooProperty);
OS.GCHandle_Free (checkBoxNode);
+ OS.GCHandle_Free (checkBoxType);
}
int textType = OS.TextBlock_typeid ();
int textName = createDotNetString (TEXT_PART_NAME, false);
int textNode = OS.gcnew_FrameworkElementFactory (textType, textName);
OS.GCHandle_Free (textName);
OS.GCHandle_Free (textType);
+ int verticalAlignmentProperty = OS.FrameworkElement_VerticalAlignmentProperty ();
+ OS.FrameworkElementFactory_SetValueVerticalAlignment (textNode, verticalAlignmentProperty, OS.VerticalAlignment_Center);
+ OS.GCHandle_Free (verticalAlignmentProperty);
int imageType = OS.Image_typeid ();
int imageName = createDotNetString (IMAGE_PART_NAME, false);
int imageNode = OS.gcnew_FrameworkElementFactory (imageType, imageName);
OS.GCHandle_Free (imageName);
OS.GCHandle_Free (imageType);
- int thickness = OS.gcnew_Thickness (0, 0, 4, 0);
int marginProperty = OS.FrameworkElement_MarginProperty ();
+ int thickness = OS.gcnew_Thickness (0,0,4,0);
OS.FrameworkElementFactory_SetValue (imageNode, marginProperty, thickness);
OS.GCHandle_Free (marginProperty);
OS.GCHandle_Free (thickness);
@@ -482,7 +498,7 @@ void createHandle () {
int createHeaderTemplate (int columnJniRef) {
int template = OS.gcnew_DataTemplate ();
int stackPanelType = OS.StackPanel_typeid ();
- int stackPanelName = createDotNetString (STACKPANEL_PART_NAME, false);
+ int stackPanelName = createDotNetString (CONTENTPANEL_PART_NAME, false);
int stackPanelNode = OS.gcnew_FrameworkElementFactory (stackPanelType, stackPanelName);
OS.GCHandle_Free (stackPanelName);
OS.GCHandle_Free (stackPanelType);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TreeItem.java
index 0ca15568f6..989f947885 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/TreeItem.java
@@ -580,18 +580,7 @@ public Color getBackground (int index) {
*/
public Rectangle getBounds () {
checkWidget ();
- if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED);
- //BUG?
- if (!OS.UIElement_IsVisible(handle)) return new Rectangle (0, 0, 0, 0);
- int point = OS.gcnew_Point (0, 0);
- int location = OS.UIElement_TranslatePoint (handle, point, parent.handle);
- int x = (int) OS.Point_X (location);
- int y = (int) OS.Point_Y (location);
- OS.GCHandle_Free (point);
- OS.GCHandle_Free (location);
- int width = (int) OS.FrameworkElement_ActualWidth (handle);
- int height = (int) OS.FrameworkElement_ActualHeight (handle);
- return new Rectangle (x, y, width, height);
+ return getTextBounds (0);
}
/**
@@ -615,7 +604,7 @@ public Rectangle getBounds (int index) {
if (!OS.UIElement_IsVisible (handle)) return new Rectangle (0, 0, 0, 0);
updateLayout (handle);
int point = OS.gcnew_Point (0, 0);
- int stackPanel = findPart (index, Tree.STACKPANEL_PART_NAME);
+ int stackPanel = findPart (index, Tree.CONTENTPANEL_PART_NAME);
int location = OS.UIElement_TranslatePoint (stackPanel, point, parent.handle);
int x = (int) OS.Point_X (location);
int y = (int) OS.Point_Y (location);
@@ -953,18 +942,28 @@ public Rectangle getTextBounds (int index) {
if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED);
if (index != 0 && !(0 <= index && index < parent.columnCount)) return new Rectangle (0, 0, 0, 0);
int parentHandle = parent.topHandle ();
- int part = findPart (index, Tree.TEXT_PART_NAME);
int point = OS.gcnew_Point (0, 0);
if (point == 0) error (SWT.ERROR_NO_HANDLES);
- int location = OS.UIElement_TranslatePoint (part, point, parentHandle);
- int x = (int) OS.Point_X (location);
- int y = (int) OS.Point_Y (location);
+ int textBlock = findPart (index, Tree.TEXT_PART_NAME);
+ int renderPanel = findPart (index, Table.RENDER_PANEL_NAME);
+ Rectangle result = new Rectangle (0, 0, 0, 0);
+ if (textBlock != 0 && renderPanel != 0) {
+ int location = OS.UIElement_TranslatePoint (textBlock, point, parentHandle);
+ int x = (int) OS.Point_X (location);
+ int y = (int) OS.Point_Y (location);
+ OS.GCHandle_Free (location);
+ double textWidth = OS.FrameworkElement_ActualWidth (textBlock);
+ int panelLocation = OS.UIElement_TranslatePoint (textBlock, point, renderPanel);
+ double visibleWidth = Math.max (0, OS.FrameworkElement_ActualWidth (renderPanel) - OS.Point_X (panelLocation));
+ OS.GCHandle_Free (panelLocation);
+ int width = (int) Math.min (textWidth, visibleWidth);
+ int height = (int) OS.FrameworkElement_ActualHeight (textBlock);
+ result = new Rectangle (x, y, width, height);
+ }
OS.GCHandle_Free (point);
- OS.GCHandle_Free (location);
- int width = (int) OS.FrameworkElement_ActualWidth (part);
- int height = (int) OS.FrameworkElement_ActualHeight (part);
- OS.GCHandle_Free (part);
- return new Rectangle (x, y, width, height);
+ if (textBlock != 0) OS.GCHandle_Free (textBlock);
+ if (renderPanel != 0) OS.GCHandle_Free (renderPanel);
+ return result;
}
public String getText () {
@@ -1505,7 +1504,7 @@ public void setText (String string) {
}
void updateBackground (int index) {
- int panel = findPart (index, Tree.STACKPANEL_PART_NAME);
+ int panel = findPart (index, Tree.CONTENTPANEL_PART_NAME);
if (panel != 0) {
if (cellBackground != null && cellBackground [index] != null) {
int brush = OS.gcnew_SolidColorBrush (cellBackground [index].handle);
@@ -1608,9 +1607,7 @@ void updateText (int index) {
if (textBlock != 0) {
if (strings != null && strings [index] != null) {
int strPtr = createDotNetString (strings [index], false);
- int text = OS.TextBlock_Text (textBlock);
OS.TextBlock_Text (textBlock, strPtr);
- OS.GCHandle_Free (text);
OS.GCHandle_Free (strPtr);
} else {
int property = OS.TextBlock_TextProperty ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Widget.java
index a4484d8784..d607095791 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Widget.java
@@ -469,9 +469,11 @@ void dumpVisualTree (int visual, int depth) {
int name = OS.FrameworkElement_Name (visual);
double width = OS.FrameworkElement_Width (visual);
double actualWidth = OS.FrameworkElement_ActualWidth (visual);
+ double height = OS.FrameworkElement_Height (visual);
+ double actualHeight = OS.FrameworkElement_ActualHeight (visual);
String widgetName = createJavaString (name);
OS.GCHandle_Free (name);
- System.out.println(typeName + " ["+widgetName+ " width=" + width + " actualWidth=" + actualWidth +"]");
+ System.out.println(typeName + " ["+widgetName+ " width=" + width + " actualWidth=" + actualWidth + " height=" + height + " actualHeight=" + actualHeight+"]");
int count = OS.VisualTreeHelper_GetChildrenCount(visual);
for (int i = 0; i < count; i++) {
int child = OS.VisualTreeHelper_GetChild (visual, i);