void ge_gtk_style_to_cairo_color_cube (GtkStyle * style, CairoColorCube *cube) { int i; g_return_if_fail (style && cube); for (i = 0; i < 5; i++) { ge_gdk_color_to_cairo (&style->bg[i], &cube->bg[i]); ge_gdk_color_to_cairo (&style->fg[i], &cube->fg[i]); ge_gdk_color_to_cairo (&style->dark[i], &cube->dark[i]); ge_gdk_color_to_cairo (&style->light[i], &cube->light[i]); ge_gdk_color_to_cairo (&style->mid[i], &cube->mid[i]); ge_gdk_color_to_cairo (&style->base[i], &cube->base[i]); ge_gdk_color_to_cairo (&style->text[i], &cube->text[i]); ge_gdk_color_to_cairo (&style->text_aa[i], &cube->text_aa[i]); } cube->black.r = cube->black.g = cube->black.b = 0; cube->black.a = 1; cube->white.r = cube->white.g = cube->white.b = 1; cube->white.a = 1; }
void clearlooks_get_parent_bg (const GtkWidget *widget, CairoColor *color) { GtkStateType state_type; const GtkWidget *parent; GdkColor *gcolor; if (widget == NULL) return; parent = widget->parent; while (parent && GTK_WIDGET_NO_WINDOW (parent) && !((GTK_IS_NOTEBOOK (parent)) || (GTK_IS_TOOLBAR (parent)))) parent = parent->parent; if (parent == NULL) return; state_type = GTK_WIDGET_STATE (parent); gcolor = &parent->style->bg[state_type]; ge_gdk_color_to_cairo (gcolor, color); }
static void clearlooks_style_realize (GtkStyle * style) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); double shades[] = {1.15, 0.95, 0.896, 0.82, 0.7, 0.665, 0.475, 0.45, 0.4}; CairoColor spot_color; CairoColor bg_normal; double contrast; int i; clearlooks_parent_class->realize (style); contrast = CLEARLOOKS_RC_STYLE (style->rc_style)->contrast; /* Lighter to darker */ ge_gdk_color_to_cairo (&style->bg[GTK_STATE_NORMAL], &bg_normal); for (i = 0; i < 9; i++) { ge_shade_color(&bg_normal, (shades[i]-0.7) * contrast + 0.7, &clearlooks_style->colors.shade[i]); } ge_gdk_color_to_cairo (&style->bg[GTK_STATE_SELECTED], &spot_color); ge_shade_color(&spot_color, 1.42, &clearlooks_style->colors.spot[0]); ge_shade_color(&spot_color, 1.05, &clearlooks_style->colors.spot[1]); ge_shade_color(&spot_color, 0.65, &clearlooks_style->colors.spot[2]); for (i=0; i<5; i++) { ge_gdk_color_to_cairo (&style->fg[i], &clearlooks_style->colors.fg[i]); ge_gdk_color_to_cairo (&style->bg[i], &clearlooks_style->colors.bg[i]); ge_gdk_color_to_cairo (&style->base[i], &clearlooks_style->colors.base[i]); ge_gdk_color_to_cairo (&style->text[i], &clearlooks_style->colors.text[i]); } }
static void clearlooks_style_draw_slider (DRAW_ARGS, GtkOrientation orientation) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); const ClearlooksColors *colors; cairo_t *cr; cr = ge_gdk_drawable_to_cairo (window, area); colors = &clearlooks_style->colors; CHECK_ARGS SANITIZE_SIZE if (DETAIL ("hscale") || DETAIL ("vscale")) { WidgetParameters params; SliderParameters slider; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); slider.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL); slider.lower = FALSE; slider.fill_level = FALSE; if (clearlooks_style->style == CL_STYLE_GLOSSY) /* XXX! */ params.corners = CR_CORNER_ALL; STYLE_FUNCTION(draw_slider_button) (cr, &clearlooks_style->colors, ¶ms, &slider, x, y, width, height); } else if (DETAIL ("slider")) { WidgetParameters params; ScrollBarParameters scrollbar; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); params.corners = CR_CORNER_NONE; scrollbar.has_color = FALSE; scrollbar.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL); scrollbar.junction = clearlooks_scrollbar_get_junction (widget); if (clearlooks_style->colorize_scrollbar) { scrollbar.color = colors->spot[1]; scrollbar.has_color = TRUE; } /* Set scrollbar color */ if (clearlooks_style->has_scrollbar_color) { ge_gdk_color_to_cairo (&clearlooks_style->scrollbar_color, &scrollbar.color); scrollbar.has_color = TRUE; } if ((clearlooks_style->style == CL_STYLE_GLOSSY || clearlooks_style->style == CL_STYLE_GUMMY) && !scrollbar.has_color) scrollbar.color = colors->bg[0]; STYLE_FUNCTION(draw_scrollbar_slider) (cr, colors, ¶ms, &scrollbar, x, y, width, height); } else { clearlooks_parent_class->draw_slider (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation); } cairo_destroy (cr); }
/* Standard Border Function */ void hc_draw_shadow(GtkStyle * style, cairo_t * cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget * widget, const gchar * detail, gint x, gint y, gint width, gint height) { /* Border Uses Foreground Color */ CairoColor foreground = HC_STYLE(style)->color_cube.fg[state_type]; gint line_width; gint clip_x = x, clip_y = y, clip_width = width, clip_height = height; /***********************************************/ /* GTK Sanity Checks */ /***********************************************/ CHECK_ARGS /***********************************************/ /* GTK Special Cases - adjust Size/Offset */ /***********************************************/ line_width = HC_STYLE(style)->edge_thickness; if (CHECK_DETAIL (detail, "menubar") && ge_is_panel_widget_item(widget)) { return; } /* Spin Button */ if ((CHECK_DETAIL(detail, "spinbutton_up")) || (CHECK_DETAIL(detail, "spinbutton_down"))) { /* Overdraw Height By Half The Line Width - Prevents Double line Between buttons */ height += floor(line_width / 2); /* If Down Button Offset By Half Line Width */ if (CHECK_DETAIL(detail, "spinbutton_down")) { y -= floor(line_width / 2); } /* Overdraw Width By Line Width - Prevents Double line Between Entry And Buttons */ width += line_width; /* If LTR Offset X By Line Width */ if (ge_widget_is_ltr (widget)) { x -= line_width; } /* Force Border To Use Foreground Widget State */ if (widget) { foreground = HC_STYLE(style)->color_cube.fg[gtk_widget_get_state(widget)]; } } /* Entry - Force Border To Use Foreground Matching Widget State */ if (CHECK_DETAIL(detail, "entry") && !ge_is_combo(widget)) { foreground = HC_STYLE(style)->color_cube.fg[widget ? gtk_widget_get_state(widget) : GTK_STATE_NORMAL]; } /* Combo Box Button's */ if (CHECK_DETAIL(detail, "button") && ge_is_in_combo_box(widget)) { /* Overdraw Width By Line Width - Prevents Double Line Between Entry and Button. */ width += line_width; /* If LTR Offset X By Line Width */ if (ge_widget_is_ltr (widget)) { x -= line_width; } /* Force Border To Use Foreground Matching Parent State */ if ((widget) && (gtk_widget_get_parent(widget))) { gtk_widget_ensure_style(gtk_widget_get_parent(widget)); ge_gdk_color_to_cairo(>k_widget_get_style(gtk_widget_get_parent(widget))->fg[gtk_widget_get_state (widget)], &foreground); } } /***********************************************/ /* Draw Border */ /***********************************************/ /* Clip Border Too Passed Size */ cairo_rectangle(cr, clip_x, clip_y, clip_width, clip_height); cairo_clip(cr); /* Set Line Style */ ge_cairo_set_color(cr, &foreground); cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT); cairo_set_line_width (cr, line_width); ge_cairo_inner_rectangle (cr, x, y, width, height); cairo_stroke(cr); }