static void clearlooks_style_draw_layout (GtkStyle * style, GdkWindow * window, GtkStateType state_type, gboolean use_text, GdkRectangle * area, GtkWidget * widget, const gchar * detail, gint x, gint y, PangoLayout * layout) { (void) detail; GdkGC *gc; g_return_if_fail (GTK_IS_STYLE (style)); g_return_if_fail (window != NULL); gc = use_text ? style->text_gc[state_type] : style->fg_gc[state_type]; if (area) gdk_gc_set_clip_rectangle (gc, area); if (state_type == GTK_STATE_INSENSITIVE) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); ClearlooksColors *colors = &clearlooks_style->colors; WidgetParameters params; GdkColor etched; CairoColor temp; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); if (GTK_WIDGET_NO_WINDOW (widget)) ge_shade_color (¶ms.parentbg, 1.2, &temp); else ge_shade_color (&colors->bg[widget->state], 1.2, &temp); etched.red = (int) (temp.r * 65535); etched.green = (int) (temp.g * 65535); etched.blue = (int) (temp.b * 65535); gdk_draw_layout_with_colors (window, gc, x + 1, y + 1, layout, &etched, NULL); gdk_draw_layout (window, gc, x, y, layout); } else gdk_draw_layout (window, gc, x, y, layout); if (area) gdk_gc_set_clip_rectangle (gc, NULL); }
static GdkGC * _getUIStyle_gc (const gchar * name, const gchar * state, GtkStyle * style) { GdkGC *gc; gint n, m; g_return_val_if_fail (state != NULL, NULL); g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (style != NULL, NULL); g_return_val_if_fail (GTK_IS_STYLE(style), NULL); n = state_value (state); m = name_value (name); switch (m) { case GTKSTYLE_FG: gc = style->fg_gc[n]; break; case GTKSTYLE_BG: gc = style->bg_gc[n]; break; case GTKSTYLE_TEXT: gc = style->text_gc[n]; break; case GTKSTYLE_BASE: gc = style->base_gc[n]; break; case GTKSTYLE_LIGHT: gc = style->light_gc[n]; break; case GTKSTYLE_DARK: gc = style->dark_gc[n]; break; default: case GTKSTYLE_MID: gc = style->mid_gc[n]; break; } return (gc); }
/* Create a new Cairo graphics */ DivaCairoGraphics* diva_cairo_graphics_new (GdkWindow *window, GtkStyle *style, PangoContext *context) { g_return_val_if_fail (GDK_IS_WINDOW (window), NULL); g_return_val_if_fail (GTK_IS_STYLE (style), NULL); g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL); cairo_t *gr = gdk_cairo_create (window); g_return_val_if_fail (gr != NULL, NULL); DivaCairoGraphics *this = g_new0 (DivaCairoGraphics, 1); this->Style = style; this->Context = context; this->Window = window; this->Cairo = gr; g_object_ref (G_OBJECT (style)); g_object_ref (G_OBJECT (window)); g_object_ref (G_OBJECT (context)); return this; }
/** * ppg_instrument_view_set_style: * @view: (in): A #PpgInstrumentView. * @style: (in): A #GtkStyle. * * Sets the style for the instrument and redraws associated canvas items. * * Returns: None. * Side effects: None. */ void ppg_instrument_view_set_style (PpgInstrumentView *view, GtkStyle *style) { PpgInstrumentViewPrivate *priv; cairo_pattern_t *p; GtkStateType state; GdkColor begin; GdkColor end; gdouble height; guint text_color; guint dark_color; guint bg_color; g_return_if_fail(PPG_IS_INSTRUMENT_VIEW(view)); g_return_if_fail(GTK_IS_STYLE(style)); priv = view->priv; /* * Lose existing weak reference if needed. */ if (priv->style) { g_object_remove_weak_pointer(G_OBJECT(priv->style), (gpointer *)&priv->style); } /* * Store a weak reference to the style. */ priv->style = style; g_object_add_weak_pointer(G_OBJECT(priv->style), (gpointer *)&priv->style); state = priv->state; begin = style->mid[state]; end = style->dark[state]; /* * Redraw header gradient. */ g_object_get(priv->header_bg, "height", &height, NULL); p = cairo_pattern_create_linear(0, 0, 0, height); ppg_cairo_add_color_stop(p, 0, &begin); ppg_cairo_add_color_stop(p, 1, &end); g_object_set(priv->header_bg, "pattern", p, NULL); cairo_pattern_destroy(p); /* * Update separator bar color. */ dark_color = ppg_color_to_uint(&style->dark[state], 0xFF); g_object_set(priv->bar, "fill-color-rgba", dark_color, NULL); /* * Update text font color. */ text_color = ppg_color_to_uint(&style->text[state], 0xFF); g_object_set(priv->header_text, "fill-color-rgba", text_color, NULL); /* * Set general background color. */ bg_color = ppg_color_to_uint(&style->mid[state], 0xFF); g_object_set(priv->table, "fill-color-rgba", bg_color, NULL); }