diff options
author | Silenio Quarti <silenio> | 2005-10-26 19:06:33 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2005-10-26 19:06:33 +0000 |
commit | b16a097ce1f227d4fd237cb6f8c0ba950eb50b9e (patch) | |
tree | 890f3a9515d3082fa8fa3ed30646fd7ed94e99ca | |
parent | 0e83e69e34c1016b74ad6756e1511fc7078c76c8 (diff) | |
download | eclipse.platform.swt-b16a097ce1f227d4fd237cb6f8c0ba950eb50b9e.tar.gz eclipse.platform.swt-b16a097ce1f227d4fd237cb6f8c0ba950eb50b9e.tar.xz eclipse.platform.swt-b16a097ce1f227d4fd237cb6f8c0ba950eb50b9e.zip |
102293 - activate menu item API (not public)
6 files changed, 51 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties index a3682d6613..7087d52e43 100644 --- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties +++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.carbon.OS.properties @@ -3974,6 +3974,13 @@ OS_SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_CGPoint_2_2=cast=(Eve OS_SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_CGPoint_2_3=cast=(UInt32) OS_SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_CGPoint_2_4=cast=(const void *) +OS_SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_HICommand_2= +OS_SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_HICommand_2_0=cast=(EventRef) +OS_SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_HICommand_2_1=cast=(EventParamName) +OS_SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_HICommand_2_2=cast=(EventParamType) +OS_SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_HICommand_2_3=cast=(UInt32) +OS_SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_HICommand_2_4=cast=(const void *) + OS_SetEventParameter__IIII_3C= OS_SetEventParameter__IIII_3C_0=cast=(EventRef) OS_SetEventParameter__IIII_3C_1=cast=(EventParamName) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c index 50e336ac2a..3163bb834b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c @@ -10722,6 +10722,22 @@ fail: } #endif +#ifndef NO_SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_HICommand_2 +JNIEXPORT jint JNICALL OS_NATIVE(SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_HICommand_2) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jobject arg4) +{ + HICommand _arg4, *lparg4=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_HICommand_2_FUNC); + if (arg4) if ((lparg4 = getHICommandFields(env, arg4, &_arg4)) == NULL) goto fail; + rc = (jint)SetEventParameter((EventRef)arg0, (EventParamName)arg1, (EventParamType)arg2, (UInt32)arg3, (const void *)lparg4); +fail: + if (arg4 && lparg4) setHICommandFields(env, arg4, lparg4); + OS_NATIVE_EXIT(env, that, SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_HICommand_2_FUNC); + return rc; +} +#endif + #ifndef NO_SetEventParameter__IIII_3C JNIEXPORT jint JNICALL OS_NATIVE(SetEventParameter__IIII_3C) (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jcharArray arg4) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c index 193552adcc..0dfbf8b2fb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c @@ -14,8 +14,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 895; -int OS_nativeFunctionCallCount[895]; +int OS_nativeFunctionCount = 896; +int OS_nativeFunctionCallCount[896]; char * OS_nativeFunctionNames[] = { "AECountItems", "AEGetNthPtr", @@ -774,6 +774,7 @@ char * OS_nativeFunctionNames[] = { "SetDragSendProc", "SetEventLoopTimerNextFireTime", "SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_CGPoint_2", + "SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_HICommand_2", "SetEventParameter__IIII_3C", "SetEventParameter__IIII_3I", "SetEventParameter__IIII_3S", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h index b5bc22748b..f4085321bd 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h @@ -778,6 +778,7 @@ typedef enum { SetDragSendProc_FUNC, SetEventLoopTimerNextFireTime_FUNC, SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_CGPoint_2_FUNC, + SetEventParameter__IIIILorg_eclipse_swt_internal_carbon_HICommand_2_FUNC, SetEventParameter__IIII_3C_FUNC, SetEventParameter__IIII_3I_FUNC, SetEventParameter__IIII_3S_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java index c6a71e7489..a71133c8d3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java @@ -1609,6 +1609,7 @@ public static final native int SetDragInputProc(int theDrag, int inputProc, int public static final native int SetDragItemFlavorData (int theDrag, int theItemRef, int theType, byte[] dataPtr, int dataSize, int dataOffset); public static final native int SetDragSendProc(int theDrag, int sendProc, int dragSendRefCon); public static final native int SetEventLoopTimerNextFireTime(int inTimer, double inNextFire); +public static final native int SetEventParameter(int inEvent, int inName, int inType, int inSize, HICommand inDataPtr); public static final native int SetEventParameter(int inEvent, int inName, int inType, int inSize, char[] inDataPtr); public static final native int SetEventParameter(int inEvent, int inName, int inType, int inSize, short[] inDataPtr); public static final native int SetEventParameter(int inEvent, int inName, int inType, int inSize, int[] inDataPtr); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/MenuItem.java index e2671da533..4236d7420f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/MenuItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/MenuItem.java @@ -529,6 +529,29 @@ public void removeSelectionListener (SelectionListener listener) { eventTable.unhook (SWT.DefaultSelection,listener); } +/*public*/ void select () { + checkWidget (); + Menu menu = parent, menuParent; + while (menu.cascade != null && (menuParent = menu.cascade.parent) != null) { + if ((menuParent.style & SWT.BAR) != 0) break; + menu = menuParent; + } + if (menu == null) return; + OS.HiliteMenu (OS.GetMenuID (menu.handle)); + int[] event = new int[1]; + OS.CreateEvent (0, OS.kEventClassCommand, OS.kEventProcessCommand, 0.0, 0, event); + if (event [0] != 0) { + int parentHandle = parent.handle; + HICommand command = new HICommand (); + command.attributes = OS.kHICommandFromMenu; + command.menu_menuRef = parentHandle; + command.menu_menuItemIndex = (short) (parent.indexOf (this) + 1); + OS.SetEventParameter (event [0], OS.kEventParamDirectObject, OS.typeHICommand, HICommand.sizeof, command); + OS.SendEventToEventTarget (event [0], OS.GetApplicationEventTarget ()); + OS.ReleaseEvent (event [0]); + } +} + void selectRadio () { int index = 0; MenuItem [] items = parent.getItems (); |