[gimp/gtk3-port: 149/246] app: port Wilber drawing to GtkStyleContext
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 149/246] app: port Wilber drawing to GtkStyleContext
- Date: Sun, 27 Feb 2011 15:57:17 +0000 (UTC)
commit dba64e3e34ce054ce2314f27c1e440ec927e50bb
Author: Michael Natterer <mitch gimp org>
Date: Fri Dec 17 11:14:19 2010 +0100
app: port Wilber drawing to GtkStyleContext
app/widgets/gimpcairo.c | 57 +++++++++++++++++++++++------------------------
1 files changed, 28 insertions(+), 29 deletions(-)
---
diff --git a/app/widgets/gimpcairo.c b/app/widgets/gimpcairo.c
index 17a8e9f..d93c978 100644
--- a/app/widgets/gimpcairo.c
+++ b/app/widgets/gimpcairo.c
@@ -140,18 +140,17 @@ void
gimp_cairo_draw_toolbox_wilber (GtkWidget *widget,
cairo_t *cr)
{
- GtkStyle *style;
- GtkStateType state;
- GtkAllocation allocation;
- gdouble wilber_width;
- gdouble wilber_height;
- gdouble factor;
+ GtkStyleContext *context;
+ GtkAllocation allocation;
+ GdkRGBA color;
+ gdouble wilber_width;
+ gdouble wilber_height;
+ gdouble factor;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (cr != NULL);
- style = gtk_widget_get_style (widget);
- state = gtk_widget_get_state (widget);
+ context = gtk_widget_get_style_context (widget);
gtk_widget_get_allocation (widget, &allocation);
@@ -165,11 +164,11 @@ gimp_cairo_draw_toolbox_wilber (GtkWidget *widget,
(allocation.width / factor - wilber_width) / 2.0,
(allocation.height / factor - wilber_height) / 2.0);
- cairo_set_source_rgba (cr,
- style->fg[state].red / 65535.0,
- style->fg[state].green / 65535.0,
- style->fg[state].blue / 65535.0,
- 0.10);
+ gtk_style_context_get_color (context, gtk_widget_get_state_flags (widget),
+ &color);
+ color.alpha = 0.1;
+ gdk_cairo_set_source_rgba (cr, &color);
+
cairo_fill (cr);
}
@@ -177,21 +176,20 @@ void
gimp_cairo_draw_drop_wilber (GtkWidget *widget,
cairo_t *cr)
{
- GtkStyle *style;
- GtkStateType state;
- GtkAllocation allocation;
- gdouble wilber_width;
- gdouble wilber_height;
- gdouble width;
- gdouble height;
- gdouble side;
- gdouble factor;
+ GtkStyleContext *context;
+ GtkAllocation allocation;
+ GdkRGBA color;
+ gdouble wilber_width;
+ gdouble wilber_height;
+ gdouble width;
+ gdouble height;
+ gdouble side;
+ gdouble factor;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (cr != NULL);
- style = gtk_widget_get_style (widget);
- state = gtk_widget_get_state (widget);
+ context = gtk_widget_get_style_context (widget);
gtk_widget_get_allocation (widget, &allocation);
@@ -216,10 +214,11 @@ gimp_cairo_draw_drop_wilber (GtkWidget *widget,
- wilber_width * 0.6,
allocation.height / factor - wilber_height * 1.1);
- cairo_set_source_rgba (cr,
- style->fg[state].red / 65535.0,
- style->fg[state].green / 65535.0,
- style->fg[state].blue / 65535.0,
- 0.15);
+ gtk_style_context_get_color (context, gtk_widget_get_state_flags (widget),
+ &color);
+ color.alpha = 0.15;
+
+ gdk_cairo_set_source_rgba (cr, &color);
+
cairo_fill (cr);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]