static void clearlooks_inverted_draw_slider (cairo_t *cr, const ClearlooksColors *colors, const WidgetParameters *params, int x, int y, int width, int height) { const CairoColor *border = &colors->shade[params->disabled ? 4 : 6]; const CairoColor *spot = &colors->spot[1]; const CairoColor *fill = &colors->shade[2]; double radius = MIN (params->radius, MIN ((width - 1.0) / 2.0, (height - 1.0) / 2.0)); cairo_pattern_t *pattern; cairo_set_line_width (cr, 1.0); cairo_translate (cr, x, y); if (params->disabled) border = &colors->shade[4]; else if (params->prelight) border = &colors->spot[2]; else border = &colors->shade[6]; /* fill the widget */ cairo_rectangle (cr, 1.0, 1.0, width-2, height-2); /* Fake light */ if (!params->disabled) { const CairoColor *top = &colors->shade[2]; const CairoColor *bot = &colors->shade[0]; pattern = cairo_pattern_create_linear (0, 0, 0, height); cairo_pattern_add_color_stop_rgb (pattern, 0.0, top->r, top->g, top->b); cairo_pattern_add_color_stop_rgb (pattern, 1.0, bot->r, bot->g, bot->b); cairo_set_source (cr, pattern); cairo_fill (cr); cairo_pattern_destroy (pattern); } else { ge_cairo_set_color (cr, fill); cairo_rectangle (cr, 1.0, 1.0, width-2, height-2); cairo_fill (cr); } /* Set the clip */ cairo_save (cr); cairo_rectangle (cr, 1.0, 1.0, 6, height-2); cairo_rectangle (cr, width-7.0, 1.0, 6, height-2); cairo_clip_preserve (cr); cairo_new_path (cr); /* Draw the handles */ ge_cairo_rounded_rectangle (cr, 1.0, 1.0, width-1, height-1, radius, params->corners); pattern = cairo_pattern_create_linear (0.5, 0.5, 0.5, 0.5+height); if (params->prelight) { CairoColor highlight; ge_shade_color (spot, 1.5, &highlight); cairo_pattern_add_color_stop_rgb (pattern, 0.0, spot->r, spot->g, spot->b); cairo_pattern_add_color_stop_rgb (pattern, 1.0, highlight.r, highlight.g, highlight.b); cairo_set_source (cr, pattern); } else { CairoColor hilight; ge_shade_color (fill, 1.5, &hilight); cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, 0.5); } cairo_fill (cr); cairo_pattern_destroy (pattern); cairo_restore (cr); /* Draw the border */ ge_cairo_inner_rounded_rectangle (cr, 0, 0, width, height, radius, params->corners); if (params->prelight || params->disabled) ge_cairo_set_color (cr, border); else clearlooks_set_border_gradient (cr, border, 1.2, 0, height); cairo_stroke (cr); /* Draw handle lines */ if (width > 14) { cairo_move_to (cr, 6.5, 1.0); cairo_line_to (cr, 6.5, height-1); cairo_move_to (cr, width-6.5, 1.0); cairo_line_to (cr, width-6.5, height-1); cairo_set_line_width (cr, 1.0); cairo_set_source_rgba (cr, border->r, border->g, border->b, 0.3); cairo_stroke (cr); } }
static void clearlooks_glossy_draw_scrollbar_stepper (cairo_t *cr, const ClearlooksColors *colors, const WidgetParameters *widget, const ScrollBarParameters *scrollbar, const ScrollBarStepperParameters *stepper, int x, int y, int width, int height) { CairoCorners corners = CR_CORNER_NONE; const CairoColor *border = &colors->shade[7]; CairoColor fill, s1, s2, s4; cairo_pattern_t *pattern; ShadowParameters shadow; double radius = MIN (widget->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0)); if (scrollbar->horizontal) { if (stepper->stepper == CL_STEPPER_START) corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT; else if (stepper->stepper == CL_STEPPER_END) corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT; if (stepper->stepper == CL_STEPPER_START_INNER) { x -= 1; width += 1; } else if (stepper->stepper == CL_STEPPER_END_INNER) { width += 1; } } else { if (stepper->stepper == CL_STEPPER_START) corners = CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT; else if (stepper->stepper == CL_STEPPER_END) corners = CR_CORNER_BOTTOMLEFT | CR_CORNER_BOTTOMRIGHT; if (stepper->stepper == CL_STEPPER_START_INNER) { y -= 1; height += 1; } else if (stepper->stepper == CL_STEPPER_END_INNER) { height += 1; } } cairo_translate (cr, x, y); cairo_set_line_width (cr, 1); ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius, corners); if (scrollbar->horizontal) pattern = cairo_pattern_create_linear (0, 0, 0, height); else pattern = cairo_pattern_create_linear (0, 0, width, 0); fill = colors->bg[widget->state_type]; ge_shade_color(&fill, 1.16, &s1); ge_shade_color(&fill, 1.08, &s2); ge_shade_color(&fill, 1.08, &s4); cairo_pattern_add_color_stop_rgb(pattern, 0, s1.r, s1.g, s1.b); cairo_pattern_add_color_stop_rgb(pattern, 0.5, s2.r, s2.g, s2.b); cairo_pattern_add_color_stop_rgb(pattern, 0.5, fill.r, fill.g, fill.b); cairo_pattern_add_color_stop_rgb(pattern, 1.0, s4.r, s4.g, s4.b); cairo_set_source (cr, pattern); cairo_fill (cr); cairo_pattern_destroy (pattern); ge_cairo_inner_rounded_rectangle (cr, 0, 0, width, height, radius, corners); clearlooks_set_mixed_color (cr, border, &fill, 0.2); if (widget->prelight) ge_cairo_set_color (cr, &colors->spot[2]); cairo_stroke (cr); shadow.shadow = CL_SHADOW_OUT; shadow.corners = corners; }