From 5d04592d2679fae964a79278571d01aa1543fae7 Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Wed, 20 Mar 2013 14:22:02 -0400 Subject: Bug 399560 - [GTK3] CoolBar item handles only shown when CoolBar style includes SWT.FLAT --- .../Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java | 1 + .../Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java | 2 +- .../Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java | 2 +- .../emulated/coolbar/org/eclipse/swt/widgets/CoolBar.java | 2 +- .../Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java | 12 +++++++----- .../Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java | 2 +- .../Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java | 2 +- .../Eclipse SWT/wpf/org/eclipse/swt/widgets/Control.java | 2 +- 8 files changed, 14 insertions(+), 11 deletions(-) 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 08d9de968f..567d22c656 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 @@ -566,6 +566,7 @@ public class OS extends C { public static final byte[] GTK_STYLE_CLASS_TOOLTIP = ascii("tooltip"); public static final byte[] GTK_STYLE_CLASS_VIEW = ascii("view"); public static final byte[] GTK_STYLE_CLASS_CELL = ascii("cell"); + public static final byte[] GTK_STYLE_CLASS_PANE_SEPARATOR = ascii("pane-separator"); /** Properties */ public static final byte[] active = ascii("active"); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java index 6369e78696..9897762bb2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java @@ -897,7 +897,7 @@ boolean drawFocusRing () { return hasBorder (); } -boolean drawGripper (int x, int y, int width, int height, boolean vertical) { +boolean drawGripper (GC gc, int x, int y, int width, int height, boolean vertical) { return false; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java index 2e723aa858..f7dabc4579 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java @@ -1219,7 +1219,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean [] consume) { return dragging; } -boolean drawGripper (int x, int y, int width, int height, boolean vertical) { +boolean drawGripper (GC gc, int x, int y, int width, int height, boolean vertical) { return false; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar/org/eclipse/swt/widgets/CoolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar/org/eclipse/swt/widgets/CoolBar.java index a427a101fd..f5b7f7593e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar/org/eclipse/swt/widgets/CoolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/emulated/coolbar/org/eclipse/swt/widgets/CoolBar.java @@ -711,7 +711,7 @@ void onPaint(Event event) { /* Draw gripper. */ if (!isLocked) { rect = fixRectangle(bounds.x, bounds.y, CoolItem.MINIMUM_WIDTH, bounds.height); - if (!flat) nativeGripper = drawGripper(rect.x, rect.y, rect.width, rect.height, vertical); + if (!flat) nativeGripper = drawGripper(gc, rect.x, rect.y, rect.width, rect.height, vertical); if (!nativeGripper) { int grabberTrim = 2; int grabberHeight = bounds.height - (2 * grabberTrim) - 1; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java index c929cf0efd..ad2769160a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java @@ -159,17 +159,19 @@ void drawBackground (Control control, long /*int*/ window, long /*int*/ cr, long OS.g_object_unref (gdkGC); } -boolean drawGripper (int x, int y, int width, int height, boolean vertical) { +boolean drawGripper (GC gc, int x, int y, int width, int height, boolean vertical) { long /*int*/ paintHandle = paintHandle (); long /*int*/ window = gtk_widget_get_window (paintHandle); if (window == 0) return false; int orientation = vertical ? OS.GTK_ORIENTATION_HORIZONTAL : OS.GTK_ORIENTATION_VERTICAL; if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - width - x; if (OS.GTK3) { - long /*int*/ cairo = OS.gdk_cairo_create (window); - long /*int*/ context = OS.gtk_widget_get_style_context(paintHandle); - OS.gtk_render_handle(context, cairo, x, y, width, height); - Cairo.cairo_destroy (cairo); + long /*int*/ context = OS.gtk_widget_get_style_context (paintHandle); + OS.gtk_style_context_save (context); + OS.gtk_style_context_add_class (context, OS.GTK_STYLE_CLASS_PANE_SEPARATOR); + OS.gtk_style_context_set_state (context, OS.GTK_STATE_FLAG_NORMAL); + OS.gtk_render_handle (context, gc.handle, x, y, width, height); + OS.gtk_style_context_restore (context); } else { OS.gtk_paint_handle (OS.gtk_widget_get_style (paintHandle), window, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_OUT, null, paintHandle, new byte [1], x, y, width, height, orientation); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java index 13f9e37602..d19c9e156d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java @@ -787,7 +787,7 @@ boolean dragDetect (int button, int count, int stateMask, int x, int y) { boolean dragDetect (int x, int y, boolean force, boolean [] consume) { return true; } -boolean drawGripper (int x, int y, int width, int height, boolean vertical) { +boolean drawGripper (GC gc, int x, int y, int width, int height, boolean vertical) { return false; } void enableWidget (boolean enabled) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java index 961b385186..72eddfbda8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java @@ -658,7 +658,7 @@ int defaultForeground () { return display.WIDGET_FOREGROUND; } -boolean drawGripper (int x, int y, int width, int height, boolean vertical) { +boolean drawGripper (GC gc, int x, int y, int width, int height, boolean vertical) { return false; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Control.java index 28500a5141..322bcfe1a9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/wpf/org/eclipse/swt/widgets/Control.java @@ -843,7 +843,7 @@ void enableWidget (boolean enabled) { OS.UIElement_IsEnabled (handle, enabled); } -boolean drawGripper (int x, int y, int width, int height, boolean vertical) { +boolean drawGripper (GC gc, int x, int y, int width, int height, boolean vertical) { return false; } -- cgit v1.2.3