diff options
author | Anatoly Spektor | 2012-08-29 15:13:23 +0000 |
---|---|---|
committer | Arun Thondapu | 2012-09-06 18:17:09 +0000 |
commit | db6db832125b06d5c2116be77f9ab1e8c3df7b1b (patch) | |
tree | 5cb54d8f26fc72e027d1b13629afe59f187d93c7 | |
parent | 6e60699d5dc28f66b62a845bf0b1a57aa83c551a (diff) | |
download | eclipse.platform.swt-db6db832125b06d5c2116be77f9ab1e8c3df7b1b.tar.gz eclipse.platform.swt-db6db832125b06d5c2116be77f9ab1e8c3df7b1b.tar.xz eclipse.platform.swt-db6db832125b06d5c2116be77f9ab1e8c3df7b1b.zip |
Use gtk_scale_new() in Gtk+3
6 files changed, 82 insertions, 8 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 bb0c2a9d0b..bb146c300b 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 @@ -9469,7 +9469,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1hscale_1new) { jintLong rc = 0; OS_NATIVE_ENTER(env, that, _1gtk_1hscale_1new_FUNC); +/* rc = (jintLong)gtk_hscale_new((GtkAdjustment *)arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_hscale_new) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkAdjustment *))fp)((GtkAdjustment *)arg0); + } + } OS_NATIVE_EXIT(env, that, _1gtk_1hscale_1new_FUNC); return rc; } @@ -12325,6 +12333,26 @@ fail: } #endif +#ifndef NO__1gtk_1scale_1new +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1scale_1new) + (JNIEnv *env, jclass that, jint arg0, jintLong arg1) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1scale_1new_FUNC); +/* + rc = (jintLong)gtk_scale_new((GtkOrientation)arg0, (GtkAdjustment *)arg1); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_scale_new) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkOrientation, GtkAdjustment *))fp)((GtkOrientation)arg0, (GtkAdjustment *)arg1); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1scale_1new_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1scale_1set_1digits JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1scale_1set_1digits) (JNIEnv *env, jclass that, jintLong arg0, jint arg1) @@ -15423,7 +15451,15 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1vscale_1new) { jintLong rc = 0; OS_NATIVE_ENTER(env, that, _1gtk_1vscale_1new_FUNC); +/* rc = (jintLong)gtk_vscale_new((GtkAdjustment *)arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_vscale_new) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkAdjustment *))fp)((GtkAdjustment *)arg0); + } + } OS_NATIVE_EXIT(env, that, _1gtk_1vscale_1new_FUNC); return rc; } 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 7e7847971a..5bfcd14321 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 @@ -190,6 +190,9 @@ #define gdk_pixbuf_render_to_drawable_LIB LIB_GDK #define gtk_scrolled_window_get_hscrollbar_LIB LIB_GTK #define gtk_scrolled_window_get_vscrollbar_LIB LIB_GTK +#define gtk_scale_new_LIB LIB_GTK +#define gtk_hscale_new_LIB LIB_GTK +#define gtk_vscale_new_LIB LIB_GTK #define gtk_status_icon_get_geometry_LIB LIB_GTK #define gtk_status_icon_get_visible_LIB LIB_GTK #define gtk_status_icon_new_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 84a09fcd6b..61d1c21183 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 @@ -18,8 +18,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 1335; -int OS_nativeFunctionCallCount[1335]; +int OS_nativeFunctionCount = 1337; +int OS_nativeFunctionCallCount[1337]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -938,6 +938,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1rc_1style_1set_1color_1flags", "_1gtk_1rc_1style_1set_1fg", "_1gtk_1rc_1style_1set_1text", + "_1gtk_1scale_1new", "_1gtk_1scale_1set_1digits", "_1gtk_1scale_1set_1draw_1value", "_1gtk_1scrollbar_1new", 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 b8f5863797..d54839c119 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 @@ -946,6 +946,7 @@ typedef enum { _1gtk_1rc_1style_1set_1color_1flags_FUNC, _1gtk_1rc_1style_1set_1fg_FUNC, _1gtk_1rc_1style_1set_1text_FUNC, + _1gtk_1scale_1new_FUNC, _1gtk_1scale_1set_1digits_FUNC, _1gtk_1scale_1set_1draw_1value_FUNC, _1gtk_1scrollbar_1new_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 beeb4bfe2f..7b4107013d 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 @@ -7129,7 +7129,10 @@ public static final int /*long*/ gtk_hbox_new(boolean homogeneous, int spacing) lock.unlock(); } } -/** @param adjustment cast=(GtkAdjustment *) */ +/** + * @method flags=dynamic + * @param adjustment cast=(GtkAdjustment *) + */ public static final native int /*long*/ _gtk_hscale_new(int /*long*/ adjustment); public static final int /*long*/ gtk_hscale_new(int /*long*/ adjustment) { lock.lock(); @@ -7140,9 +7143,23 @@ public static final int /*long*/ gtk_hscale_new(int /*long*/ adjustment) { } } /** - * @method flags=dynamic - * @param adjustment cast=(GtkAdjustment *) + * @method flags=dynamic + * @param orientation cast=(GtkOrientation) + * @param adjustment cast=(GtkAdjustment *) */ +public static final native int /*long*/ _gtk_scale_new(int orientation, int /*long*/ adjustment); +public static final int /*long*/ gtk_scale_new(int orientation, int /*long*/ adjustment) { + lock.lock(); + try { + return _gtk_scale_new(orientation, adjustment); + } finally { + lock.unlock(); + } +} +/** +* @method flags=dynamic +* @param adjustment cast=(GtkAdjustment *) +*/ public static final native int /*long*/ _gtk_hscrollbar_new(int /*long*/ adjustment); public static final int /*long*/ gtk_hscrollbar_new(int /*long*/ adjustment) { lock.lock(); @@ -12063,7 +12080,10 @@ public static final void gtk_viewport_set_shadow_type(int /*long*/ viewport, int lock.unlock(); } } -/** @param adjustment cast=(GtkAdjustment *) */ +/** + * @method flags=dynamic + * @param adjustment cast=(GtkAdjustment *) + */ public static final native int /*long*/ _gtk_vscale_new(int /*long*/ adjustment); public static final int /*long*/ gtk_vscale_new(int /*long*/ adjustment) { lock.lock(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java index 79d7416dd9..2218cbcf9e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java @@ -129,9 +129,9 @@ void createHandle (int index) { int /*long*/ hAdjustment = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 0); if (hAdjustment == 0) error (SWT.ERROR_NO_HANDLES); if ((style & SWT.HORIZONTAL) != 0) { - handle = OS.gtk_hscale_new (hAdjustment); + handle = gtk_scale_new (OS.GTK_ORIENTATION_HORIZONTAL, hAdjustment); } else { - handle = OS.gtk_vscale_new (hAdjustment); + handle = gtk_scale_new (OS.GTK_ORIENTATION_VERTICAL, hAdjustment); } if (handle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (fixedHandle, handle); @@ -373,4 +373,17 @@ public void setSelection (int value) { OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED); } +int /*long*/ gtk_scale_new (int orientation, int /*long*/ adjustment) { + int /*long*/ scale = 0; + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + scale = OS.gtk_scale_new (orientation, adjustment); + } else { + if (orientation == OS.GTK_ORIENTATION_HORIZONTAL) { + scale = OS.gtk_hscale_new (adjustment); + } else if (orientation == OS.GTK_ORIENTATION_VERTICAL) { + scale = OS.gtk_vscale_new (adjustment); + } + } + return scale; +} } |