diff options
author | Felipe Heidrich <fheidric> | 2007-11-15 17:03:53 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2007-11-15 17:03:53 +0000 |
commit | ee37eed09abf2b304605b7bd7be15ba102d37b58 (patch) | |
tree | 5ff8b26c4b049d7c8b7e66827f50afece3bbd7e4 /bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c | |
parent | 4eb84c684bfa237dcce3337cdcdd67ab82c88da5 (diff) | |
download | eclipse.platform.swt-ee37eed09abf2b304605b7bd7be15ba102d37b58.tar.gz eclipse.platform.swt-ee37eed09abf2b304605b7bd7be15ba102d37b58.tar.xz eclipse.platform.swt-ee37eed09abf2b304605b7bd7be15ba102d37b58.zip |
cocoa merge
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c | 331 |
1 files changed, 331 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c new file mode 100755 index 0000000000..64b76b4177 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c @@ -0,0 +1,331 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +#include "swt.h" +#include "os_structs.h" +#include "os_stats.h" + +#define OS_NATIVE(func) Java_org_eclipse_swt_internal_cocoa_OS_##func + +#ifndef NO_JNIGetObject +JNIEXPORT jobject JNICALL OS_NATIVE(JNIGetObject) + (JNIEnv *env, jclass that, jint arg0) +{ + jobject rc = 0; + OS_NATIVE_ENTER(env, that, JNIGetObject_FUNC); + rc = (jobject)arg0; + OS_NATIVE_EXIT(env, that, JNIGetObject_FUNC); + return rc; +} +#endif + +#ifndef NO_NSIntersectionRect +JNIEXPORT void JNICALL OS_NATIVE(NSIntersectionRect) + (JNIEnv *env, jclass that, jobject arg0, jobject arg1, jobject arg2) +{ + NSRect _arg0, *lparg0=NULL; + NSRect _arg1, *lparg1=NULL; + NSRect _arg2, *lparg2=NULL; + OS_NATIVE_ENTER(env, that, NSIntersectionRect_FUNC); + if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail; + if (arg1) if ((lparg1 = getNSRectFields(env, arg1, &_arg1)) == NULL) goto fail; + if (arg2) if ((lparg2 = getNSRectFields(env, arg2, &_arg2)) == NULL) goto fail; + *lparg0 = NSIntersectionRect(*lparg1, *lparg2); +fail: + if (arg2 && lparg2) setNSRectFields(env, arg2, lparg2); + if (arg1 && lparg1) setNSRectFields(env, arg1, lparg1); + if (arg0 && lparg0) setNSRectFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, NSIntersectionRect_FUNC); +} +#endif + +#ifndef NO_objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2IILorg_eclipse_swt_internal_cocoa_NSPoint_2 +static SEL cascadeTopLeftFromPoint; +JNIEXPORT jint JNICALL OS_NATIVE(objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2IILorg_eclipse_swt_internal_cocoa_NSPoint_2) + (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2, jobject arg3) +{ + NSPoint _arg0, *lparg0=NULL; + NSPoint _arg3, *lparg3=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2IILorg_eclipse_swt_internal_cocoa_NSPoint_2_FUNC); + if (arg0) if ((lparg0 = getNSPointFields(env, arg0, &_arg0)) == NULL) goto fail; + if (arg3) if ((lparg3 = getNSPointFields(env, arg3, &_arg3)) == NULL) goto fail; + + //rc = (jint)objc_msgSend_struct(lparg0, arg1, arg2, lparg3); + + if (cascadeTopLeftFromPoint == NULL) cascadeTopLeftFromPoint = sel_registerName("cascadeTopLeftFromPoint:"); + if ((SEL)arg2 == cascadeTopLeftFromPoint) { + *lparg0 = [(NSWindow *)arg1 cascadeTopLeftFromPoint: _arg3]; + } +fail: + if (arg3 && lparg3) setNSPointFields(env, arg3, lparg3); + if (arg0 && lparg0) setNSPointFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2IILorg_eclipse_swt_internal_cocoa_NSPoint_2_FUNC); + return rc; +} +#endif + + +#ifndef NO_objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2III +static SEL locationForGlyphAtIndex; +JNIEXPORT jint JNICALL OS_NATIVE(objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2III) + (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2, jint arg3) +{ + NSPoint _arg0, *lparg0=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2III_FUNC); + if (arg0) if ((lparg0 = getNSPointFields(env, arg0, &_arg0)) == NULL) goto fail; + + //rc = (jint)objc_msgSend_struct(lparg0, arg1, arg2); + + if (locationForGlyphAtIndex == 0) locationForGlyphAtIndex = sel_registerName("locationForGlyphAtIndex:"); + if ((SEL)arg2 == locationForGlyphAtIndex) { + *lparg0 = [(NSLayoutManager *)arg1 locationForGlyphAtIndex: arg3]; + } + +fail: + if (arg0 && lparg0) setNSPointFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2III_FUNC); + return rc; +} +#endif + +#ifndef NO_objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2II +static SEL mouseLocationOutsideOfEventStream; +static SEL locationInWindow; +JNIEXPORT jint JNICALL OS_NATIVE(objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2II) + (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2) +{ + NSPoint _arg0, *lparg0=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2II_FUNC); + if (arg0) if ((lparg0 = getNSPointFields(env, arg0, &_arg0)) == NULL) goto fail; + + //rc = (jint)objc_msgSend_struct(lparg0, arg1, arg2); + + if (mouseLocationOutsideOfEventStream == 0) mouseLocationOutsideOfEventStream = sel_registerName("mouseLocationOutsideOfEventStream"); + if ((SEL)arg2 == mouseLocationOutsideOfEventStream) { + *lparg0 = [(NSWindow *)arg1 mouseLocationOutsideOfEventStream]; + } else { + if (locationInWindow == 0) locationInWindow = sel_registerName("locationInWindow"); + if ((SEL)arg2 == locationInWindow) { + *lparg0 = [(NSEvent *)arg1 locationInWindow]; + } + } + +fail: + if (arg0 && lparg0) setNSPointFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2II_FUNC); + return rc; +} +#endif + +#ifndef NO_objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2IILorg_eclipse_swt_internal_cocoa_NSRange_2I +static SEL glyphRangeForCharacterRange; +JNIEXPORT void JNICALL OS_NATIVE(objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2IILorg_eclipse_swt_internal_cocoa_NSRange_2I) + (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2, jobject arg3, jint arg4) +{ + NSRange _arg0, *lparg0=NULL; + NSRange _arg3, *lparg3=NULL; + OS_NATIVE_ENTER(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2IILorg_eclipse_swt_internal_cocoa_NSRange_2I_FUNC); + if (arg0) if ((lparg0 = getNSRangeFields(env, arg0, &_arg0)) == NULL) goto fail; + if (arg3) if ((lparg3 = getNSRangeFields(env, arg3, &_arg3)) == NULL) goto fail; + //objc_msgSend_struct(lparg0, arg1, arg2, lparg3, arg4); + if (glyphRangeForCharacterRange == 0) glyphRangeForCharacterRange = sel_registerName("glyphRangeForCharacterRange:actualCharacterRange::"); + if ((SEL)arg2 == glyphRangeForCharacterRange) { + *lparg0 = [(id)arg1 glyphRangeForCharacterRange: *lparg3 actualCharacterRange: (NSRange *)arg4]; + } +fail: + if (arg3 && lparg3) setNSRangeFields(env, arg3, lparg3); + if (arg0 && lparg0) setNSRangeFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2IILorg_eclipse_swt_internal_cocoa_NSRange_2I_FUNC); +} +#endif + +#ifndef NO_objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSSize_2IILorg_eclipse_swt_internal_cocoa_NSSize_2ZZI +static SEL frameSizeForContentSize; +JNIEXPORT void JNICALL OS_NATIVE(objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSSize_2IILorg_eclipse_swt_internal_cocoa_NSSize_2ZZI) + (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2, jobject arg3, jboolean arg4, jboolean arg5, jint arg6) +{ + NSSize _arg0, *lparg0=NULL; + NSSize _arg3, *lparg3=NULL; + OS_NATIVE_ENTER(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSSize_2IILorg_eclipse_swt_internal_cocoa_NSSize_2ZZI_FUNC); + if (arg0) if ((lparg0 = getNSSizeFields(env, arg0, &_arg0)) == NULL) goto fail; + if (arg3) if ((lparg3 = getNSSizeFields(env, arg3, &_arg3)) == NULL) goto fail; + //objc_msgSend_struct(lparg0, arg1, arg2, lparg3, arg4, arg5, arg6); + if (frameSizeForContentSize == 0) frameSizeForContentSize = sel_registerName("frameSizeForContentSize:hasHorizontalScroller:hasVerticalScroller:borderType:"); + if ((SEL)arg2 == frameSizeForContentSize) { + *lparg0 = [(id)arg1 frameSizeForContentSize: *lparg3 hasHorizontalScroller: arg4 hasVerticalScroller: arg5 borderType: arg6]; + } +fail: + if (arg3 && lparg3) setNSSizeFields(env, arg3, lparg3); + if (arg0 && lparg0) setNSSizeFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSSize_2IILorg_eclipse_swt_internal_cocoa_NSSize_2ZZI_FUNC); +} +#endif + +#ifndef NO_objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2II +static SEL selectedRange; +JNIEXPORT jint JNICALL OS_NATIVE(objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2II) + (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2) +{ + NSRange _arg0, *lparg0=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2II_FUNC); + if (arg0) if ((lparg0 = getNSRangeFields(env, arg0, &_arg0)) == NULL) goto fail; + + //rc = (jint)objc_msgSend_struct(lparg0, arg1, arg2); + if (selectedRange == 0) selectedRange = sel_registerName("selectedRange"); + if ((SEL)arg2 == selectedRange) { + *lparg0 = [(NSText *)arg1 selectedRange]; + } + +fail: + if (arg0 && lparg0) setNSRangeFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2II_FUNC); + return rc; +} +#endif + + +#ifndef NO_objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2III +static SEL doubleClickAtIndex; +static SEL glyphRangeForTextContainer; +JNIEXPORT jint JNICALL OS_NATIVE(objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2III) + (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2, jint arg3) +{ + NSRange _arg0, *lparg0=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2III_FUNC); + if (arg0) if ((lparg0 = getNSRangeFields(env, arg0, &_arg0)) == NULL) goto fail; + + //rc = (jint)objc_msgSend_struct(lparg0, arg1, arg2, arg3); + if (doubleClickAtIndex == 0) doubleClickAtIndex = sel_registerName("doubleClickAtIndex:"); + if ((SEL)arg2 == doubleClickAtIndex) { + *lparg0 = [(NSAttributedString *)arg1 doubleClickAtIndex: arg3]; + } else { + if (glyphRangeForTextContainer == 0) glyphRangeForTextContainer = sel_registerName("glyphRangeForTextContainer:"); + if ((SEL)arg2 == glyphRangeForTextContainer) { + *lparg0 = [(NSLayoutManager *)arg1 glyphRangeForTextContainer: (NSTextContainer *)arg3]; + } + } + +fail: + if (arg0 && lparg0) setNSRangeFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2III_FUNC); + return rc; +} +#endif + +#ifndef NO_objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSSize_2II +static SEL size; +static SEL minimumSize; +static SEL contentSize; +static SEL cellSize; +JNIEXPORT jint JNICALL OS_NATIVE(objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSSize_2II) + (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2) +{ + NSSize _arg0, *lparg0=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSSize_2II_FUNC); + if (arg0) if ((lparg0 = getNSSizeFields(env, arg0, &_arg0)) == NULL) goto fail; + + //rc = (jint)objc_msgSend_struct(lparg0, arg1, arg2); + if (size == 0) size = sel_registerName("size"); + if ((SEL)arg2 == size) { + *lparg0 = [(NSAttributedString *)arg1 size]; + } else { + if (minimumSize == 0) minimumSize = sel_registerName("minimumSize"); + if ((SEL)arg2 == minimumSize) { + *lparg0 = [(NSTabView *)arg1 minimumSize]; + } else { + if (contentSize == 0) contentSize = sel_registerName("contentSize"); + if ((SEL)arg2 == contentSize) { + *lparg0 = [(NSScrollView *)arg1 contentSize]; + } else { + if (cellSize == 0) cellSize = sel_registerName("cellSize"); + if ((SEL)arg2 == contentSize) { + *lparg0 = [(NSCell *)arg1 cellSize]; + } + } + } + } + +fail: + if (arg0 && lparg0) setNSSizeFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSSize_2II_FUNC); + return rc; +} +#endif + +#ifndef NO_objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2IILorg_eclipse_swt_internal_cocoa_NSPoint_2I +static SEL convertPointfromView; +JNIEXPORT jint JNICALL OS_NATIVE(objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2IILorg_eclipse_swt_internal_cocoa_NSPoint_2I) + (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2, jobject arg3, jint arg4) +{ + NSPoint _arg0, *lparg0=NULL; + NSPoint _arg3, *lparg3=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2IILorg_eclipse_swt_internal_cocoa_NSPoint_2I_FUNC); + if (arg0) if ((lparg0 = getNSPointFields(env, arg0, &_arg0)) == NULL) goto fail; + if (arg3) if ((lparg3 = getNSPointFields(env, arg3, &_arg3)) == NULL) goto fail; + + //rc = (jint)objc_msgSend_struct(lparg0, arg1, arg2, lparg3, arg4); + if (convertPointfromView == 0) convertPointfromView = sel_registerName("convertPoint:fromView:"); + if ((SEL)arg2 == convertPointfromView) { + *lparg0 = [(NSView *)arg1 convertPoint: _arg3 fromView: (NSView *)arg4]; + } + +fail: + if (arg3 && lparg3) setNSPointFields(env, arg3, lparg3); + if (arg0 && lparg0) setNSPointFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSPoint_2IILorg_eclipse_swt_internal_cocoa_NSPoint_2I_FUNC); + return rc; +} +#endif + +#ifndef NO_objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2IILorg_eclipse_swt_internal_cocoa_NSRange_2 +static SEL lineRangeForRange; +JNIEXPORT jint JNICALL OS_NATIVE(objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2IILorg_eclipse_swt_internal_cocoa_NSRange_2) + (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2, jobject arg3) +{ + NSRange _arg0, *lparg0=NULL; + NSRange _arg3, *lparg3=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2IILorg_eclipse_swt_internal_cocoa_NSRange_2_FUNC); + if (arg0) if ((lparg0 = getNSRangeFields(env, arg0, &_arg0)) == NULL) goto fail; + if (arg3) if ((lparg3 = getNSRangeFields(env, arg3, &_arg3)) == NULL) goto fail; + //rc = (jint)objc_msgSend_struct(lparg0, arg1, arg2, lparg3); + if (lineRangeForRange == 0) lineRangeForRange = sel_registerName("lineRangeForRange:"); + if ((SEL)arg2 == lineRangeForRange) { + *lparg0 = [(NSString *)arg1 lineRangeForRange: *lparg3]; + } +fail: + if (arg3 && lparg3) setNSRangeFields(env, arg3, lparg3); + if (arg0 && lparg0) setNSRangeFields(env, arg0, lparg0); + OS_NATIVE_EXIT(env, that, objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSRange_2IILorg_eclipse_swt_internal_cocoa_NSRange_2_FUNC); + return rc; +} +#endif + +#ifndef NO_drawRect_1CALLBACK +static SWT_PTR drawRect_1CALLBACK; +static void drawRect(id obj, SEL sel, NSRect rect) +{ + return ((void (*)(id, SEL, NSRect*))drawRect_1CALLBACK)(obj, sel, &rect); +} +JNIEXPORT SWT_PTR JNICALL OS_NATIVE(drawRect_1CALLBACK) + (JNIEnv *env, jclass that, SWT_PTR func) +{ + drawRect_1CALLBACK = func; + return (SWT_PTR)drawRect; +} +#endif
\ No newline at end of file |