Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c90
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java62
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java61
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java179
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java53
7 files changed, 118 insertions, 337 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 4fc864ba5d..b1de88cb71 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -4877,22 +4877,6 @@ JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1check_1menu_1item_1new)
}
#endif
-#ifndef NO__1gtk_1check_1menu_1item_1new_1with_1label
-JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1check_1menu_1item_1new_1with_1label)
- (JNIEnv *env, jclass that, jbyteArray arg0)
-{
- jbyte *lparg0=NULL;
- jintLong rc = 0;
- GTK_NATIVE_ENTER(env, that, _1gtk_1check_1menu_1item_1new_1with_1label_FUNC);
- if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
- rc = (jintLong)gtk_check_menu_item_new_with_label((const gchar *)lparg0);
-fail:
- if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
- GTK_NATIVE_EXIT(env, that, _1gtk_1check_1menu_1item_1new_1with_1label_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO__1gtk_1check_1menu_1item_1set_1active
JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1check_1menu_1item_1set_1active)
(JNIEnv *env, jclass that, jintLong arg0, jboolean arg1)
@@ -7502,48 +7486,6 @@ JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1im_1multicontext_1new)
}
#endif
-#ifndef NO__1gtk_1image_1menu_1item_1new_1with_1label
-JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1image_1menu_1item_1new_1with_1label)
- (JNIEnv *env, jclass that, jbyteArray arg0)
-{
- jbyte *lparg0=NULL;
- jintLong rc = 0;
- GTK_NATIVE_ENTER(env, that, _1gtk_1image_1menu_1item_1new_1with_1label_FUNC);
- if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
-/*
- rc = (jintLong)gtk_image_menu_item_new_with_label((const gchar *)lparg0);
-*/
- {
- GTK_LOAD_FUNCTION(fp, gtk_image_menu_item_new_with_label)
- if (fp) {
- rc = (jintLong)((jintLong (CALLING_CONVENTION*)(const gchar *))fp)((const gchar *)lparg0);
- }
- }
-fail:
- if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
- GTK_NATIVE_EXIT(env, that, _1gtk_1image_1menu_1item_1new_1with_1label_FUNC);
- return rc;
-}
-#endif
-
-#ifndef NO__1gtk_1image_1menu_1item_1set_1image
-JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1image_1menu_1item_1set_1image)
- (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
-{
- GTK_NATIVE_ENTER(env, that, _1gtk_1image_1menu_1item_1set_1image_FUNC);
-/*
- gtk_image_menu_item_set_image((GtkImageMenuItem *)arg0, (GtkWidget *)arg1);
-*/
- {
- GTK_LOAD_FUNCTION(fp, gtk_image_menu_item_set_image)
- if (fp) {
- ((void (CALLING_CONVENTION*)(GtkImageMenuItem *, GtkWidget *))fp)((GtkImageMenuItem *)arg0, (GtkWidget *)arg1);
- }
- }
- GTK_NATIVE_EXIT(env, that, _1gtk_1image_1menu_1item_1set_1image_FUNC);
-}
-#endif
-
#ifndef NO__1gtk_1image_1new
JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1image_1new)
(JNIEnv *env, jclass that)
@@ -8075,22 +8017,6 @@ JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1menu_1item_1new)
}
#endif
-#ifndef NO__1gtk_1menu_1item_1new_1with_1label
-JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1menu_1item_1new_1with_1label)
- (JNIEnv *env, jclass that, jbyteArray arg0)
-{
- jbyte *lparg0=NULL;
- jintLong rc = 0;
- GTK_NATIVE_ENTER(env, that, _1gtk_1menu_1item_1new_1with_1label_FUNC);
- if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
- rc = (jintLong)gtk_menu_item_new_with_label((const gchar *)lparg0);
-fail:
- if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
- GTK_NATIVE_EXIT(env, that, _1gtk_1menu_1item_1new_1with_1label_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO__1gtk_1menu_1item_1set_1submenu
JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1menu_1item_1set_1submenu)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
@@ -9365,22 +9291,6 @@ JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1radio_1menu_1item_1new)
}
#endif
-#ifndef NO__1gtk_1radio_1menu_1item_1new_1with_1label
-JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1radio_1menu_1item_1new_1with_1label)
- (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
-{
- jbyte *lparg1=NULL;
- jintLong rc = 0;
- GTK_NATIVE_ENTER(env, that, _1gtk_1radio_1menu_1item_1new_1with_1label_FUNC);
- if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
- rc = (jintLong)gtk_radio_menu_item_new_with_label((GSList *)arg0, (const gchar *)lparg1);
-fail:
- if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
- GTK_NATIVE_EXIT(env, that, _1gtk_1radio_1menu_1item_1new_1with_1label_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO__1gtk_1range_1get_1adjustment
JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1range_1get_1adjustment)
(JNIEnv *env, jclass that, jintLong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 60f5e7f8bf..53966971d3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -374,7 +374,6 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1check_1button_1new",
"_1gtk_1check_1menu_1item_1get_1active",
"_1gtk_1check_1menu_1item_1new",
- "_1gtk_1check_1menu_1item_1new_1with_1label",
"_1gtk_1check_1menu_1item_1set_1active",
"_1gtk_1check_1version",
"_1gtk_1clipboard_1clear",
@@ -558,8 +557,6 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1im_1context_1set_1cursor_1location",
"_1gtk_1im_1multicontext_1append_1menuitems",
"_1gtk_1im_1multicontext_1new",
- "_1gtk_1image_1menu_1item_1new_1with_1label",
- "_1gtk_1image_1menu_1item_1set_1image",
"_1gtk_1image_1new",
"_1gtk_1image_1new_1from_1icon_1name",
"_1gtk_1image_1new_1from_1pixbuf",
@@ -625,7 +622,6 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1menu_1bar_1new",
"_1gtk_1menu_1item_1get_1submenu",
"_1gtk_1menu_1item_1new",
- "_1gtk_1menu_1item_1new_1with_1label",
"_1gtk_1menu_1item_1set_1submenu",
"_1gtk_1menu_1new",
"_1gtk_1menu_1popdown",
@@ -726,7 +722,6 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1radio_1button_1new",
"_1gtk_1radio_1menu_1item_1get_1group",
"_1gtk_1radio_1menu_1item_1new",
- "_1gtk_1radio_1menu_1item_1new_1with_1label",
"_1gtk_1range_1get_1adjustment",
"_1gtk_1range_1get_1slider_1range",
"_1gtk_1range_1set_1increments",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index 342e3d01db..ad1c1e902e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -372,7 +372,6 @@ typedef enum {
_1gtk_1check_1button_1new_FUNC,
_1gtk_1check_1menu_1item_1get_1active_FUNC,
_1gtk_1check_1menu_1item_1new_FUNC,
- _1gtk_1check_1menu_1item_1new_1with_1label_FUNC,
_1gtk_1check_1menu_1item_1set_1active_FUNC,
_1gtk_1check_1version_FUNC,
_1gtk_1clipboard_1clear_FUNC,
@@ -556,8 +555,6 @@ typedef enum {
_1gtk_1im_1context_1set_1cursor_1location_FUNC,
_1gtk_1im_1multicontext_1append_1menuitems_FUNC,
_1gtk_1im_1multicontext_1new_FUNC,
- _1gtk_1image_1menu_1item_1new_1with_1label_FUNC,
- _1gtk_1image_1menu_1item_1set_1image_FUNC,
_1gtk_1image_1new_FUNC,
_1gtk_1image_1new_1from_1icon_1name_FUNC,
_1gtk_1image_1new_1from_1pixbuf_FUNC,
@@ -623,7 +620,6 @@ typedef enum {
_1gtk_1menu_1bar_1new_FUNC,
_1gtk_1menu_1item_1get_1submenu_FUNC,
_1gtk_1menu_1item_1new_FUNC,
- _1gtk_1menu_1item_1new_1with_1label_FUNC,
_1gtk_1menu_1item_1set_1submenu_FUNC,
_1gtk_1menu_1new_FUNC,
_1gtk_1menu_1popdown_FUNC,
@@ -724,7 +720,6 @@ typedef enum {
_1gtk_1radio_1button_1new_FUNC,
_1gtk_1radio_1menu_1item_1get_1group_FUNC,
_1gtk_1radio_1menu_1item_1new_FUNC,
- _1gtk_1radio_1menu_1item_1new_1with_1label_FUNC,
_1gtk_1range_1get_1adjustment_FUNC,
_1gtk_1range_1get_1slider_1range_FUNC,
_1gtk_1range_1set_1increments_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
index b7e0009c61..8c9633dfe4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
@@ -1232,30 +1232,6 @@ public class GTK extends OS {
lock.unlock();
}
}
- /**
- * @method flags=dynamic
- * @param label cast=(const gchar *)
- */
- public static final native long /*int*/ _gtk_image_menu_item_new_with_label(byte[] label);
- /** [GTK2/GTK3; 3.10 deprecated] */
- public static final long /*int*/ gtk_image_menu_item_new_with_label(byte[] label) {
- lock.lock();
- try {
- return _gtk_image_menu_item_new_with_label(label);
- } finally {
- lock.unlock();
- }
- }
- /** @param label cast=(const gchar *) */
- public static final native long /*int*/ _gtk_check_menu_item_new_with_label(byte[] label);
- public static final long /*int*/ gtk_check_menu_item_new_with_label(byte[] label) {
- lock.lock();
- try {
- return _gtk_check_menu_item_new_with_label(label);
- } finally {
- lock.unlock();
- }
- }
public static final native long /*int*/ _gtk_check_menu_item_new();
public static final long /*int*/ gtk_check_menu_item_new() {
lock.lock();
@@ -3575,21 +3551,6 @@ public class GTK extends OS {
lock.unlock();
}
}
- /**
- * @method flags=dynamic
- * @param menu_item cast=(GtkImageMenuItem *)
- * @param image cast=(GtkWidget *)
- */
- public static final native void _gtk_image_menu_item_set_image(long /*int*/ menu_item, long /*int*/ image);
- /** [GTK2/GTK3; 3.10 deprecated] */
- public static final void gtk_image_menu_item_set_image(long /*int*/ menu_item, long /*int*/ image) {
- lock.lock();
- try {
- _gtk_image_menu_item_set_image(menu_item, image);
- } finally {
- lock.unlock();
- }
- }
public static final native long /*int*/ _gtk_image_new();
public static final long /*int*/ gtk_image_new() {
lock.lock();
@@ -4094,16 +4055,6 @@ public class GTK extends OS {
lock.unlock();
}
}
- /** @param label cast=(const gchar *) */
- public static final native long /*int*/ _gtk_menu_item_new_with_label(byte[] label);
- public static final long /*int*/ gtk_menu_item_new_with_label(byte[] label) {
- lock.lock();
- try {
- return _gtk_menu_item_new_with_label(label);
- } finally {
- lock.unlock();
- }
- }
public static final native long /*int*/ _gtk_menu_item_new();
public static final long /*int*/ gtk_menu_item_new() {
lock.lock();
@@ -5403,19 +5354,6 @@ public class GTK extends OS {
lock.unlock();
}
}
- /**
- * @param group cast=(GSList *)
- * @param label cast=(const gchar *)
- */
- public static final native long /*int*/ _gtk_radio_menu_item_new_with_label(long /*int*/ group, byte[] label);
- public static final long /*int*/ gtk_radio_menu_item_new_with_label(long /*int*/ group, byte[] label) {
- lock.lock();
- try {
- return _gtk_radio_menu_item_new_with_label(group, label);
- } finally {
- lock.unlock();
- }
- }
/** @param range cast=(GtkRange *) */
public static final native long /*int*/ _gtk_range_get_adjustment(long /*int*/ range);
public static final long /*int*/ gtk_range_get_adjustment(long /*int*/ range) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
index 51c70e956a..631eb905d6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
@@ -413,40 +413,35 @@ void createIMMenu (long /*int*/ imHandle) {
}
if (imItem == 0) {
byte[] buffer = Converter.wcsToMbcs (SWT.getMessage("SWT_InputMethods"), true);
- if (GTK.GTK3) {
- imItem = GTK.gtk_menu_item_new ();
- if (imItem == 0) error (SWT.ERROR_NO_HANDLES);
- long /*int*/ imageHandle = 0;
- long /*int*/ labelHandle = GTK.gtk_accel_label_new (buffer);
- if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
- if (GTK.GTK_VERSION >= OS.VERSION (3, 16, 0)) {
- GTK.gtk_label_set_xalign (labelHandle, 0);
- GTK.gtk_widget_set_halign (labelHandle, GTK.GTK_ALIGN_FILL);
- } else {
- GTK.gtk_misc_set_alignment(labelHandle, 0, 0);
- }
- long /*int*/ boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 0);
- if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
- if (OS.SWT_PADDED_MENU_ITEMS) {
- imageHandle = GTK.gtk_image_new();
- if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_image_set_pixel_size (imageHandle, 16);
- if (boxHandle != 0) {
- GTK.gtk_container_add (boxHandle, imageHandle);
- GTK.gtk_widget_show (imageHandle);
- }
- }
- if (labelHandle != 0 && boxHandle != 0) {
- GTK.gtk_box_pack_end (boxHandle, labelHandle, true, true, 0);
- GTK.gtk_widget_show (labelHandle);
- }
+ imItem = GTK.gtk_menu_item_new ();
+ if (imItem == 0) error (SWT.ERROR_NO_HANDLES);
+ long /*int*/ imageHandle = 0;
+ long /*int*/ labelHandle = GTK.gtk_accel_label_new (buffer);
+ if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ if (GTK.GTK_VERSION >= OS.VERSION (3, 16, 0)) {
+ GTK.gtk_label_set_xalign (labelHandle, 0);
+ GTK.gtk_widget_set_halign (labelHandle, GTK.GTK_ALIGN_FILL);
+ } else {
+ GTK.gtk_misc_set_alignment(labelHandle, 0, 0);
+ }
+ long /*int*/ boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 0);
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ if (OS.SWT_PADDED_MENU_ITEMS) {
+ imageHandle = GTK.gtk_image_new();
+ if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ GTK.gtk_image_set_pixel_size (imageHandle, 16);
if (boxHandle != 0) {
- GTK.gtk_container_add (imItem, boxHandle);
- GTK.gtk_widget_show (boxHandle);
+ GTK.gtk_container_add (boxHandle, imageHandle);
+ GTK.gtk_widget_show (imageHandle);
}
- } else {
- imItem = GTK.gtk_image_menu_item_new_with_label (buffer);
- if (imItem == 0) error (SWT.ERROR_NO_HANDLES);
+ }
+ if (labelHandle != 0 && boxHandle != 0) {
+ GTK.gtk_box_pack_end (boxHandle, labelHandle, true, true, 0);
+ GTK.gtk_widget_show (labelHandle);
+ }
+ if (boxHandle != 0) {
+ GTK.gtk_container_add (imItem, boxHandle);
+ GTK.gtk_widget_show (boxHandle);
}
GTK.gtk_widget_show (imItem);
GTK.gtk_menu_shell_insert (handle, imItem, -1);
@@ -1226,7 +1221,7 @@ void adjustParentWindowWayland (long /*int*/ eventPtr) {
* before it's about to be shown/popped-up
*/
void verifyMenuPosition (int itemCount) {
- if (GTK.GTK3 && OS.isX11()) {
+ if (OS.isX11()) {
if (itemCount != poppedUpCount && poppedUpCount != 0) {
int [] naturalHeight = new int [1];
/*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
index 2afc0d93f9..9b69a2b9c2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
@@ -288,84 +288,69 @@ void createHandle (int index) {
OS.g_object_ref (groupHandle);
OS.g_object_ref_sink (groupHandle);
long /*int*/ group = GTK.gtk_radio_menu_item_get_group (groupHandle);
- if (GTK.GTK3) {
- handle = GTK.gtk_radio_menu_item_new (group);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ handle = GTK.gtk_radio_menu_item_new (group);
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- labelHandle = GTK.gtk_accel_label_new (buffer);
- if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ labelHandle = GTK.gtk_accel_label_new (buffer);
+ if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
- boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 6);
- if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 6);
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
- if (OS.SWT_PADDED_MENU_ITEMS) {
- imageHandle = GTK.gtk_image_new ();
- if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
- }
- } else { // Gtk2
- handle = GTK.gtk_radio_menu_item_new_with_label (group, buffer);
+ if (OS.SWT_PADDED_MENU_ITEMS) {
+ imageHandle = GTK.gtk_image_new ();
+ if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
}
break;
case SWT.CHECK:
- if (GTK.GTK3) {
- handle = GTK.gtk_check_menu_item_new ();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ handle = GTK.gtk_check_menu_item_new ();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- labelHandle = GTK.gtk_accel_label_new (buffer);
- if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ labelHandle = GTK.gtk_accel_label_new (buffer);
+ if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
- boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 6);
- if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 6);
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
- if (OS.SWT_PADDED_MENU_ITEMS) {
- imageHandle = GTK.gtk_image_new ();
- if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
- }
- } else { // Gtk2
- handle = GTK.gtk_check_menu_item_new_with_label (buffer);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ if (OS.SWT_PADDED_MENU_ITEMS) {
+ imageHandle = GTK.gtk_image_new ();
+ if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
}
break;
// This case now needs to be handled due to double padding. When double padded
// menus are used, the "head" menu item (such as File, Edit, Help, etc.) should
// not be padded. We only care about this in Gtk3.
case SWT.CASCADE:
- if (GTK.GTK3) {
- handle = GTK.gtk_menu_item_new ();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ handle = GTK.gtk_menu_item_new ();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- labelHandle = GTK.gtk_accel_label_new (buffer);
- if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ labelHandle = GTK.gtk_accel_label_new (buffer);
+ if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
- boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 6);
- if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
- if ((parent.style & bits) == SWT.BAR) {
- break;
- }
- if (OS.SWT_PADDED_MENU_ITEMS) {
- imageHandle = GTK.gtk_image_new ();
- if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
- }
+ boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 6);
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ if ((parent.style & bits) == SWT.BAR) {
break;
}
+ if (OS.SWT_PADDED_MENU_ITEMS) {
+ imageHandle = GTK.gtk_image_new ();
+ if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ }
+ break;
case SWT.PUSH:
default:
- if (GTK.GTK3) {
- handle = GTK.gtk_menu_item_new ();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ handle = GTK.gtk_menu_item_new ();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- labelHandle = GTK.gtk_accel_label_new (buffer);
- if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ labelHandle = GTK.gtk_accel_label_new (buffer);
+ if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
- boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 6);
- if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 6);
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
- if (OS.SWT_PADDED_MENU_ITEMS) {
- imageHandle = GTK.gtk_image_new ();
- if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
- }
- } else { // Gtk2
- handle = GTK.gtk_image_menu_item_new_with_label (buffer);
+ if (OS.SWT_PADDED_MENU_ITEMS) {
+ imageHandle = GTK.gtk_image_new ();
+ if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
}
break;
}
@@ -864,53 +849,42 @@ public void setImage (Image image) {
imageList.put (imageIndex, image);
}
long /*int*/ pixbuf = imageList.getPixbuf (imageIndex);
- if (GTK.GTK3) {
- if (DPIUtil.useCairoAutoScale()) {
- Rectangle imgSize = image.getBounds();
- long /*int*/ scaledPixbuf = GDK.gdk_pixbuf_scale_simple(pixbuf, imgSize.width, imgSize.height, GDK.GDK_INTERP_BILINEAR);
- if (scaledPixbuf !=0) {
- pixbuf = scaledPixbuf;
- }
+ if (DPIUtil.useCairoAutoScale()) {
+ Rectangle imgSize = image.getBounds();
+ long /*int*/ scaledPixbuf = GDK.gdk_pixbuf_scale_simple(pixbuf, imgSize.width, imgSize.height, GDK.GDK_INTERP_BILINEAR);
+ if (scaledPixbuf !=0) {
+ pixbuf = scaledPixbuf;
}
+ }
- if (!GTK.GTK_IS_MENU_ITEM (handle)) return;
- if (OS.SWT_PADDED_MENU_ITEMS && imageHandle != 0) {
- GTK.gtk_image_set_from_pixbuf(imageHandle, pixbuf);
- } else {
- if (imageHandle == 0 && boxHandle != 0) {
- imageHandle = GTK.gtk_image_new_from_pixbuf (pixbuf);
- GTK.gtk_container_add (boxHandle, imageHandle);
- GTK.gtk_box_reorder_child (boxHandle, imageHandle, 0);
- } else {
- GTK.gtk_image_set_from_pixbuf(imageHandle, pixbuf);
- }
- if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
- }
+ if (!GTK.GTK_IS_MENU_ITEM (handle)) return;
+ if (OS.SWT_PADDED_MENU_ITEMS && imageHandle != 0) {
+ GTK.gtk_image_set_from_pixbuf(imageHandle, pixbuf);
} else {
- if (!GTK.GTK_IS_IMAGE_MENU_ITEM (handle)) return;
- imageHandle = GTK.gtk_image_new_from_pixbuf (pixbuf);
- GTK.gtk_image_menu_item_set_image (handle, imageHandle);
+ if (imageHandle == 0 && boxHandle != 0) {
+ imageHandle = GTK.gtk_image_new_from_pixbuf (pixbuf);
+ GTK.gtk_container_add (boxHandle, imageHandle);
+ GTK.gtk_box_reorder_child (boxHandle, imageHandle, 0);
+ } else {
+ GTK.gtk_image_set_from_pixbuf(imageHandle, pixbuf);
}
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ }
if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
GTK.gtk_widget_show (imageHandle);
} else {
- if (GTK.GTK3) {
- if (imageHandle != 0 && boxHandle != 0) {
- if (OS.SWT_PADDED_MENU_ITEMS) {
- GTK.gtk_container_remove(boxHandle, imageHandle);
- imageHandle = GTK.gtk_image_new ();
- if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_image_set_pixel_size (imageHandle, 16);
- GTK.gtk_container_add (boxHandle, imageHandle);
- GTK.gtk_widget_show (imageHandle);
- } else {
- GTK.gtk_container_remove(boxHandle, imageHandle);
- imageHandle = 0;
- }
+ if (imageHandle != 0 && boxHandle != 0) {
+ if (OS.SWT_PADDED_MENU_ITEMS) {
+ GTK.gtk_container_remove(boxHandle, imageHandle);
+ imageHandle = GTK.gtk_image_new ();
+ if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ GTK.gtk_image_set_pixel_size (imageHandle, 16);
+ GTK.gtk_container_add (boxHandle, imageHandle);
+ GTK.gtk_widget_show (imageHandle);
+ } else {
+ GTK.gtk_container_remove(boxHandle, imageHandle);
+ imageHandle = 0;
}
- } else {
- if (!GTK.GTK_IS_IMAGE_MENU_ITEM (handle)) return;
- GTK.gtk_image_menu_item_set_image (handle, 0);
}
}
}
@@ -1072,22 +1046,15 @@ public void setText (String string) {
}
char [] chars = fixMnemonic (string);
byte [] buffer = Converter.wcsToMbcs (chars, true);
- if (boxHandle == 0 && !GTK.GTK3) {
- labelHandle = GTK.gtk_bin_get_child (handle);
- }
if (labelHandle != 0 && GTK.GTK_IS_LABEL (labelHandle)) {
GTK.gtk_label_set_text_with_mnemonic (labelHandle, buffer);
if (GTK.GTK_IS_ACCEL_LABEL (labelHandle)) {
- if (GTK.GTK3) {
- if (GTK.GTK_VERSION >= OS.VERSION(3, 6, 0)) {
- MaskKeysym maskKeysym = getMaskKeysym();
- if (maskKeysym != null) {
- GTK.gtk_accel_label_set_accel_widget (labelHandle, handle);
- GTK.gtk_accel_label_set_accel (labelHandle,
- maskKeysym.keysym, maskKeysym.mask);
- }
- } else {
- setAccelLabel (labelHandle, accelString);
+ if (GTK.GTK_VERSION >= OS.VERSION(3, 6, 0)) {
+ MaskKeysym maskKeysym = getMaskKeysym();
+ if (maskKeysym != null) {
+ GTK.gtk_accel_label_set_accel_widget (labelHandle, handle);
+ GTK.gtk_accel_label_set_accel (labelHandle,
+ maskKeysym.keysym, maskKeysym.mask);
}
} else {
setAccelLabel (labelHandle, accelString);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
index 54ac00d83c..9ebb9ed2f5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
@@ -580,14 +580,6 @@ long /*int*/ gtk_create_menu_proxy (long /*int*/ widget) {
long /*int*/ pixbuf = imageList.getPixbuf (index);
byte[] label = null;
int [] showImages = new int []{1};
- long /*int*/ settings = GTK.gtk_settings_get_default();
- if (settings != 0) {
- if (!GTK.GTK3) {
- long /*int*/ property = OS.g_object_class_find_property(OS.G_OBJECT_GET_CLASS(settings), GTK.gtk_menu_images);
- if (property != 0) OS.g_object_get (settings, GTK.gtk_menu_images, showImages, 0);
- }
- }
-
/*
* GTK tool items with only image appear as blank items
* in overflow menu when the system property "gtk-menu-images"
@@ -606,38 +598,27 @@ long /*int*/ gtk_create_menu_proxy (long /*int*/ widget) {
else {
label = Converter.wcsToMbcs(text, true);
}
- long /*int*/ menuItem;
- if (GTK.GTK3) {
-
- menuItem = GTK.gtk_menu_item_new ();
- if (menuItem == 0) error (SWT.ERROR_NO_HANDLES);
-
- long /*int*/ boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 6);
- if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
-
- long /*int*/ menuLabel = GTK.gtk_accel_label_new (label);
- if (menuLabel == 0) error (SWT.ERROR_NO_HANDLES);
- if (GTK.GTK_VERSION >= OS.VERSION (3, 16, 0)) {
- GTK.gtk_label_set_xalign (labelHandle, 0);
- GTK.gtk_widget_set_halign (labelHandle, GTK.GTK_ALIGN_FILL);
- } else {
- GTK.gtk_misc_set_alignment(labelHandle, 0, 0);
- }
+ long /*int*/ menuItem = GTK.gtk_menu_item_new ();
+ if (menuItem == 0) error (SWT.ERROR_NO_HANDLES);
- long /*int*/ menuImage = GTK.gtk_image_new_from_pixbuf (pixbuf);
- if (menuImage == 0) error (SWT.ERROR_NO_HANDLES);
+ long /*int*/ boxHandle = gtk_box_new (GTK.GTK_ORIENTATION_HORIZONTAL, false, 6);
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_container_add (boxHandle, menuImage);
- GTK.gtk_box_pack_end (boxHandle, menuLabel, true, true, 0);
- GTK.gtk_container_add (menuItem, boxHandle);
+ long /*int*/ menuLabel = GTK.gtk_accel_label_new (label);
+ if (menuLabel == 0) error (SWT.ERROR_NO_HANDLES);
+ if (GTK.GTK_VERSION >= OS.VERSION (3, 16, 0)) {
+ GTK.gtk_label_set_xalign (labelHandle, 0);
+ GTK.gtk_widget_set_halign (labelHandle, GTK.GTK_ALIGN_FILL);
} else {
- menuItem = GTK.gtk_image_menu_item_new_with_label (label);
- if (menuItem == 0) error (SWT.ERROR_NO_HANDLES);
-
- long /*int*/ menuImage = GTK.gtk_image_new_from_pixbuf (pixbuf);
- if (menuImage == 0) error (SWT.ERROR_NO_HANDLES);
- GTK.gtk_image_menu_item_set_image (menuItem, menuImage);
+ GTK.gtk_misc_set_alignment(labelHandle, 0, 0);
}
+
+ long /*int*/ menuImage = GTK.gtk_image_new_from_pixbuf (pixbuf);
+ if (menuImage == 0) error (SWT.ERROR_NO_HANDLES);
+
+ GTK.gtk_container_add (boxHandle, menuImage);
+ GTK.gtk_box_pack_end (boxHandle, menuLabel, true, true, 0);
+ GTK.gtk_container_add (menuItem, boxHandle);
GTK.gtk_tool_item_set_proxy_menu_item (widget, buffer, menuItem);
/*

Back to the top