*** empty log message ***
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c index f8c52fc..8dbd9a0 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c +++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c
@@ -6314,3 +6314,34 @@ (*env)->ReleaseByteArrayElements(env, pat, (jbyte *)pat1, 0); } +/* + * Class: org_eclipse_swt_internal_photon_OS + * Method: PtInflateBalloon + * Signature: (III[B[BII)I + */ +JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_photon_OS_PtInflateBalloon + (JNIEnv *env, jobject that, jint win, jint me, jint position, jbyteArray str, jbyteArray font, int fill, int text_color) +{ + jbyte *font1=NULL; + jbyte *str1=NULL; + int result; + +#ifdef DEBUG_CALL_PRINTS + fprintf(stderr, "PtInflateBalloon\n"); +#endif + + if (font) + font1 = (*env)->GetByteArrayElements(env, font, NULL); + if (str) + str1 = (*env)->GetByteArrayElements(env, str, NULL); + + result = (jint) PtInflateBalloon((PtWidget_t *)win, (PtWidget_t *)me, position, str1, font1, fill, text_color); + + if (font) + (*env)->ReleaseByteArrayElements(env, font, font1, JNI_ABORT); + if (str) + (*env)->ReleaseByteArrayElements(env, str, str1, JNI_ABORT); + + return result; +} +
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java index defebac..2c83686 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java
@@ -768,7 +768,7 @@ public static final int Ph_EV_PTR_STEADY = 2; //public static final int Ph_EV_PTR_TRANSIENT_ENTER = 8; //public static final int Ph_EV_PTR_TRANSIENT_LEAVE = 9; -//public static final int Ph_EV_PTR_UNSTEADY = 3; + public static final int Ph_EV_PTR_UNSTEADY = 3; public static final int Ph_EV_PTR_MOTION = ( Ph_EV_PTR_MOTION_NOBUTTON | Ph_EV_PTR_MOTION_BUTTON ); //public static final int Ph_EV_PTR_ALL = ( Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE | Ph_EV_PTR_MOTION | Ph_EV_BUT_REPEAT ); //public static final int Ph_EV_RAW = 0x00008000; @@ -2922,4 +2922,6 @@ public static final native void PgSetFillTransPat (byte [] pat); +public static final native int PtInflateBalloon (int win, int me, int position, byte [] string, byte [] font, int fill, int text_color); + }
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java index b3f6166..e9dd1b7 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
@@ -14,6 +14,8 @@ Composite parent; Menu menu; Object layoutData; + String toolTipText; + int toolTipHandle; Control () { /* Do nothing */ @@ -279,7 +281,7 @@ public String getToolTipText () { if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS); if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED); - return null; + return toolTipText; } public Shell getShell () { @@ -662,9 +664,16 @@ break; case OS.Ph_EV_PTR_LEAVE: case OS.Ph_EV_PTR_LEAVE_TO_CHILD: - sendEvent (SWT.MouseExit, event); + sendEvent (SWT.MouseExit, event); + break; case OS.Ph_EV_PTR_STEADY: postEvent (SWT.MouseHover, event); + destroyToolTip (toolTipHandle); + toolTipHandle = createToolTip (toolTipText, handle, getFont ().handle); + break; + case OS.Ph_EV_PTR_UNSTEADY: + destroyToolTip (toolTipHandle); + toolTipHandle = 0; break; } return OS.Pt_END; @@ -1106,6 +1115,7 @@ public void setToolTipText (String string) { if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS); if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED); + toolTipText = string; } void setZOrder() {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java index e03950c..305bfc6 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java
@@ -15,6 +15,7 @@ ToolBar parent; Control control; String toolTipText; + int toolTipHandle; Image hotImage, disabledImage; int button, arrow; @@ -218,6 +219,7 @@ super.hookEvents (); if ((style & SWT.SEPARATOR) != 0) return; int windowProc = getDisplay ().windowProc; + OS.PtAddEventHandler (handle, OS.Ph_EV_BOUNDARY, windowProc, SWT.MouseEnter); OS.PtAddCallback (button, OS.Pt_CB_ACTIVATE, windowProc, SWT.Selection); if ((style & SWT.DROP_DOWN) != 0) { OS.PtAddCallback (arrow, OS.Pt_CB_ACTIVATE, windowProc, SWT.Selection); @@ -240,6 +242,31 @@ return super.processEvent (widget, data, info);; } +int processMouseEnter (int info) { + if (info == 0) return OS.Pt_END; + PtCallbackInfo_t cbinfo = new PtCallbackInfo_t (); + OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof); + if (cbinfo.event == 0) return OS.Pt_END; + PhEvent_t ev = new PhEvent_t (); + OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof); + switch (ev.subtype) { + case OS.Ph_EV_PTR_STEADY: + int [] args = {OS.Pt_ARG_TEXT_FONT, 0, 0}; + OS.PtGetResources (button, args.length / 3, args); + int length = OS.strlen (args [1]); + byte [] font = new byte [length + 1]; + OS.memmove (font, args [1], length); + destroyToolTip (toolTipHandle); + toolTipHandle = createToolTip (toolTipText, button, font); + break; + case OS.Ph_EV_PTR_UNSTEADY: + destroyToolTip (toolTipHandle); + toolTipHandle = 0; + break; + } + return OS.Pt_END; +} + int processSelection (int info) { if ((style & SWT.RADIO) != 0) { setSelection (true);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java index 57f335d..1ca65f7 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java
@@ -104,6 +104,48 @@ /* Do nothing */ } +int createToolTip (String string, int handle, byte [] font) { + if (string == null || string.length () == 0 || handle == 0) { + return 0; + } + + int shellHandle = OS.PtFindDisjoint (handle); + byte [] buffer = Converter.wcsToMbcs (null, string, true); + Display display = getDisplay (); + int fill = display.INFO_BACKGROUND; + int text_color = display.INFO_FOREGROUND; + int toolTipHandle = OS.PtInflateBalloon (shellHandle, handle, OS.Pt_BALLOON_RIGHT, buffer, font, fill, text_color); + + /* + * Feature in Photon. The position of the inflated balloon + * is relative to the widget position and not to the cursor + * position. The fix is to re-position the balloon. + */ + int ig = OS.PhInputGroup (0); + PhCursorInfo_t info = new PhCursorInfo_t (); + OS.PhQueryCursor ((short)ig, info); + short [] absX = new short [1], absY = new short [1]; + OS.PtGetAbsPosition (shellHandle, absX, absY); + int x = info.pos_x - absX [0] + 16; + int y = info.pos_y - absY [0] + 16; + PhArea_t shellArea = new PhArea_t (); + OS.PtWidgetArea (shellHandle, shellArea); + PhArea_t toolTipArea = new PhArea_t (); + OS.PtWidgetArea (toolTipHandle, toolTipArea); + x = Math.max (0, Math.min (x, shellArea.size_w - toolTipArea.size_w)); + y = Math.max (0, Math.min (y, shellArea.size_h - toolTipArea.size_h)); + PhPoint_t pt = new PhPoint_t (); + pt.x = (short) x; + pt.y = (short) y; + int ptr = OS.malloc (PhPoint_t.sizeof); + OS.memmove (ptr, pt, PhPoint_t.sizeof); + int [] args = {OS.Pt_ARG_POS, ptr, 0}; + OS.PtSetResources (toolTipHandle, args.length / 3, args); + OS.free (ptr); + + return toolTipHandle; +} + void createWidget (int index) { createHandle (index); hookEvents (); @@ -115,6 +157,10 @@ WidgetTable.remove (handle); } +void destroyToolTip (int toolTipHandle) { + if (toolTipHandle != 0) OS.PtDestroyWidget (toolTipHandle); +} + void destroyWidget () { int topHandle = topHandle (); releaseHandle ();
diff --git a/bundles/org.eclipse.swt/ws/photon/libswt0125.so b/bundles/org.eclipse.swt/ws/photon/libswt0125.so index f2efe60..81ca20b 100755 --- a/bundles/org.eclipse.swt/ws/photon/libswt0125.so +++ b/bundles/org.eclipse.swt/ws/photon/libswt0125.so Binary files differ