diff options
author | Kevin Barnes <krbarnes> | 2008-03-24 19:05:11 +0000 |
---|---|---|
committer | Kevin Barnes <krbarnes> | 2008-03-24 19:05:11 +0000 |
commit | 6d8c317902eb09c803faf1d770e4b6a3ba111918 (patch) | |
tree | 4ebd848dc01c1fcc477c299140c7f6f5c6468a25 | |
parent | c675eb1083ee25c0557ed07673c6d784361729d8 (diff) | |
download | eclipse.platform.swt-6d8c317902eb09c803faf1d770e4b6a3ba111918.tar.gz eclipse.platform.swt-6d8c317902eb09c803faf1d770e4b6a3ba111918.tar.xz eclipse.platform.swt-6d8c317902eb09c803faf1d770e4b6a3ba111918.zip |
Bug 222120 - DND - how to detect which tab item is involved in a DropTargetEvent
7 files changed, 78 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.cocoa.OS.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.cocoa.OS.properties index d3d242ef46..490a7d2cea 100755 --- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.cocoa.OS.properties +++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.cocoa.OS.properties @@ -32,6 +32,8 @@ org_eclipse_swt_internal_cocoa_DOMKeyboardEvent= org_eclipse_swt_internal_cocoa_DOMMouseEvent= +org_eclipse_swt_internal_cocoa_DOMWheelEvent= + org_eclipse_swt_internal_cocoa_MacGenerator= org_eclipse_swt_internal_cocoa_NSATSTypesetter= @@ -771,6 +773,10 @@ OS_MoveTo=flags=dynamic OS_MoveTo_0= OS_MoveTo_1= +OS_NSAccessibilityPositionAttribute=flags=const + +OS_NSAccessibilitySizeAttribute=flags=const + OS_NSBackgroundColorAttributeName=flags=const OS_NSBaselineOffsetAttributeName=flags=const @@ -2831,6 +2837,8 @@ OS_sel_registerName= OS_sel_registerName_0=cast=(const char *) +org_eclipse_swt_internal_cocoa_SWTApplicationDelegate= + org_eclipse_swt_internal_cocoa_SWTBox= org_eclipse_swt_internal_cocoa_SWTButton= @@ -2865,6 +2873,8 @@ org_eclipse_swt_internal_cocoa_SWTTabView= org_eclipse_swt_internal_cocoa_SWTTableView= +org_eclipse_swt_internal_cocoa_SWTTextField= + org_eclipse_swt_internal_cocoa_SWTTextView= org_eclipse_swt_internal_cocoa_SWTTreeItem= @@ -2873,6 +2883,8 @@ org_eclipse_swt_internal_cocoa_SWTView= org_eclipse_swt_internal_cocoa_SWTWebViewDelegate= +org_eclipse_swt_internal_cocoa_SWTWindow= + org_eclipse_swt_internal_cocoa_SWTWindowDelegate= org_eclipse_swt_internal_cocoa_WebDataSource= diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c index eb714856c6..f253b67b32 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c @@ -288,6 +288,30 @@ JNIEXPORT void JNICALL OS_NATIVE(MoveTo) } #endif +#ifndef NO_NSAccessibilityPositionAttribute +JNIEXPORT jint JNICALL OS_NATIVE(NSAccessibilityPositionAttribute) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, NSAccessibilityPositionAttribute_FUNC); + rc = (jint)NSAccessibilityPositionAttribute; + OS_NATIVE_EXIT(env, that, NSAccessibilityPositionAttribute_FUNC); + return rc; +} +#endif + +#ifndef NO_NSAccessibilitySizeAttribute +JNIEXPORT jint JNICALL OS_NATIVE(NSAccessibilitySizeAttribute) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, NSAccessibilitySizeAttribute_FUNC); + rc = (jint)NSAccessibilitySizeAttribute; + OS_NATIVE_EXIT(env, that, NSAccessibilitySizeAttribute_FUNC); + return rc; +} +#endif + #ifndef NO_NSBackgroundColorAttributeName JNIEXPORT jint JNICALL OS_NATIVE(NSBackgroundColorAttributeName) (JNIEnv *env, jclass that) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c index ad1745f97b..26caa8efd2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c @@ -14,8 +14,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 318; -int OS_nativeFunctionCallCount[318]; +int OS_nativeFunctionCount = 320; +int OS_nativeFunctionCallCount[320]; char * OS_nativeFunctionNames[] = { "CGWarpMouseCursorPosition", "CloseRgn", @@ -30,6 +30,8 @@ char * OS_nativeFunctionNames[] = { "JNIGetObject", "LineTo", "MoveTo", + "NSAccessibilityPositionAttribute", + "NSAccessibilitySizeAttribute", "NSBackgroundColorAttributeName", "NSBaselineOffsetAttributeName", "NSBitsPerPixelFromDepth", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h index 3e4b593b31..c7bb68b7e5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h @@ -38,6 +38,8 @@ typedef enum { JNIGetObject_FUNC, LineTo_FUNC, MoveTo_FUNC, + NSAccessibilityPositionAttribute_FUNC, + NSAccessibilitySizeAttribute_FUNC, NSBackgroundColorAttributeName_FUNC, NSBaselineOffsetAttributeName_FUNC, NSBitsPerPixelFromDepth_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java index 47c4948141..a4f9a07700 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java @@ -9142,7 +9142,7 @@ public static final int WebViewInsertActionTyped = 0; //public static final native int NSAccessibilityPickAction(); //public static final native int NSAccessibilityPointsUnitValue(); //public static final native int NSAccessibilityPopUpButtonRole(); -//public static final native int NSAccessibilityPositionAttribute(); +public static final native int NSAccessibilityPositionAttribute(); //public static final native int NSAccessibilityPressAction(); //public static final native int NSAccessibilityPreviousContentsAttribute(); //public static final native int NSAccessibilityProgressIndicatorRole(); @@ -9189,7 +9189,7 @@ public static final int WebViewInsertActionTyped = 0; //public static final native int NSAccessibilitySheetRole(); //public static final native int NSAccessibilityShowMenuAction(); //public static final native int NSAccessibilityShownMenuAttribute(); -//public static final native int NSAccessibilitySizeAttribute(); +public static final native int NSAccessibilitySizeAttribute(); //public static final native int NSAccessibilitySliderRole(); //public static final native int NSAccessibilitySortButtonRole(); //public static final native int NSAccessibilitySortDirectionAttribute(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java index 182d2577dc..81f89f3069 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java @@ -249,6 +249,22 @@ public TabItem getItem (int index) { return items [index]; } +public TabItem getItem (Point point) { + checkWidget (); + NSPoint nsPoint = new NSPoint (); + nsPoint.x = point.x; + nsPoint.y = point.y; + NSTabView tabView = (NSTabView) view; + NSTabViewItem tabViewItem = tabView.tabViewItemAtPoint (nsPoint); + for (int i = 0; i < itemCount; i++) { + NSTabViewItem item = items[i].nsItem; + if (item.isEqual (tabViewItem)) { + return items [i]; + } + } + return null; +} + /** * Returns the number of items contained in the receiver. * diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java index ac61b171af..e7444b8a83 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java @@ -131,9 +131,25 @@ void destroyWidget () { * @since 3.4 */ public Rectangle getBounds() { - //TODO: Need to provide implementation for cocoa. checkWidget(); - return new Rectangle (0, 0, 0, 0); + Rectangle result = new Rectangle (0, 0, 0, 0); + if (nsItem.respondsToSelector (OS.sel_accessibilityAttributeValue_1)) { + int posValue = OS.objc_msgSend (nsItem.id, OS.sel_accessibilityAttributeValue_1, OS.NSAccessibilityPositionAttribute ()); + int sizeValue = OS.objc_msgSend (nsItem.id, OS.sel_accessibilityAttributeValue_1, OS.NSAccessibilitySizeAttribute ()); + NSValue val = new NSValue (posValue); + NSPoint pt = val.pointValue (); + NSWindow window = parent.view.window (); + pt.y = window.screen ().frame ().height - pt.y; + pt = parent.view.convertPoint_fromView_ (pt, null); + pt = window.convertScreenToBase (pt); + result.x = (int) pt.x; + result.y = (int) pt.y; + val = new NSValue (sizeValue); + NSSize size = val.sizeValue (); + result.width = (int) size.width; + result.height = (int) size.height; + } + return result; } /** |