Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/library/swt.c31
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/internal/photon/OS.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java27
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java46
-rwxr-xr-xbundles/org.eclipse.swt/ws/photon/libswt0125.sobin385140 -> 385634 bytes
6 files changed, 119 insertions, 3 deletions
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 f8c52fc7d5..8dbd9a0ed3 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 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_photon_OS_PgSetFillTransPat
(*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 defebacd7a..2c83686a4f 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 Pg_BITMAP_TRANSPARENT =
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 memmove (int dest, PhCursorDef_t src, int size);
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 b3f6166e3b..e9dd1b72c3 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 @@ public abstract class Control extends Widget implements Drawable {
Composite parent;
Menu menu;
Object layoutData;
+ String toolTipText;
+ int toolTipHandle;
Control () {
/* Do nothing */
@@ -279,7 +281,7 @@ public Point getSize () {
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 @@ int processMouseEnter (int info) {
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 setVisible (boolean visible) {
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 e03950cf4d..305bfc6873 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 @@ public /*final*/ class ToolItem extends Item {
ToolBar parent;
Control control;
String toolTipText;
+ int toolTipHandle;
Image hotImage, disabledImage;
int button, arrow;
@@ -218,6 +219,7 @@ void hookEvents () {
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 @@ int processEvent (int widget, int data, int info) {
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 57f335d1b7..1ca65f7b66 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 @@ void createHandle (int index) {
/* 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 @@ void deregister () {
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 f2efe60f1d..81ca20bbea 100755
--- a/bundles/org.eclipse.swt/ws/photon/libswt0125.so
+++ b/bundles/org.eclipse.swt/ws/photon/libswt0125.so
Binary files differ

Back to the top