diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-10-03 14:03:05 -0400 |
---|---|---|
committer | Alexander Kurtakov <akurtako@redhat.com> | 2012-10-03 21:43:46 +0300 |
commit | a025bf9445abd24cfb0807a29038b2face3f0f8a (patch) | |
tree | ec66fae1d5dadbc860b4edcc055b7b518c676827 /bundles/org.eclipse.swt/Eclipse SWT Theme | |
parent | bb4e83381b7dcfcdda6368f29494e85d7a1bdec8 (diff) | |
download | eclipse.platform.swt-a025bf9445abd24cfb0807a29038b2face3f0f8a.tar.gz eclipse.platform.swt-a025bf9445abd24cfb0807a29038b2face3f0f8a.tar.xz eclipse.platform.swt-a025bf9445abd24cfb0807a29038b2face3f0f8a.zip |
Use gtk_orientable_set_orientation and progressbar_inverted for GTK+ 3
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Theme')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ProgressBarDrawData.java | 21 |
1 files changed, 19 insertions, 2 deletions
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..1590302173 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); + } +} + } |