summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-10-04 14:58:50 -0400
committerAnatoly Spektor <aspektor@redhat.com>2012-10-04 14:58:50 -0400
commit7f677c4646e9ce3d2723f5e0c2995d4395e4d294 (patch)
tree0ed12c7df20349cef2f25ab9a527df19286aed45
parentbb4e83381b7dcfcdda6368f29494e85d7a1bdec8 (diff)
downloadeclipse.platform.swt-gtk3_progressbar_orientation_64.tar.gz
eclipse.platform.swt-gtk3_progressbar_orientation_64.tar.xz
eclipse.platform.swt-gtk3_progressbar_orientation_64.zip
Use gtk_orientable_set_orientation and progressbar_inverted for GTK+ 3gtk3_progressbar_orientation_64
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ProgressBarDrawData.java21
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java19
7 files changed, 83 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 41591d00eb..867d31aee3 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
@@ -12431,12 +12431,38 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1progress_1bar_1set_1fraction)
}
#endif
+#ifndef NO__1gtk_1progress_1bar_1set_1inverted
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1progress_1bar_1set_1inverted)
+ (JNIEnv *env, jclass that, jintLong arg0, jboolean arg1)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1progress_1bar_1set_1inverted_FUNC);
+/*
+ gtk_progress_bar_set_inverted((GtkProgressBar *)arg0, (gboolean)arg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_progress_bar_set_inverted)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkProgressBar *, gboolean))fp)((GtkProgressBar *)arg0, (gboolean)arg1);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1progress_1bar_1set_1inverted_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1progress_1bar_1set_1orientation
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1progress_1bar_1set_1orientation)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1)
{
OS_NATIVE_ENTER(env, that, _1gtk_1progress_1bar_1set_1orientation_FUNC);
- gtk_progress_bar_set_orientation((GtkProgressBar *)arg0, (GtkProgressBarOrientation)arg1);
+/*
+ gtk_progress_bar_set_orientation((GtkProgressBar *)arg0, arg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_progress_bar_set_orientation)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkProgressBar *, jint))fp)((GtkProgressBar *)arg0, arg1);
+ }
+ }
OS_NATIVE_EXIT(env, that, _1gtk_1progress_1bar_1set_1orientation_FUNC);
}
#endif
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 e93874f469..d4be088725 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
@@ -367,6 +367,8 @@
#define gtk_printer_get_backend_LIB LIB_GTK
#define gtk_printer_get_name_LIB LIB_GTK
#define gtk_printer_is_default_LIB LIB_GTK
+#define gtk_progress_bar_set_inverted_LIB LIB_GTK
+#define gtk_progress_bar_set_orientation_LIB LIB_GTK
#define ubuntu_menu_proxy_get_LIB LIB_GTK
#define FcConfigAppFontAddFile_LIB LIB_FONTCONFIG
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 93ada249c5..51c3c32379 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
@@ -929,6 +929,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1progress_1bar_1new",
"_1gtk_1progress_1bar_1pulse",
"_1gtk_1progress_1bar_1set_1fraction",
+ "_1gtk_1progress_1bar_1set_1inverted",
"_1gtk_1progress_1bar_1set_1orientation",
"_1gtk_1radio_1button_1get_1group",
"_1gtk_1radio_1button_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 a387f15493..84c09ff0ff 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
@@ -939,6 +939,7 @@ typedef enum {
_1gtk_1progress_1bar_1new_FUNC,
_1gtk_1progress_1bar_1pulse_FUNC,
_1gtk_1progress_1bar_1set_1fraction_FUNC,
+ _1gtk_1progress_1bar_1set_1inverted_FUNC,
_1gtk_1progress_1bar_1set_1orientation_FUNC,
_1gtk_1radio_1button_1get_1group_FUNC,
_1gtk_1radio_1button_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 1e5aa121aa..1b35784eff 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
@@ -9267,8 +9267,22 @@ public static final void gtk_progress_bar_set_fraction(long /*int*/ pbar, double
}
}
/**
+ * @method flags=dynamic
+ * @param pbar cast=(GtkProgressBar *)
+ * @param inverted cast=(gboolean)
+ */
+public static final native void _gtk_progress_bar_set_inverted(long /*int*/ pbar, boolean inverted);
+public static final void gtk_progress_bar_set_inverted(long /*int*/ pbar, boolean inverted) {
+ lock.lock();
+ try {
+ _gtk_progress_bar_set_inverted(pbar, inverted);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @method flags=dynamic
* @param pbar cast=(GtkProgressBar *)
- * @param orientation cast=(GtkProgressBarOrientation)
*/
public static final native void _gtk_progress_bar_set_orientation(long /*int*/ pbar, int orientation);
public static final void gtk_progress_bar_set_orientation(long /*int*/ pbar, int orientation) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ProgressBarDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ProgressBarDrawData.java
index e3b843bf25..8103b29919 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ProgressBarDrawData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ProgressBarDrawData.java
@@ -32,14 +32,14 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
int xthichness = OS.gtk_style_get_xthickness(gtkStyle);
int ythichness = OS.gtk_style_get_ythickness(gtkStyle);
if ((style & SWT.VERTICAL) != 0) {
- OS.gtk_progress_bar_set_orientation(progressHandle, OS.GTK_PROGRESS_BOTTOM_TO_TOP);
+ gtk_orientable_set_orientation (progressHandle, OS.GTK_PROGRESS_BOTTOM_TO_TOP);
x += xthichness;
width -= xthichness * 2;
height -= ythichness * 2;
height *= selection / (float)Math.max(1, (maximum - minimum));
y += bounds.height - ythichness - height;
} else {
- OS.gtk_progress_bar_set_orientation(progressHandle, OS.GTK_PROGRESS_LEFT_TO_RIGHT);
+ gtk_orientable_set_orientation (progressHandle, OS.GTK_PROGRESS_LEFT_TO_RIGHT);
x += xthichness;
y += ythichness;
width -= xthichness * 2;
@@ -58,4 +58,21 @@ int hit(Theme theme, Point position, Rectangle bounds) {
return bounds.contains(position) ? DrawData.WIDGET_WHOLE : DrawData.WIDGET_NOWHERE;
}
+void gtk_orientable_set_orientation (long /*int*/ pbar, int orientation) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ switch (orientation) {
+ case OS.GTK_PROGRESS_BOTTOM_TO_TOP:
+ OS.gtk_orientable_set_orientation(pbar, OS.GTK_ORIENTATION_VERTICAL);
+ OS.gtk_progress_bar_set_inverted(pbar, true);
+ break;
+ case OS.GTK_PROGRESS_LEFT_TO_RIGHT:
+ OS.gtk_orientable_set_orientation(pbar, OS.GTK_ORIENTATION_HORIZONTAL);
+ OS.gtk_progress_bar_set_inverted(pbar, false);
+ break;
+ }
+ } else {
+ OS.gtk_progress_bar_set_orientation(pbar, orientation);
+ }
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
index 69559df1f7..5c8c5373b6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
@@ -88,7 +88,7 @@ void createHandle (int index) {
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
OS.gtk_container_add (fixedHandle, handle);
int orientation = (style & SWT.VERTICAL) != 0 ? OS.GTK_PROGRESS_BOTTOM_TO_TOP : OS.GTK_PROGRESS_LEFT_TO_RIGHT;
- OS.gtk_progress_bar_set_orientation (handle, orientation);
+ gtk_orientable_set_orientation (handle, orientation);
if ((style & SWT.INDETERMINATE) != 0) {
timerId = OS.g_timeout_add (DELAY, display.windowTimerProc, handle);
}
@@ -302,4 +302,21 @@ void updateBar (int selection, int minimum, int maximum) {
OS.gdk_window_process_updates (window, false);
OS.gdk_flush ();
}
+
+void gtk_orientable_set_orientation (long /*int*/ pbar, int orientation) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ switch (orientation) {
+ case OS.GTK_PROGRESS_BOTTOM_TO_TOP:
+ OS.gtk_orientable_set_orientation(pbar, OS.GTK_ORIENTATION_VERTICAL);
+ OS.gtk_progress_bar_set_inverted(pbar, true);
+ break;
+ case OS.GTK_PROGRESS_LEFT_TO_RIGHT:
+ OS.gtk_orientable_set_orientation(pbar, OS.GTK_ORIENTATION_HORIZONTAL);
+ OS.gtk_progress_bar_set_inverted(pbar, false);
+ break;
+ }
+ } else {
+ OS.gtk_progress_bar_set_orientation(pbar, orientation);
+ }
+}
}