diff options
6 files changed, 49 insertions, 5 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 0a0a201990..b796a706e0 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 @@ -9392,6 +9392,24 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1combo_1box_1text_1new_1with_1entry) } #endif +#ifndef NO__1gtk_1combo_1box_1text_1remove +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1combo_1box_1text_1remove) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1combo_1box_1text_1remove_FUNC); +/* + gtk_combo_box_text_remove(arg0, arg1); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_combo_box_text_remove) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, jint))fp)(arg0, arg1); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1combo_1box_1text_1remove_FUNC); +} +#endif + #ifndef NO__1gtk_1combo_1box_1text_1remove_1all JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1combo_1box_1text_1remove_1all) (JNIEnv *env, jclass that, jintLong arg0) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h index 27edf6cd35..79e8a088f1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h @@ -126,6 +126,7 @@ #define gtk_combo_box_text_insert_LIB LIB_GTK #define gtk_combo_box_insert_text_LIB LIB_GTK #define gtk_combo_box_remove_text_LIB LIB_GTK +#define gtk_combo_box_text_remove_LIB LIB_GTK #define gtk_combo_box_text_remove_all_LIB LIB_GTK #define gtk_combo_box_get_active_LIB LIB_GTK #define gtk_combo_box_get_model_LIB LIB_GTK 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 55c083309d..b6f21a5d6c 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 @@ -692,6 +692,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1combo_1box_1text_1insert", "_1gtk_1combo_1box_1text_1new", "_1gtk_1combo_1box_1text_1new_1with_1entry", + "_1gtk_1combo_1box_1text_1remove", "_1gtk_1combo_1box_1text_1remove_1all", "_1gtk_1container_1add", "_1gtk_1container_1forall", 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 4ce23cf058..c503d9c53d 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 @@ -702,6 +702,7 @@ typedef enum { _1gtk_1combo_1box_1text_1insert_FUNC, _1gtk_1combo_1box_1text_1new_FUNC, _1gtk_1combo_1box_1text_1new_1with_1entry_FUNC, + _1gtk_1combo_1box_1text_1remove_FUNC, _1gtk_1combo_1box_1text_1remove_1all_FUNC, _1gtk_1container_1add_FUNC, _1gtk_1container_1forall_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java index 68b288c4db..7cb76acae1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java @@ -6694,6 +6694,16 @@ public static final void gtk_combo_box_remove_text(long /*int*/ combo_box, int p } } /** @method flags=dynamic */ +public static final native void _gtk_combo_box_text_remove(long /*int*/ combo_box, int position); +public static final void gtk_combo_box_text_remove(long /*int*/ combo_box, int position) { + lock.lock(); + try { + _gtk_combo_box_text_remove(combo_box, position); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ public static final native void _gtk_combo_box_text_remove_all(long /*int*/ combo_box); public static final void gtk_combo_box_text_remove_all(long /*int*/ combo_box) { lock.lock(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java index 37911f44b5..f25aeb9047 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java @@ -1540,7 +1540,11 @@ public void remove (int index) { System.arraycopy (oldItems, index + 1, newItems, index, oldItems.length - index - 1); items = newItems; if (OS.gtk_combo_box_get_active (handle) == index) clearText (); - OS.gtk_combo_box_remove_text (handle, index); + if (OS.GTK3) { + OS.gtk_combo_box_text_remove(handle, index); + } else { + OS.gtk_combo_box_remove_text (handle, index); + } } /** @@ -1573,7 +1577,11 @@ public void remove (int start, int end) { int index = OS.gtk_combo_box_get_active (handle); if (start <= index && index <= end) clearText(); for (int i = end; i >= start; i--) { - OS.gtk_combo_box_remove_text (handle, i); + if (OS.GTK3) { + OS.gtk_combo_box_text_remove(handle, index); + } else { + OS.gtk_combo_box_remove_text (handle, i); + } } } @@ -1615,8 +1623,12 @@ public void removeAll () { int count = items.length; items = new String[0]; clearText (); - for (int i = count - 1; i >= 0; i--) { - OS.gtk_combo_box_remove_text (handle, i); + if (OS.GTK3) { + OS.gtk_combo_box_text_remove_all(handle); + } else { + for (int i = count - 1; i >= 0; i--) { + OS.gtk_combo_box_remove_text (handle, i); + } } } @@ -1823,10 +1835,11 @@ public void setItem (int index, String string) { } items [index] = string; byte [] buffer = Converter.wcsToMbcs (null, string, true); - OS.gtk_combo_box_remove_text (handle, index); if (OS.GTK3) { + OS.gtk_combo_box_text_remove (handle, index); OS.gtk_combo_box_text_insert (handle, index, null, buffer); } else { + OS.gtk_combo_box_remove_text (handle, index); OS.gtk_combo_box_insert_text (handle, index, buffer); } if ((style & SWT.RIGHT_TO_LEFT) != 0 && popupHandle != 0) { |