Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2008-06-13 15:38:58 +0000
committerSilenio Quarti2008-06-13 15:38:58 +0000
commit211a0b58dad2a48da15089d2bb86db5c6a5e60e2 (patch)
tree61e8fe822c23839c124bdedf59a146ceaa162811
parent3f8e43ba988222ed59500a610b44cf04a53ddc14 (diff)
downloadeclipse.platform.swt-211a0b58dad2a48da15089d2bb86db5c6a5e60e2.tar.gz
eclipse.platform.swt-211a0b58dad2a48da15089d2bb86db5c6a5e60e2.tar.xz
eclipse.platform.swt-211a0b58dad2a48da15089d2bb86db5c6a5e60e2.zip
210988 - setEnabled() does not work for Widgets that are not NSControl
-rwxr-xr-xbundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.cocoa.OS.properties3
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java1
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java7
8 files changed, 41 insertions, 5 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 732cae2958..e8c803029f 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
@@ -884,6 +884,9 @@ OS_class_addMethod_3=cast=(const char *)
OS_drawRect_CALLBACK=flags=no_gen
OS_drawRect_CALLBACK_0=
+OS_hitTest_CALLBACK=flags=no_gen
+OS_hitTest_CALLBACK_0=
+
OS_memmove__ILorg_eclipse_swt_internal_cocoa_NSRect_2I=
OS_memmove__ILorg_eclipse_swt_internal_cocoa_NSRect_2I_0=cast=(void *)
OS_memmove__ILorg_eclipse_swt_internal_cocoa_NSRect_2I_1=cast=(void *)
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
index 36b0be6f1c..354d543671 100755
--- 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
@@ -394,7 +394,6 @@ JNIEXPORT SWT_PTR JNICALL OS_NATIVE(setFrameOrigin_1CALLBACK)
}
#endif
-
#ifndef NO_setFrameSize_1CALLBACK
static SWT_PTR setFrameSize_1CALLBACK;
static void setFrameSize(id obj, SEL sel, NSSize size)
@@ -407,4 +406,18 @@ JNIEXPORT SWT_PTR JNICALL OS_NATIVE(setFrameSize_1CALLBACK)
setFrameSize_1CALLBACK = func;
return (SWT_PTR)setFrameSize;
}
-#endif \ No newline at end of file
+#endif
+
+#ifndef NO_hitTest_1CALLBACK
+static SWT_PTR hitTest_1CALLBACK;
+static void hitTest(id obj, SEL sel, NSPoint point)
+{
+ return ((void (*)(id, SEL, NSPoint*))hitTest_1CALLBACK)(obj, sel, &point);
+}
+JNIEXPORT SWT_PTR JNICALL OS_NATIVE(hitTest_1CALLBACK)
+ (JNIEnv *env, jclass that, SWT_PTR func)
+{
+ hitTest_1CALLBACK = func;
+ return (SWT_PTR)hitTest;
+}
+#endif
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 0a407d5aae..340a10da02 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 = 327;
-int OS_nativeFunctionCallCount[327];
+int OS_nativeFunctionCount = 328;
+int OS_nativeFunctionCallCount[328];
char * OS_nativeFunctionNames[] = {
"CGWarpMouseCursorPosition",
"CloseRgn",
@@ -64,6 +64,7 @@ char * OS_nativeFunctionNames[] = {
"class_1addIvar",
"class_1addMethod",
"drawRect_1CALLBACK",
+ "hitTest_1CALLBACK",
"memmove__ILorg_eclipse_swt_internal_cocoa_NSRect_2I",
"memmove__Lorg_eclipse_swt_internal_cocoa_NSPoint_2II",
"memmove__Lorg_eclipse_swt_internal_cocoa_NSRange_2II",
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 09c7b292a6..85274c92c6 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
@@ -72,6 +72,7 @@ typedef enum {
class_1addIvar_FUNC,
class_1addMethod_FUNC,
drawRect_1CALLBACK_FUNC,
+ hitTest_1CALLBACK_FUNC,
memmove__ILorg_eclipse_swt_internal_cocoa_NSRect_2I_FUNC,
memmove__Lorg_eclipse_swt_internal_cocoa_NSPoint_2II_FUNC,
memmove__Lorg_eclipse_swt_internal_cocoa_NSRange_2II_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 2c3bc033b8..4d9937d47f 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
@@ -359,6 +359,7 @@ public static final native int drawRect_CALLBACK(int func);
public static final native int setFrame_CALLBACK(int func);
public static final native int setFrameOrigin_CALLBACK(int func);
public static final native int setFrameSize_CALLBACK(int func);
+public static final native int hitTest_CALLBACK(int func);
public static final native int objc_msgSendSuper(objc_super superId, int sel);
public static final native int objc_msgSendSuper(objc_super superId, int sel, NSRect arg0);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
index 377aa7dac3..db314d4450 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
@@ -780,7 +780,6 @@ void drawRect(int id, NSRect rect) {
}
void enableWidget (boolean enabled) {
- //TODO - other views
if (view instanceof NSControl) {
((NSControl)view).setEnabled(enabled);
}
@@ -1307,6 +1306,11 @@ boolean hasFocus () {
return this == display.getFocusControl ();
}
+int hitTest (int id, int sel, NSPoint point) {
+ if ((state & DISABLED) != 0) return 0;
+ return super.hitTest(id, sel, point);
+}
+
/**
* Invokes platform specific functionality to allocate a new GC handle.
* <p>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
index e206e673bc..13cdd87d1d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java
@@ -1625,6 +1625,7 @@ void initClasses () {
int drawRectProc = OS.drawRect_CALLBACK(proc3);
int setFrameOriginProc = OS.setFrame_CALLBACK(proc3);
int setFrameSizeProc = OS.setFrame_CALLBACK(proc3);
+ int hitTestProc = OS.hitTest_CALLBACK(proc3);
String className = "SWTWindowDelegate";
int cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
@@ -1664,6 +1665,7 @@ void initClasses () {
OS.class_addMethod(cls, OS.sel_resignFirstResponder, proc2, "@:");
OS.class_addMethod(cls, OS.sel_becomeFirstResponder, proc2, "@:");
OS.class_addMethod(cls, OS.sel_isOpaque, proc2, "@:");
+ OS.class_addMethod(cls, OS.sel_hitTest_1, hitTestProc, "@:{NSPoint}");
OS.class_addMethod(cls, OS.sel_flagsChanged_1, proc3, "@:@");
addEventMethods(cls, proc2, proc3);
addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
@@ -3358,6 +3360,10 @@ int windowDelegateProc(int id, int sel, int arg0) {
NSSize size = new NSSize();
OS.memmove(size, arg0, NSSize.sizeof);
widget.setFrameSize(id, sel, size);
+ } else if (sel == OS.sel_hitTest_1) {
+ NSPoint point = new NSPoint();
+ OS.memmove(point, arg0, NSPoint.sizeof);
+ return widget.hitTest(id, sel, point);
} else if (sel == OS.sel_windowShouldClose_1) {
return widget.windowShouldClose(arg0) ? 1 : 0;
} else if (sel == OS.sel_mouseDown_1) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
index 6f6eea33a5..228bdfd35d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
@@ -555,6 +555,13 @@ public int getStyle () {
void helpRequested(int theEvent) {
}
+int hitTest (int id, int sel, NSPoint point) {
+ objc_super super_struct = new objc_super();
+ super_struct.receiver = id;
+ super_struct.cls = OS.objc_msgSend(id, OS.sel_superclass);
+ return OS.objc_msgSendSuper(super_struct, sel, point);
+}
+
boolean hooks (int eventType) {
if (eventTable == null) return false;
return eventTable.hooks (eventType);

Back to the top