summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorAnatoly Spektor2012-10-03 14:03:05 (EDT)
committer Alexander Kurtakov2012-10-03 14:43:46 (EDT)
commita025bf9445abd24cfb0807a29038b2face3f0f8a (patch)
treeec66fae1d5dadbc860b4edcc055b7b518c676827
parentbb4e83381b7dcfcdda6368f29494e85d7a1bdec8 (diff)
downloadeclipse.platform.swt-a025bf9445abd24cfb0807a29038b2face3f0f8a.zip
eclipse.platform.swt-a025bf9445abd24cfb0807a29038b2face3f0f8a.tar.gz
eclipse.platform.swt-a025bf9445abd24cfb0807a29038b2face3f0f8a.tar.bz2
Use gtk_orientable_set_orientation and progressbar_inverted for GTK+ 3
-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 41591d0..867d31a 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 e93874f..d4be088 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 93ada24..51c3c32 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 a387f15..84c09ff 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 1e5aa12..1b35784 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 e3b843b..1590302 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 69559df..3ac8cd8 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);
+ }
+}
}