summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT Theme
diff options
context:
space:
mode:
authorAnatoly Spektor <aspektor@redhat.com>2012-10-15 16:56:17 -0400
committerAlexander Kurtakov <akurtako@redhat.com>2012-10-16 15:41:13 +0300
commit4d14d1d7f1ee27438fcb7cae794de91c14605b9e (patch)
treee8c3d0d60381835dfe8e3a0753d458c50827c08d /bundles/org.eclipse.swt/Eclipse SWT Theme
parent712033c25326bef959a86e71f285bbe0ad256c16 (diff)
downloadeclipse.platform.swt-4d14d1d7f1ee27438fcb7cae794de91c14605b9e.tar.gz
eclipse.platform.swt-4d14d1d7f1ee27438fcb7cae794de91c14605b9e.tar.xz
eclipse.platform.swt-4d14d1d7f1ee27438fcb7cae794de91c14605b9e.zip
Use gtk_render_frame* instead of gtk_paint_shadow* for GTK+ 3
This patch uses gtk_render_frame and gtk_render_frame_gap instead of gtk_paint_shadow and gtk_paint_shadow_gap
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/ComboDrawData.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/GroupDrawData.java15
2 files changed, 28 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 1ebc81c9aa..ec12e88c13 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
@@ -12,6 +12,7 @@ package org.eclipse.swt.internal.theme;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.cairo.Cairo;
import org.eclipse.swt.internal.gtk.*;
public class ComboDrawData extends DrawData {
@@ -69,7 +70,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
theme.transferClipping(gc, gtkStyle);
state_type = getStateType(DrawData.WIDGET_WHOLE);
byte[] detail = Converter.wcsToMbcs(null, "entry", true);
- OS.gtk_paint_shadow(gtkStyle, drawable, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_IN, null, entryHandle, detail, x, y, width - arrow_button_width, height);
+ gtk_render_shadow (gtkStyle, drawable, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_IN, null, entryHandle, detail, x, y, width - arrow_button_width, height);
xthickness = OS.gtk_style_get_xthickness(gtkStyle);
ythickness = OS.gtk_style_get_xthickness(gtkStyle);
x += xthickness;
@@ -122,4 +123,16 @@ int hit(Theme theme, Point position, Rectangle bounds) {
return DrawData.WIDGET_WHOLE;
}
+void gtk_render_shadow(long /*int*/ style, long /*int*/ window, int state_type, int shadow_type, GdkRectangle area, long /*int*/ widget, byte[] detail, int x , int y, int width, int height) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ long /*int*/ cairo = OS.gdk_cairo_create (window);
+ long /*int*/ context = OS.gtk_widget_get_style_context (style);
+ OS.gtk_style_context_save(context);
+ OS.gtk_style_context_set_state (style, state_type);
+ OS.gtk_render_frame (context, cairo, x, y, width, height);
+ Cairo.cairo_destroy (cairo);
+ } else {
+ OS.gtk_paint_shadow(style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
+ }
+}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/GroupDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/GroupDrawData.java
index fa3d414884..d13e4c333a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/GroupDrawData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/GroupDrawData.java
@@ -12,6 +12,7 @@ package org.eclipse.swt.internal.theme;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.cairo.Cairo;
import org.eclipse.swt.internal.gtk.*;
public class GroupDrawData extends DrawData {
@@ -39,7 +40,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
byte[] detail = Converter.wcsToMbcs(null, "frame", true);
int gap_x = xthickness + GROUP_X, gap_width = headerWidth + GROUP_PAD * 2, gap_side = OS.GTK_POS_TOP;
int state_type = getStateType(DrawData.WIDGET_WHOLE);
- OS.gtk_paint_shadow_gap(gtkStyle, drawable, state_type, OS.GTK_SHADOW_ETCHED_IN, null, frameHandle, detail, x, y, width, height, gap_side, gap_x, gap_width);
+ gtk_render_shadow_gap (gtkStyle, drawable, state_type, OS.GTK_SHADOW_ETCHED_IN, null, frameHandle, detail, x, y, width, height, gap_side, gap_x, gap_width);
if (headerArea != null) {
headerArea.x = bounds.x + gap_x + GROUP_PAD;
headerArea.y = bounds.y;
@@ -65,4 +66,16 @@ int hit(Theme theme, Point position, Rectangle bounds) {
return bounds.contains(position) ? DrawData.WIDGET_WHOLE : DrawData.WIDGET_NOWHERE;
}
+void gtk_render_shadow_gap (long /*int*/ style, long /*int*/ window, int state_type, int shadow_type, GdkRectangle area, long /*int*/ widget, byte[] detail, int x , int y, int width, int height, int gap_side, int gap_x, int gap_width) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ long /*int*/ cairo = OS.gdk_cairo_create (window);
+ long /*int*/ context = OS.gtk_widget_get_style_context (style);
+ OS.gtk_style_context_save (context);
+ OS.gtk_style_context_set_state (context, state_type);
+ OS.gtk_render_frame_gap (context, cairo, context, y, gap_width, height, gap_side, gap_x, gap_x + gap_width);
+ Cairo.cairo_destroy (cairo);
+ } else {
+ OS.gtk_paint_shadow_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width);
+ }
+}
}