[gtk+] Make DnD code use GtkStyleContext for the highlight rectangle.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Make DnD code use GtkStyleContext for the highlight rectangle.
- Date: Tue, 4 Jan 2011 02:20:40 +0000 (UTC)
commit 96d8f85dcc2781575836740386512d448337b44a
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Jan 4 02:32:04 2011 +0100
Make DnD code use GtkStyleContext for the highlight rectangle.
gtk/gtkdnd-quartz.c | 11 +++++++----
gtk/gtkdnd.c | 13 +++++++++----
gtk/gtkstylecontext.h | 7 +++++++
3 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkdnd-quartz.c b/gtk/gtkdnd-quartz.c
index d990029..f541cf1 100644
--- a/gtk/gtkdnd-quartz.c
+++ b/gtk/gtkdnd-quartz.c
@@ -347,11 +347,14 @@ gtk_drag_highlight_draw (GtkWidget *widget,
{
int width = gtk_widget_get_allocated_width (widget);
int height = gtk_widget_get_allocated_height (widget);
+ GtkStyleContext *context;
- gtk_paint_shadow (gtk_widget_get_style (widget), cr,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- widget, "dnd",
- 0, 0, width, height);
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_DND);
+
+ gtk_render_frame (context, cr, 0, 0, width, height);
+
+ gtk_style_context_restore (context);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
cairo_set_line_width (cr, 1.0);
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index bb90456..933172b 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -1104,11 +1104,16 @@ gtk_drag_highlight_draw (GtkWidget *widget,
{
int width = gtk_widget_get_allocated_width (widget);
int height = gtk_widget_get_allocated_height (widget);
+ GtkStyleContext *context;
- gtk_paint_shadow (gtk_widget_get_style (widget), cr,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- widget, "dnd",
- 0, 0, width, height);
+ context = gtk_widget_get_style_context (widget);
+
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_DND);
+
+ gtk_render_frame (context, cr, 0, 0, width, height);
+
+ gtk_style_context_restore (context);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
cairo_set_line_width (cr, 1.0);
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 97f7e76..ab9be70 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -354,6 +354,13 @@ struct _GtkStyleContextClass
#define GTK_STYLE_CLASS_FRAME "frame"
/**
+ * GTK_STYLE_CLASS_DND:
+ *
+ * A CSS class for a drag-and-drop indicator
+ */
+#define GTK_STYLE_CLASS_DND "dnd"
+
+/**
* GTK_STYLE_CLASS_INFO:
*
* A widget class for an area displaying an informational message,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]