diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-10-15 15:32:21 -0400 |
---|---|---|
committer | Alexander Kurtakov <akurtako@redhat.com> | 2012-10-16 12:00:30 +0300 |
commit | 8292090fe3ef8e634ba254763ccf7af619dd517a (patch) | |
tree | f11645fd3e81220fa666572adbbbbbc8e790fd58 /bundles/org.eclipse.swt/Eclipse SWT Theme | |
parent | 801ec1483559446c0d86f80fed29f2453a706def (diff) | |
download | eclipse.platform.swt-8292090fe3ef8e634ba254763ccf7af619dd517a.tar.gz eclipse.platform.swt-8292090fe3ef8e634ba254763ccf7af619dd517a.tar.xz eclipse.platform.swt-8292090fe3ef8e634ba254763ccf7af619dd517a.zip |
Use gtk_render_arrow instead of gtk_paint_arrow for GTK+ 3
This patch replace gtk_paint_arrow with gtk_render_arrow for GTK+ 3
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Theme')
3 files changed, 36 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ComboDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ComboDrawData.java index 1bd41ea0cf..1ebc81c9aa 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ComboDrawData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ComboDrawData.java @@ -62,7 +62,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) { } byte[] arrow_detail = Converter.wcsToMbcs(null, "arrow", true); long /*int*/ arrowHandle = theme.arrowHandle; - OS.gtk_paint_arrow(gtkStyle, drawable, state_type, OS.GTK_SHADOW_OUT, null, arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height); + gtk_render_arrow (gtkStyle, drawable, state_type, OS.GTK_SHADOW_OUT, null, arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height); long /*int*/ entryHandle = theme.entryHandle; gtkStyle = OS.gtk_widget_get_style(entryHandle); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java index 8d7d44216b..2212fea8d1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java @@ -241,4 +241,38 @@ void gtk_render_focus (long /*int*/ style, long /*int*/ window, int state_type, } } +void gtk_render_arrow(long /*int*/ style, long /*int*/ window, int state_type, int shadow_type, GdkRectangle area, long /*int*/ widget, byte[] detail, int arrow_type, boolean fill, int x, int y, int width, int height) { + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + double angle = 0; + double size = 0; + switch (arrow_type) { + case OS.GTK_ARROW_UP: + angle = 0; + size = width; + break; + case OS.GTK_ARROW_RIGHT: + angle = Math.PI/2; + size = height; + break; + case OS.GTK_ARROW_DOWN: + angle = Math.PI; + size = width; + break; + case OS.GTK_ARROW_LEFT: + angle = (3 * Math.PI)/2; + size = height; + break; + } + long /*int*/ cairo = OS.gdk_cairo_create (window); + long /*int*/ context = OS.gtk_widget_get_style_context (style); + OS.gtk_style_context_set_state(context, state_type); + OS.gtk_render_background(context, cairo, x, y, width, height); + OS.gtk_render_frame (context, cairo, x, y, width, height); + OS.gtk_render_arrow(context, cairo, angle, x, y, size); + Cairo.cairo_destroy(cairo); + } else { + OS.gtk_paint_arrow(style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height); + } +} + } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java index adb13f8c95..f3b4ee27c8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java @@ -125,7 +125,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) { if (interior_focus == 0) arrow_x -= focus_line_width; int arrow_y = y + (height - arrow_height) / 2; byte[] arrow_detail = Converter.wcsToMbcs(null, "arrow", true); - OS.gtk_paint_arrow(gtkStyle, drawable, state_type, OS.GTK_SHADOW_NONE, null, theme.arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height); + gtk_render_arrow (gtkStyle, drawable, state_type, OS.GTK_SHADOW_NONE, null, theme.arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height); if (clientArea != null) { clientArea.width -= bounds.x + bounds.width - arrow_x; } |