1 /* Clearlooks Gummy style
2 * Copyright (C) 2007 Andrea Cimitan
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
19 * Written by Andrea Cimitan <andrea.cimitan@gmail.com>
22 #include "clearlooks_draw.h"
23 #include "clearlooks_style.h"
24 #include "clearlooks_types.h"
27 #include <ge-support.h>
32 #define SHADE_TOP 1.08
33 #define SHADE_CENTER_TOP 1.02
34 #define SHADE_BOTTOM 0.94
36 /* Topleft highlight */
37 #define TOPLEFT_HIGHLIGHT_SHADE 1.3
38 #define TOPLEFT_HIGHLIGHT_ALPHA 0.4
41 #define LISTVIEW_SHADE_TOP 1.06
42 #define LISTVIEW_SHADE_CENTER_TOP 1.02
43 #define LISTVIEW_SHADE_BOTTOM 0.96
46 #define TOOLBAR_SHADE_TOP 1.04
47 #define TOOLBAR_SHADE_CENTER_TOP 1.01
48 #define TOOLBAR_SHADE_BOTTOM 0.97
52 clearlooks_draw_gummy_gradient (cairo_t *cr,
53 double x, double y, int width, int height,
54 const CairoColor *color,
55 gboolean disabled, gboolean radius, CairoCorners corners)
58 CairoColor shade1, shade2, shade3;
61 ge_shade_color (color, disabled? 1.04 : SHADE_TOP, &shade1);
62 ge_shade_color (color, disabled? 1.01 : SHADE_CENTER_TOP, &shade2);
63 ge_shade_color (color, disabled? 0.99 : 1.0, &fill);
64 ge_shade_color (color, disabled? 0.96 : SHADE_BOTTOM, &shade3);
66 pt = cairo_pattern_create_linear (x, y, x, y+height);
67 cairo_pattern_add_color_stop_rgb (pt, 0.0, shade1.r, shade1.g, shade1.b);
68 cairo_pattern_add_color_stop_rgb (pt, 0.5, shade2.r, shade2.g, shade2.b);
69 cairo_pattern_add_color_stop_rgb (pt, 0.5, fill.r, fill.g, fill.b);
70 cairo_pattern_add_color_stop_rgb (pt, 1.0, shade3.r, shade3.g, shade3.b);
72 cairo_set_source (cr, pt);
73 ge_cairo_rounded_rectangle (cr, x, y, width, height, radius, corners);
76 cairo_pattern_destroy (pt);
80 clearlooks_set_mixed_color (cairo_t *cr,
81 const CairoColor *color1,
82 const CairoColor *color2,
87 ge_mix_color (color1, color2, mix_factor, &composite);
88 ge_cairo_set_color (cr, &composite);
92 clearlooks_gummy_draw_highlight_and_shade (cairo_t *cr,
93 const CairoColor *bg_color,
94 const ShadowParameters *params,
95 int width, int height, gdouble radius)
99 uint8 corners = params->corners;
103 /* not really sure of shading ratios... we will think */
104 ge_shade_color (bg_color, 0.8, &shadow);
105 ge_shade_color (bg_color, 1.2, &highlight);
109 /* Top/Left highlight */
110 if (corners & CR_CORNER_BOTTOMLEFT)
111 cairo_move_to (cr, x, y+height-radius);
113 cairo_move_to (cr, x, y+height);
115 ge_cairo_rounded_corner (cr, x, y, radius, corners & CR_CORNER_TOPLEFT);
117 if (corners & CR_CORNER_TOPRIGHT)
118 cairo_line_to (cr, x+width-radius, y);
120 cairo_line_to (cr, x+width, y);
122 if (params->shadow & CL_SHADOW_OUT)
123 cairo_set_source_rgba (cr, highlight.r, highlight.g, highlight.b, 0.5);
125 cairo_set_source_rgba (cr, shadow.r, shadow.g, shadow.b, 0.5);
129 /* Bottom/Right highlight -- this includes the corners */
130 cairo_move_to (cr, x+width-radius, y); /* topright and by radius to the left */
131 ge_cairo_rounded_corner (cr, x+width, y, radius, corners & CR_CORNER_TOPRIGHT);
132 ge_cairo_rounded_corner (cr, x+width, y+height, radius, corners & CR_CORNER_BOTTOMRIGHT);
133 ge_cairo_rounded_corner (cr, x, y+height, radius, corners & CR_CORNER_BOTTOMLEFT);
135 if (params->shadow & CL_SHADOW_OUT)
136 cairo_set_source_rgba (cr, shadow.r, shadow.g, shadow.b, 0.5);
138 cairo_set_source_rgba (cr, highlight.r, highlight.g, highlight.b, 0.5);
146 clearlooks_gummy_draw_top_left_highlight (cairo_t *cr, const CairoColor *color,
147 const WidgetParameters *params,
148 int width, int height, gdouble radius)
152 double light_top = params->ythickness-1,
153 light_bottom = height - params->ythickness - 1,
154 light_left = params->xthickness-1,
155 light_right = width - params->xthickness - 1;
157 ge_shade_color (color, TOPLEFT_HIGHLIGHT_SHADE, &hilight);
158 cairo_move_to (cr, light_left, light_bottom - (int)radius/2);
160 ge_cairo_rounded_corner (cr, light_left, light_top, radius, params->corners & CR_CORNER_TOPLEFT);
162 cairo_line_to (cr, light_right - (int)radius/2, light_top);
163 cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, TOPLEFT_HIGHLIGHT_ALPHA);
168 clearlooks_gummy_draw_button (cairo_t *cr,
169 const ClearlooksColors *colors,
170 const WidgetParameters *params,
171 int x, int y, int width, int height)
173 double xoffset = 0, yoffset = 0;
174 CairoColor fill = colors->bg[params->state_type];
175 CairoColor border_normal = colors->shade[6];
176 CairoColor border_disabled = colors->shade[4];
179 cairo_pattern_t *pattern;
182 cairo_translate (cr, x, y);
183 cairo_set_line_width (cr, 1.0);
185 /* Shadows and Glow */
186 if (params->xthickness == 3 || params->ythickness == 3)
188 if (params->xthickness == 3)
190 if (params->ythickness == 3)
194 radius = MIN (params->radius, MIN ((width - 2.0 - 2*xoffset) / 2.0, (height - 2.0 - 2*yoffset) / 2.0));
196 if (params->xthickness == 3 || params->ythickness == 3)
198 cairo_translate (cr, 0.5, 0.5);
200 if (params->enable_glow && !params->active && !params->disabled && !params->is_default)
204 radius = MIN (params->radius, MIN ((width - 2.0 - 2*xoffset) / 2.0 - 1.0, (height - 2.0 - 2*yoffset) / 2.0 - 1.0));
206 ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius+1, params->corners);
207 ge_shade_color (¶ms->parentbg, 0.97, &shadow);
208 ge_cairo_set_color (cr, &shadow);
211 ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius+1, params->corners);
212 ge_shade_color (¶ms->parentbg, 0.93, &shadow);
213 ge_cairo_set_color (cr, &shadow);
217 if (params->is_default)
219 CairoColor shadow = colors->spot[1];
221 radius = MIN (params->radius, MIN ((width - 2.0 - 2*xoffset) / 2.0 - 1.0, (height - 2.0 - 2*yoffset) / 2.0 - 1.0));
223 ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius+1, params->corners);
224 clearlooks_set_mixed_color (cr, ¶ms->parentbg, &shadow, 0.5);
228 if (!(params->enable_glow && !params->active && !params->disabled))
229 params->style_functions->draw_inset (cr, ¶ms->parentbg, 0, 0, width-1, height-1, params->radius+1, params->corners);
230 cairo_translate (cr, -0.5, -0.5);
233 clearlooks_draw_gummy_gradient (cr, xoffset+1, yoffset+1,
234 width-(xoffset*2)-2, height-(yoffset*2)-2,
235 &fill, params->disabled, radius, params->corners);
237 /* Pressed button shadow */
241 ge_shade_color (&fill, 0.92, &shadow);
245 ge_cairo_rounded_rectangle (cr, xoffset+1, yoffset+1, width-(xoffset*2)-2, height, radius,
246 params->corners & (CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMLEFT));
248 cairo_rectangle (cr, xoffset+1, yoffset+1, width-(xoffset*2)-2, 3);
250 pattern = cairo_pattern_create_linear (xoffset+1, yoffset+1, xoffset+1, yoffset+4);
251 cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.58);
252 cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.0);
253 cairo_set_source (cr, pattern);
255 cairo_pattern_destroy (pattern);
257 cairo_rectangle (cr, xoffset+1, yoffset+1, 3, height-(yoffset*2)-2);
259 pattern = cairo_pattern_create_linear (xoffset+1, yoffset+1, xoffset+4, yoffset+1);
260 cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.58);
261 cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.0);
262 cairo_set_source (cr, pattern);
264 cairo_pattern_destroy (pattern);
270 if (params->is_default) /* || (params->prelight && params->enable_glow)) */
271 border_normal = colors->spot[2];
272 if (params->disabled)
273 ge_cairo_set_color (cr, &border_disabled);
275 clearlooks_set_mixed_color (cr, &border_normal, &fill, 0.2);
276 ge_cairo_rounded_rectangle (cr, xoffset + 0.5, yoffset + 0.5,
277 width-(xoffset*2)-1, height-(yoffset*2)-1,
278 radius, params->corners);
283 cairo_translate (cr, 0.5, 0.5);
284 clearlooks_gummy_draw_top_left_highlight (cr, &fill, params, width, height, radius);
290 clearlooks_gummy_draw_entry (cairo_t *cr,
291 const ClearlooksColors *colors,
292 const WidgetParameters *params,
293 int x, int y, int width, int height)
295 const CairoColor *base = &colors->base[params->state_type];
296 CairoColor border = colors->shade[params->disabled ? 4 : 6];
297 double radius = MIN (params->radius, MIN ((width - 4.0) / 2.0, (height - 4.0) / 2.0));
300 border = colors->spot[2];
302 cairo_translate (cr, x+0.5, y+0.5);
303 cairo_set_line_width (cr, 1.0);
305 /* Fill the background to get the correct corners. */
306 cairo_rectangle (cr, -0.5, -0.5, width, height);
307 ge_cairo_set_color (cr, ¶ms->parentbg);
310 /* Fill with the base color, because it was just cleared above */
311 cairo_rectangle (cr, 1.5, 1.5, width-4, height-4);
312 ge_cairo_set_color (cr, base);
315 params->style_functions->draw_inset (cr, ¶ms->parentbg, 0, 0, width-1, height-1, radius+1, params->corners);
317 /* Draw the inner shadow */
320 /* ge_cairo_rounded_rectangle (cr, 2, 2, width-5, height-5, RADIUS-1, params->corners); */
321 ge_cairo_set_color (cr, &colors->spot[0]);
322 ge_cairo_stroke_rectangle (cr, 2, 2, width-5, height-5);
327 ge_shade_color (&border, 0.92, &shadow);
329 cairo_set_source_rgba (cr, shadow.r, shadow.g, shadow.b, params->disabled ? 0.09 : 0.18);
331 cairo_move_to (cr, 2, height-3);
332 cairo_arc (cr, params->xthickness+RADIUS-1, params->ythickness+RADIUS-1, RADIUS, G_PI, 270*(G_PI/180));
333 cairo_line_to (cr, width-3, 2);
335 cairo_move_to (cr, 2, height-3);
336 cairo_line_to (cr, 2, 2);
337 cairo_line_to (cr, width-3, 2);
341 ge_cairo_rounded_rectangle (cr, 1, 1, width-3, height-3, radius, params->corners);
342 ge_cairo_set_color (cr, &border);
347 clearlooks_gummy_draw_progressbar_trough (cairo_t *cr,
348 const ClearlooksColors *colors,
349 const WidgetParameters *params,
350 int x, int y, int width, int height)
352 const CairoColor *border = &colors->shade[7];
354 cairo_pattern_t *pattern;
355 double radius = MIN (params->radius, MIN ((height-2.0) / 2.0, (width-2.0) / 2.0));
359 cairo_set_line_width (cr, 1.0);
361 /* Fill with bg color */
362 ge_cairo_set_color (cr, &colors->bg[params->state_type]);
364 cairo_rectangle (cr, x, y, width, height);
367 /* Create trough box */
368 ge_cairo_rounded_rectangle (cr, x+1, y+1, width-2, height-2, radius, params->corners);
369 ge_cairo_set_color (cr, &colors->shade[2]);
373 ge_cairo_rounded_rectangle (cr, x+0.5, y+0.5, width-1, height-1, radius, params->corners);
374 clearlooks_set_mixed_color (cr, border, &colors->shade[2], 0.3);
377 /* clip the corners of the shadows */
378 ge_cairo_rounded_rectangle (cr, x+1, y+1, width-2, height-2, radius, params->corners);
381 ge_shade_color (border, 0.92, &shadow);
384 cairo_rectangle (cr, x+1, y+1, width-2, 4);
385 pattern = cairo_pattern_create_linear (x, y, x, y+4);
386 cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.3);
387 cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.);
388 cairo_set_source (cr, pattern);
390 cairo_pattern_destroy (pattern);
393 cairo_rectangle (cr, x+1, y+1, 4, height-2);
394 pattern = cairo_pattern_create_linear (x, y, x+4, y);
395 cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.3);
396 cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.);
397 cairo_set_source (cr, pattern);
399 cairo_pattern_destroy (pattern);
405 clearlooks_gummy_draw_progressbar_fill (cairo_t *cr,
406 const ClearlooksColors *colors,
407 const WidgetParameters *params,
408 const ProgressBarParameters *progressbar,
409 int x, int y, int width, int height, gint offset)
411 boolean is_horizontal = progressbar->orientation < 2;
417 cairo_pattern_t *pattern;
418 CairoColor shade1, shade2, shade3;
422 radius = MAX (0, params->radius - params->xthickness);
427 ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
429 if ((progressbar->orientation == CL_ORIENTATION_RIGHT_TO_LEFT) || (progressbar->orientation == CL_ORIENTATION_BOTTOM_TO_TOP))
430 ge_cairo_mirror (cr, CR_MIRROR_HORIZONTAL, &x, &y, &width, &height);
432 /* Clamp the radius so that the _height_ fits ... */
433 radius = MIN (radius, height / 2.0);
435 stroke_width = height*2;
436 x_step = (((float)stroke_width/10)*offset); /* This looks weird ... */
438 cairo_translate (cr, x, y);
441 /* This is kind of nasty ... Clip twice from each side in case the length
442 * of the fill is smaller than twice the radius. */
443 ge_cairo_rounded_rectangle (cr, 0, 0, width + radius, height, radius, CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT);
445 ge_cairo_rounded_rectangle (cr, -radius, 0, width + radius, height, radius, CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT);
448 /* Draw the background gradient */
449 ge_shade_color (&colors->spot[1], SHADE_TOP, &shade1);
450 ge_shade_color (&colors->spot[1], SHADE_CENTER_TOP, &shade2);
451 ge_shade_color (&colors->spot[1], SHADE_BOTTOM, &shade3);
452 pattern = cairo_pattern_create_linear (0, 0, 0, height);
453 cairo_pattern_add_color_stop_rgb (pattern, 0.0, shade1.r, shade1.g, shade1.b);
454 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
455 cairo_pattern_add_color_stop_rgb (pattern, 0.5, colors->spot[1].r, colors->spot[1].g, colors->spot[1].b);
456 cairo_pattern_add_color_stop_rgb (pattern, 1.0, shade3.r, shade3.g, shade3.b);
457 cairo_set_source (cr, pattern);
459 cairo_pattern_destroy (pattern);
461 /* Draw the Strokes */
462 while (tile_pos <= width+x_step)
464 cairo_move_to (cr, stroke_width/2-x_step, 0);
465 cairo_line_to (cr, stroke_width-x_step, 0);
466 cairo_line_to (cr, stroke_width/2-x_step, height);
467 cairo_line_to (cr, -x_step, height);
469 cairo_translate (cr, stroke_width, 0);
470 tile_pos += stroke_width;
473 cairo_set_source_rgba (cr, colors->spot[2].r,
479 cairo_restore (cr); /* rounded clip region */
481 /* inner highlight border
482 * This is again kinda ugly. Draw once from each side, clipping away the other. */
483 cairo_set_source_rgba (cr, colors->spot[0].r, colors->spot[0].g, colors->spot[0].b, 0.2);
487 cairo_rectangle (cr, 0, 0, width / 2, height);
490 if (progressbar->pulsing)
491 ge_cairo_rounded_rectangle (cr, 1.5, 0.5, width + radius, height - 1, radius, CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT);
493 ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width + radius, height - 1, radius, CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT);
496 cairo_restore (cr); /* clip */
500 cairo_rectangle (cr, width / 2, 0, (width+1) / 2, height);
503 if (progressbar->value < 1.0 || progressbar->pulsing)
504 ge_cairo_rounded_rectangle (cr, -1.5 - radius, 0.5, width + radius, height - 1, radius, CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT);
506 ge_cairo_rounded_rectangle (cr, -0.5 - radius, 0.5, width + radius, height - 1, radius, CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT);
509 cairo_restore (cr); /* clip */
512 /* Draw the dark lines and the shadow */
514 /* Again, this weird clip area. */
515 ge_cairo_rounded_rectangle (cr, -1.0, 0, width + radius + 2.0, height, radius, CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT);
517 ge_cairo_rounded_rectangle (cr, -radius - 1.0, 0, width + radius + 2.0, height, radius, CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT);
520 border = colors->spot[2];
522 ge_shade_color (&colors->shade[7], 0.92, &shadow);
525 if (progressbar->pulsing)
527 /* At the beginning of the bar. */
528 cairo_move_to (cr, 0.5 + radius, height + 0.5);
529 ge_cairo_rounded_corner (cr, 0.5, height + 0.5, radius + 1, CR_CORNER_BOTTOMLEFT);
530 ge_cairo_rounded_corner (cr, 0.5, -0.5, radius + 1, CR_CORNER_TOPLEFT);
531 ge_cairo_set_color (cr, &border);
534 cairo_move_to (cr, -0.5 + radius, height + 0.5);
535 ge_cairo_rounded_corner (cr, -0.5, height + 0.5, radius + 1, CR_CORNER_BOTTOMLEFT);
536 ge_cairo_rounded_corner (cr, -0.5, -0.5, radius + 1, CR_CORNER_TOPLEFT);
537 ge_cairo_set_color (cr, &shadow);
540 if (progressbar->value < 1.0 || progressbar->pulsing)
542 /* At the end of the bar. */
543 cairo_move_to (cr, width - 0.5 - radius, -0.5);
544 ge_cairo_rounded_corner (cr, width - 0.5, -0.5, radius + 1, CR_CORNER_TOPRIGHT);
545 ge_cairo_rounded_corner (cr, width - 0.5, height + 0.5, radius + 1, CR_CORNER_BOTTOMRIGHT);
546 ge_cairo_set_color (cr, &border);
549 cairo_move_to (cr, width + 0.5 - radius, -0.5);
550 ge_cairo_rounded_corner (cr, width + 0.5, -0.5, radius + 1, CR_CORNER_TOPRIGHT);
551 ge_cairo_rounded_corner (cr, width + 0.5, height + 0.5, radius + 1, CR_CORNER_BOTTOMRIGHT);
552 ge_cairo_set_color (cr, &shadow);
558 cairo_restore (cr); /* rotation, mirroring */
562 clearlooks_gummy_scale_draw_gradient (cairo_t *cr,
563 const CairoColor *fill,
564 const CairoColor *border,
565 int x, int y, int width, int height,
566 gboolean horizontal, gboolean in)
568 cairo_pattern_t *pattern;
572 ge_shade_color (fill, in? 0.95 : 1.1, &f1);
573 ge_shade_color (fill, in? 1.05 : 0.9, &f2);
575 pattern = cairo_pattern_create_linear (0, 0, horizontal ? 0 : width, horizontal ? height : 0);
576 cairo_pattern_add_color_stop_rgba (pattern, 0.0, f1.r, f1.g, f1.b, f1.a);
577 cairo_pattern_add_color_stop_rgba (pattern, 1.0, f2.r, f2.g, f2.b, f2.a);
579 cairo_rectangle (cr, x+0.5, y+0.5, width-1, height-1);
580 cairo_set_source (cr, pattern);
582 cairo_pattern_destroy (pattern);
584 clearlooks_set_mixed_color (cr, border, fill, 0.2);
585 ge_cairo_stroke_rectangle (cr, x, y, width, height);
588 #define TROUGH_SIZE 6
590 clearlooks_gummy_draw_scale_trough (cairo_t *cr,
591 const ClearlooksColors *colors,
592 const WidgetParameters *params,
593 const SliderParameters *slider,
594 int x, int y, int width, int height)
596 int trough_width, trough_height;
597 double translate_x, translate_y;
599 if (slider->horizontal)
601 trough_width = width-3;
602 trough_height = TROUGH_SIZE-2;
604 translate_x = x + 0.5;
605 translate_y = y + 0.5 + (height/2) - (TROUGH_SIZE/2);
609 trough_width = TROUGH_SIZE-2;
610 trough_height = height-3;
612 translate_x = x + 0.5 + (width/2) - (TROUGH_SIZE/2);
613 translate_y = y + 0.5;
616 cairo_set_line_width (cr, 1.0);
617 cairo_translate (cr, translate_x, translate_y);
619 if (!slider->fill_level)
620 params->style_functions->draw_inset (cr, ¶ms->parentbg, 0, 0, trough_width+2, trough_height+2, 0, 0);
622 cairo_translate (cr, 1, 1);
624 if (!slider->lower && !slider->fill_level)
625 clearlooks_gummy_scale_draw_gradient (cr,
626 &colors->shade[2], /* bottom */
627 &colors->shade[6], /* border */
628 0, 0, trough_width, trough_height,
629 slider->horizontal, TRUE);
630 else if (!slider->fill_level)
631 clearlooks_gummy_scale_draw_gradient (cr,
632 &colors->spot[1], /* bottom */
633 &colors->spot[2], /* border */
634 0, 0, trough_width, trough_height,
635 slider->horizontal, FALSE);
637 CairoColor c1 = colors->spot[1];
638 CairoColor c2 = colors->spot[2];
643 clearlooks_gummy_scale_draw_gradient (cr,
646 0, 0, trough_width, trough_height,
647 slider->horizontal, FALSE);
653 clearlooks_gummy_draw_tab (cairo_t *cr,
654 const ClearlooksColors *colors,
655 const WidgetParameters *params,
656 const TabParameters *tab,
657 int x, int y, int width, int height)
660 const CairoColor *border = &colors->shade[5];
661 const CairoColor *stripe_fill = &colors->spot[1];
662 const CairoColor *stripe_border = &colors->spot[2];
663 const CairoColor *fill;
665 cairo_pattern_t *pattern;
670 radius = MIN (params->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
673 cairo_rectangle (cr, x, y, width, height);
677 /* Translate and set line width */
678 cairo_set_line_width (cr, 1.0);
679 cairo_translate (cr, x+0.5, y+0.5);
681 /* Make the tabs slightly bigger than they should be, to create a gap */
682 /* And calculate the strip size too, while you're at it */
683 if (tab->gap_side == CL_GAP_TOP || tab->gap_side == CL_GAP_BOTTOM)
686 strip_size = 2.0/height; /* 2 pixel high strip */
688 if (tab->gap_side == CL_GAP_TOP)
689 cairo_translate (cr, 0.0, -3.0); /* gap at the other side */
694 strip_size = 2.0/width;
696 if (tab->gap_side == CL_GAP_LEFT)
697 cairo_translate (cr, -3.0, 0.0); /* gap at the other side */
700 /* Set the fill color */
701 fill = &colors->bg[params->state_type];
704 ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1,
705 radius, params->corners);
708 ge_cairo_set_color (cr, fill);
714 ShadowParameters shadow;
716 shadow.shadow = CL_SHADOW_OUT;
717 shadow.corners = params->corners;
719 clearlooks_gummy_draw_highlight_and_shade (cr, &colors->bg[0], &shadow,
720 width, height, radius);
726 CairoColor shade1, shade2, shade3;
728 pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-1 : 0,
729 tab->gap_side == CL_GAP_TOP ? height-2 : 1,
730 tab->gap_side == CL_GAP_RIGHT ? width : 0,
731 tab->gap_side == CL_GAP_BOTTOM ? height : 0);
733 ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
735 ge_shade_color (fill, 1.14, &hilight);
736 ge_shade_color (fill, SHADE_TOP, &shade1);
737 ge_shade_color (fill, SHADE_CENTER_TOP, &shade2);
738 ge_shade_color (fill, SHADE_BOTTOM, &shade3);
740 cairo_pattern_add_color_stop_rgb (pattern, 0.0, hilight.r, hilight.g, hilight.b);
741 cairo_pattern_add_color_stop_rgb (pattern, 1.0/height, hilight.r, hilight.g, hilight.b);
742 cairo_pattern_add_color_stop_rgb (pattern, 1.0/height, shade1.r, shade1.g, shade1.b);
743 cairo_pattern_add_color_stop_rgb (pattern, 0.45, shade2.r, shade2.g, shade2.b);
744 cairo_pattern_add_color_stop_rgb (pattern, 0.45, fill->r, fill->g, fill->b);
745 cairo_pattern_add_color_stop_rgb (pattern, 1.0, shade3.r, shade3.g, shade3.b);
746 cairo_set_source (cr, pattern);
748 cairo_pattern_destroy (pattern);
753 pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-2 : 0,
754 tab->gap_side == CL_GAP_TOP ? height-2 : 0,
755 tab->gap_side == CL_GAP_RIGHT ? width : 0,
756 tab->gap_side == CL_GAP_BOTTOM ? height : 0);
758 ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
760 cairo_pattern_add_color_stop_rgba (pattern, 0.0, stripe_fill->r, stripe_fill->g, stripe_fill->b, 0.5);
761 cairo_pattern_add_color_stop_rgba (pattern, 0.8, fill->r, fill->g, fill->b, 0.0);
762 cairo_set_source (cr, pattern);
764 cairo_pattern_destroy (pattern);
767 ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
771 ge_cairo_set_color (cr, border);
776 pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-2 : 2,
777 tab->gap_side == CL_GAP_TOP ? height-2 : 2,
778 tab->gap_side == CL_GAP_RIGHT ? width : 2,
779 tab->gap_side == CL_GAP_BOTTOM ? height : 2);
781 cairo_pattern_add_color_stop_rgb (pattern, 0.0, stripe_border->r, stripe_border->g, stripe_border->b);
782 cairo_pattern_add_color_stop_rgb (pattern, 0.8, border->r, border->g, border->b);
783 cairo_set_source (cr, pattern);
785 cairo_pattern_destroy (pattern);
790 clearlooks_gummy_draw_separator (cairo_t *cr,
791 const ClearlooksColors *colors,
792 const WidgetParameters *widget,
793 const SeparatorParameters *separator,
794 int x, int y, int width, int height)
798 CairoColor color = colors->shade[3];
800 ge_shade_color (&color, 1.3, &hilight);
803 cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
805 if (separator->horizontal)
807 cairo_set_line_width (cr, 1.0);
808 cairo_translate (cr, x, y+0.5);
810 cairo_move_to (cr, 0.0, 0.0);
811 cairo_line_to (cr, width, 0.0);
812 ge_cairo_set_color (cr, &color);
815 cairo_move_to (cr, 0.0, 1.0);
816 cairo_line_to (cr, width, 1.0);
817 ge_cairo_set_color (cr, &hilight);
822 cairo_set_line_width (cr, 1.0);
823 cairo_translate (cr, x+0.5, y);
825 cairo_move_to (cr, 0.0, 0.0);
826 cairo_line_to (cr, 0.0, height);
827 ge_cairo_set_color (cr, &color);
830 cairo_move_to (cr, 1.0, 0.0);
831 cairo_line_to (cr, 1.0, height);
832 ge_cairo_set_color (cr, &hilight);
840 clearlooks_gummy_draw_slider (cairo_t *cr,
841 const ClearlooksColors *colors,
842 const WidgetParameters *params,
843 int x, int y, int width, int height)
845 const CairoColor *border = &colors->shade[7];
847 CairoColor shade1, shade2, shade3;
848 cairo_pattern_t *pattern;
852 cairo_set_line_width (cr, 1.0);
853 cairo_translate (cr, x, y);
855 cairo_translate (cr, -0.5, -0.5);
857 ge_shade_color (&colors->bg[params->state_type], 1.0, &fill);
858 if (params->prelight)
859 ge_shade_color (&fill, 1.04, &fill);
861 ge_shade_color (&fill, SHADE_TOP, &shade1);
862 ge_shade_color (&fill, SHADE_CENTER_TOP, &shade2);
863 ge_shade_color (&fill, SHADE_BOTTOM, &shade3);
865 pattern = cairo_pattern_create_linear (1, 1, 1, height-2);
866 cairo_pattern_add_color_stop_rgb(pattern, 0, shade1.r, shade1.g, shade1.b);
867 cairo_pattern_add_color_stop_rgb(pattern, 0.5, shade2.r, shade2.g, shade2.b);
868 cairo_pattern_add_color_stop_rgb(pattern, 0.5, fill.r, fill.g, fill.b);
869 cairo_pattern_add_color_stop_rgb(pattern, 1.0, shade3.r, shade3.g, shade3.b);
870 cairo_rectangle (cr, 1, 1, width-2, height-2);
871 cairo_set_source (cr, pattern);
873 cairo_pattern_destroy (pattern);
875 clearlooks_set_mixed_color (cr, border, &fill, 0.2);
876 if (params->prelight)
877 ge_cairo_set_color (cr, &colors->spot[2]);
878 ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, 2.5, params->corners);
882 shift_x = (width%2 == 0 ? 1 : 0);
883 bar_x = width/2-3+shift_x;
884 cairo_translate (cr, 0.5, 0.5);
885 ge_cairo_set_color (cr, border);
886 for (i=0; i<3-shift_x; i++)
888 cairo_move_to (cr, bar_x, 4);
889 cairo_line_to (cr, bar_x, height-5);
894 clearlooks_gummy_draw_top_left_highlight (cr, &fill, params, width, height, 2.0);
898 clearlooks_gummy_draw_slider_button (cairo_t *cr,
899 const ClearlooksColors *colors,
900 const WidgetParameters *params,
901 const SliderParameters *slider,
902 int x, int y, int width, int height)
904 double radius = MIN (params->radius, MIN ((width - 1.0) / 2.0, (height - 1.0) / 2.0));
906 cairo_set_line_width (cr, 1.0);
908 if (!slider->horizontal)
909 ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
911 cairo_translate (cr, x+0.5, y+0.5);
913 params->style_functions->draw_shadow (cr, colors, radius, width-1, height-1);
914 params->style_functions->draw_slider (cr, colors, params, 1, 1, width-2, height-2);
918 clearlooks_gummy_draw_scrollbar_stepper (cairo_t *cr,
919 const ClearlooksColors *colors,
920 const WidgetParameters *widget,
921 const ScrollBarParameters *scrollbar,
922 const ScrollBarStepperParameters *stepper,
923 int x, int y, int width, int height)
925 CairoCorners corners = CR_CORNER_NONE;
926 const CairoColor *border = &colors->shade[scrollbar->has_color ? 7 : 6];
928 CairoColor shade1, shade2, shade3;
929 cairo_pattern_t *pattern;
930 ShadowParameters shadow;
931 double radius = MIN (widget->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
933 if (scrollbar->horizontal)
935 if (stepper->stepper == CL_STEPPER_A)
936 corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
937 else if (stepper->stepper == CL_STEPPER_D)
938 corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
942 if (stepper->stepper == CL_STEPPER_A)
943 corners = CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT;
944 else if (stepper->stepper == CL_STEPPER_D)
945 corners = CR_CORNER_BOTTOMLEFT | CR_CORNER_BOTTOMRIGHT;
948 cairo_translate (cr, x, y);
949 cairo_set_line_width (cr, 1);
951 ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius, corners);
953 if (scrollbar->horizontal)
954 pattern = cairo_pattern_create_linear (0, 0, 0, height);
956 pattern = cairo_pattern_create_linear (0, 0, width, 0);
958 fill = colors->bg[widget->state_type];
959 ge_shade_color(&fill, SHADE_TOP, &shade1);
960 ge_shade_color(&fill, SHADE_CENTER_TOP, &shade2);
961 ge_shade_color(&fill, SHADE_BOTTOM, &shade3);
963 cairo_pattern_add_color_stop_rgb(pattern, 0, shade1.r, shade1.g, shade1.b);
964 cairo_pattern_add_color_stop_rgb(pattern, 0.5, shade2.r, shade2.g, shade2.b);
965 cairo_pattern_add_color_stop_rgb(pattern, 0.5, fill.r, fill.g, fill.b);
966 cairo_pattern_add_color_stop_rgb(pattern, 1.0, shade3.r, shade3.g, shade3.b);
967 cairo_set_source (cr, pattern);
969 cairo_pattern_destroy (pattern);
971 cairo_translate (cr, 0.5, 0.5);
972 clearlooks_gummy_draw_top_left_highlight (cr, &fill, widget, width, height, (stepper->stepper == CL_STEPPER_A) ? radius : 0);
973 cairo_translate (cr, -0.5, -0.5);
975 ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, radius, corners);
976 clearlooks_set_mixed_color (cr, border, &fill, 0.2);
979 cairo_translate (cr, 0.5, 0.5);
980 shadow.shadow = CL_SHADOW_OUT;
981 shadow.corners = corners;
985 clearlooks_gummy_draw_scrollbar_slider (cairo_t *cr,
986 const ClearlooksColors *colors,
987 const WidgetParameters *widget,
988 const ScrollBarParameters *scrollbar,
989 int x, int y, int width, int height)
991 CairoColor fill = scrollbar->color;
992 CairoColor border, handles;
994 CairoColor shade1, shade2, shade3;
995 cairo_pattern_t *pattern;
998 gdouble hue_scroll, brightness_scroll, saturation_scroll;
999 gdouble hue_bg, brightness_bg, saturation_bg;
1001 ge_hsb_from_color (&fill, &hue_scroll, &saturation_scroll, &brightness_scroll);
1002 ge_hsb_from_color (&colors->bg[0], &hue_bg, &saturation_bg, &brightness_bg);
1004 /* Set the right color for border and handles */
1005 if ((fabs(saturation_scroll - saturation_bg) < 0.30) &&
1006 (fabs(brightness_scroll - brightness_bg) < 0.20))
1007 ge_shade_color (&fill, 0.475, &border);
1009 ge_shade_color (&fill, 0.575, &border);
1010 /* The following lines increase contrast when the HUE is between 25 and 195, */
1011 /* fixing a LOT of colorschemes! */
1012 if (scrollbar->has_color && (hue_scroll < 195) && (hue_scroll > 25))
1013 ge_shade_color (&border, 0.85, &border);
1016 ge_mix_color (&border, &fill, scrollbar->has_color? 0.3 : 0.2, &border);
1018 if (scrollbar->junction & CL_JUNCTION_BEGIN)
1020 if (scrollbar->horizontal)
1031 if (scrollbar->junction & CL_JUNCTION_END)
1033 if (scrollbar->horizontal)
1039 if (!scrollbar->horizontal)
1040 ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
1042 cairo_translate (cr, x, y);
1044 if (widget->prelight)
1045 ge_shade_color (&fill, 1.04, &fill);
1047 cairo_set_line_width (cr, 1);
1049 ge_shade_color (&fill, TOPLEFT_HIGHLIGHT_SHADE, &hilight);
1050 ge_shade_color (&fill, SHADE_TOP, &shade1);
1051 ge_shade_color (&fill, SHADE_CENTER_TOP, &shade2);
1052 ge_shade_color (&fill, SHADE_BOTTOM, &shade3);
1054 pattern = cairo_pattern_create_linear (1, 1, 1, height-2);
1055 cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
1056 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1057 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill.r, fill.g, fill.b);
1058 cairo_pattern_add_color_stop_rgb (pattern, 1, shade3.r, shade3.g, shade3.b);
1059 cairo_rectangle (cr, 1, 1, width-2, height-2);
1060 cairo_set_source (cr, pattern);
1062 cairo_pattern_destroy (pattern);
1064 if (scrollbar->has_color)
1066 cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, 0.2);
1067 ge_cairo_stroke_rectangle (cr, 1.5, 1.5, width-3, height-3);
1071 cairo_move_to (cr, 1.5, height-1.5);
1072 cairo_line_to (cr, 1.5, 1.5);
1073 cairo_line_to (cr, width-1.5, 1.5);
1074 cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, TOPLEFT_HIGHLIGHT_ALPHA);
1078 ge_cairo_set_color (cr, &border);
1079 ge_cairo_stroke_rectangle (cr, 0.5, 0.5, width-1, height-1);
1082 bar_x = width/2 - 4;
1083 cairo_translate(cr, 0.5, 0.5);
1084 ge_cairo_set_color (cr, &handles);
1087 cairo_move_to (cr, bar_x, 5);
1088 cairo_line_to (cr, bar_x, height-6);
1095 clearlooks_gummy_draw_list_view_header (cairo_t *cr,
1096 const ClearlooksColors *colors,
1097 const WidgetParameters *params,
1098 const ListViewHeaderParameters *header,
1099 int x, int y, int width, int height)
1102 CairoColor *border = !params->prelight? (CairoColor*)&colors->shade[4] : (CairoColor*)&colors->spot[1];
1104 const CairoColor *border = &colors->shade[4];
1105 const CairoColor *fill = &colors->bg[params->state_type];
1107 CairoColor shade1, shade2, shade3;
1109 cairo_pattern_t *pattern;
1111 ge_shade_color (fill, 1.11, &hilight);
1112 ge_shade_color (fill, LISTVIEW_SHADE_TOP, &shade1);
1113 ge_shade_color (fill, LISTVIEW_SHADE_CENTER_TOP, &shade2);
1114 ge_shade_color (fill, LISTVIEW_SHADE_BOTTOM, &shade3);
1116 cairo_translate (cr, x, y);
1117 cairo_set_line_width (cr, 1.0);
1120 pattern = cairo_pattern_create_linear (0, 0, 0, height);
1121 cairo_pattern_add_color_stop_rgb (pattern, 0.0, shade1.r, shade1.g, shade1.b);
1122 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1123 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1124 cairo_pattern_add_color_stop_rgb (pattern, 1.0-1.0/height, shade3.r, shade3.g, shade3.b);
1125 cairo_pattern_add_color_stop_rgb (pattern, 1.0-1.0/height, border->r, border->g, border->b);
1126 cairo_pattern_add_color_stop_rgb (pattern, 1.0, border->r, border->g, border->b);
1128 cairo_set_source (cr, pattern);
1129 cairo_rectangle (cr, 0, 0, width, height);
1132 cairo_pattern_destroy (pattern);
1134 /* Draw highlight */
1135 if (header->order == CL_ORDER_FIRST)
1137 cairo_move_to (cr, 0.5, height-1.5);
1138 cairo_line_to (cr, 0.5, 0.5);
1141 cairo_move_to (cr, 0.0, 0.5);
1143 cairo_line_to (cr, width, 0.5);
1145 ge_cairo_set_color (cr, &hilight);
1148 /* Draw resize grip */
1149 if ((params->ltr && header->order != CL_ORDER_LAST) ||
1150 (!params->ltr && header->order != CL_ORDER_FIRST) || header->resizable)
1152 SeparatorParameters separator;
1153 separator.horizontal = FALSE;
1156 params->style_functions->draw_separator (cr, colors, params, &separator,
1157 width-1.5, 4.0, 2, height-8.0);
1159 params->style_functions->draw_separator (cr, colors, params, &separator,
1160 1.5, 4.0, 2, height-8.0);
1165 clearlooks_gummy_draw_toolbar (cairo_t *cr,
1166 const ClearlooksColors *colors,
1167 const WidgetParameters *widget,
1168 const ToolbarParameters *toolbar,
1169 int x, int y, int width, int height)
1173 const CairoColor *fill = &colors->bg[GTK_STATE_NORMAL];
1174 const CairoColor *dark = &colors->shade[3];
1176 ge_shade_color (fill, toolbar->style == 1 ? 1.1 : 1.05, &light);
1178 cairo_set_line_width (cr, 1.0);
1179 cairo_translate (cr, x, y);
1181 if (toolbar->style == 1) /* Enable Extra features */
1183 cairo_pattern_t *pattern;
1184 CairoColor shade1, shade2, shade3;
1186 ge_shade_color (fill, TOOLBAR_SHADE_TOP, &shade1);
1187 ge_shade_color (fill, TOOLBAR_SHADE_CENTER_TOP, &shade2);
1188 ge_shade_color (fill, TOOLBAR_SHADE_BOTTOM, &shade3);
1191 pattern = cairo_pattern_create_linear (0, 0, 0, height);
1192 cairo_pattern_add_color_stop_rgb (pattern, 0.0, shade1.r, shade1.g, shade1.b);
1193 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1194 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1195 cairo_pattern_add_color_stop_rgb (pattern, 1.0, shade3.r, shade3.g, shade3.b);
1197 cairo_set_source (cr, pattern);
1198 cairo_rectangle (cr, 0, 0, width, height);
1201 cairo_pattern_destroy (pattern);
1205 ge_cairo_set_color (cr, fill);
1209 if (!toolbar->topmost)
1211 /* Draw highlight */
1212 cairo_move_to (cr, 0, 0.5);
1213 cairo_line_to (cr, width-1, 0.5);
1214 ge_cairo_set_color (cr, &light);
1219 cairo_move_to (cr, 0, height-0.5);
1220 cairo_line_to (cr, width-1, height-0.5);
1221 ge_cairo_set_color (cr, dark);
1226 clearlooks_gummy_draw_menuitem (cairo_t *cr,
1227 const ClearlooksColors *colors,
1228 const WidgetParameters *params,
1229 int x, int y, int width, int height)
1231 const CairoColor *fill = &colors->spot[1];
1232 const CairoColor *border = &colors->spot[2];
1233 CairoColor shade1, shade2, shade3;
1234 cairo_pattern_t *pattern;
1236 ge_shade_color (fill, SHADE_TOP, &shade1);
1237 ge_shade_color (fill, SHADE_CENTER_TOP, &shade2);
1238 ge_shade_color (fill, SHADE_BOTTOM, &shade3);
1239 cairo_set_line_width (cr, 1.0);
1241 ge_cairo_rounded_rectangle (cr, x+0.5, y+0.5, width - 1, height - 1, params->radius, params->corners);
1243 pattern = cairo_pattern_create_linear (x, y, x, y + height);
1244 cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
1245 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1246 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1247 cairo_pattern_add_color_stop_rgb (pattern, 1, shade3.r, shade3.g, shade3.b);
1249 cairo_set_source (cr, pattern);
1250 cairo_fill_preserve (cr);
1251 cairo_pattern_destroy (pattern);
1253 ge_cairo_set_color (cr, border);
1258 clearlooks_gummy_draw_menubaritem (cairo_t *cr,
1259 const ClearlooksColors *colors,
1260 const WidgetParameters *params,
1261 int x, int y, int width, int height)
1263 const CairoColor *fill = &colors->spot[1];
1264 const CairoColor *border = &colors->spot[2];
1265 CairoColor shade1, shade2, shade3;
1266 cairo_pattern_t *pattern;
1268 ge_shade_color (fill, SHADE_TOP, &shade1);
1269 ge_shade_color (fill, SHADE_CENTER_TOP, &shade2);
1270 ge_shade_color (fill, SHADE_BOTTOM, &shade3);
1271 cairo_set_line_width (cr, 1.0);
1273 ge_cairo_rounded_rectangle (cr, x+0.5, y+0.5, width - 1, height - 1, params->radius, params->corners);
1275 pattern = cairo_pattern_create_linear (x, y, x, y + height);
1276 cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
1277 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1278 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1279 cairo_pattern_add_color_stop_rgb (pattern, 1, shade3.r, shade3.g, shade3.b);
1281 cairo_set_source (cr, pattern);
1282 cairo_fill_preserve (cr);
1283 cairo_pattern_destroy (pattern);
1285 ge_cairo_set_color (cr, border);
1290 clearlooks_gummy_draw_selected_cell (cairo_t *cr,
1291 const ClearlooksColors *colors,
1292 const WidgetParameters *params,
1293 int x, int y, int width, int height)
1298 color = colors->base[params->state_type];
1300 color = colors->base[GTK_STATE_ACTIVE];
1302 clearlooks_draw_gummy_gradient (cr, x, y, width, height, &color, params->disabled, 0.0, CR_CORNER_NONE);
1306 clearlooks_gummy_draw_statusbar (cairo_t *cr,
1307 const ClearlooksColors *colors,
1308 const WidgetParameters *widget,
1309 int x, int y, int width, int height)
1314 const CairoColor *dark = &colors->shade[3];
1317 ge_shade_color (dark, 1.3, &hilight);
1319 cairo_set_line_width (cr, 1);
1320 cairo_translate (cr, x, y+0.5);
1321 cairo_move_to (cr, 0, 0);
1322 cairo_line_to (cr, width, 0);
1323 ge_cairo_set_color (cr, dark);
1326 cairo_translate (cr, 0, 1);
1327 cairo_move_to (cr, 0, 0);
1328 cairo_line_to (cr, width, 0);
1329 ge_cairo_set_color (cr, &hilight);
1334 clearlooks_gummy_draw_radiobutton (cairo_t *cr,
1335 const ClearlooksColors *colors,
1336 const WidgetParameters *widget,
1337 const CheckboxParameters *checkbox,
1338 int x, int y, int width, int height)
1343 const CairoColor *border;
1344 const CairoColor *dot;
1346 CairoColor highlight;
1347 cairo_pattern_t *pt;
1348 gboolean inconsistent;
1349 gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
1351 inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
1352 draw_bullet |= inconsistent;
1354 if (widget->disabled)
1356 border = &colors->shade[5];
1357 dot = &colors->shade[6];
1361 if (widget->prelight)
1362 border = &colors->spot[2];
1364 border = &colors->shade[6];
1365 dot = &colors->text[0];
1368 ge_shade_color (&widget->parentbg, 0.9, &shadow);
1369 ge_shade_color (&widget->parentbg, 1.1, &highlight);
1371 pt = cairo_pattern_create_linear (0, 0, 13, 13);
1372 cairo_pattern_add_color_stop_rgb (pt, 0.0, shadow.r, shadow.b, shadow.g);
1373 cairo_pattern_add_color_stop_rgba (pt, 0.5, shadow.r, shadow.b, shadow.g, 0.5);
1374 cairo_pattern_add_color_stop_rgba (pt, 0.5, highlight.r, highlight.g, highlight.b, 0.5);
1375 cairo_pattern_add_color_stop_rgb (pt, 1.0, highlight.r, highlight.g, highlight.b);
1377 cairo_translate (cr, x, y);
1379 cairo_set_line_width (cr, 2);
1380 cairo_arc (cr, 7, 7, 6, 0, G_PI*2);
1381 cairo_set_source (cr, pt);
1383 cairo_pattern_destroy (pt);
1385 cairo_set_line_width (cr, 1);
1387 cairo_arc (cr, 7, 7, 5.5, 0, G_PI*2);
1389 if (!widget->disabled)
1391 if (widget->prelight)
1392 clearlooks_set_mixed_color (cr, &colors->base[0], &colors->spot[1], 0.5);
1394 ge_cairo_set_color (cr, &colors->base[0]);
1395 cairo_fill_preserve (cr);
1398 ge_cairo_set_color (cr, border);
1405 cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
1406 cairo_set_line_width (cr, 4);
1408 cairo_move_to(cr, 5, 7);
1409 cairo_line_to(cr, 9, 7);
1411 ge_cairo_set_color (cr, dot);
1416 cairo_arc (cr, 7, 7, 3, 0, G_PI*2);
1417 ge_cairo_set_color (cr, dot);
1420 cairo_arc (cr, 6, 6, 1, 0, G_PI*2);
1421 cairo_set_source_rgba (cr, highlight.r, highlight.g, highlight.b, 0.5);
1428 clearlooks_gummy_draw_checkbox (cairo_t *cr,
1429 const ClearlooksColors *colors,
1430 const WidgetParameters *widget,
1431 const CheckboxParameters *checkbox,
1432 int x, int y, int width, int height)
1434 const CairoColor *border;
1435 const CairoColor *dot;
1436 gboolean inconsistent = FALSE;
1437 gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
1439 inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
1440 draw_bullet |= inconsistent;
1442 if (widget->disabled)
1444 border = &colors->shade[5];
1445 dot = &colors->shade[6];
1449 if (widget->prelight)
1450 border = &colors->spot[2];
1452 border = &colors->shade[6];
1453 dot = &colors->text[GTK_STATE_NORMAL];
1456 cairo_translate (cr, x, y);
1457 cairo_set_line_width (cr, 1);
1459 if (widget->xthickness > 2 && widget->ythickness > 2)
1461 widget->style_functions->draw_inset (cr, &widget->parentbg, 0.5, 0.5,
1462 width-1, height-1, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
1464 /* Draw the rectangle for the checkbox itself */
1465 ge_cairo_rounded_rectangle (cr, 1.5, 1.5,
1466 width-3, height-3, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
1470 /* Draw the rectangle for the checkbox itself */
1471 ge_cairo_rounded_rectangle (cr, 0.5, 0.5,
1472 width-1, height-1, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
1475 if (!widget->disabled)
1477 if (widget->prelight)
1478 clearlooks_set_mixed_color (cr, &colors->base[0], &colors->spot[1], 0.5);
1480 ge_cairo_set_color (cr, &colors->base[0]);
1481 cairo_fill_preserve (cr);
1484 ge_cairo_set_color (cr, border);
1489 if (inconsistent) /* Inconsistent */
1491 cairo_set_line_width (cr, 2.0);
1492 cairo_move_to (cr, 3, height*0.5);
1493 cairo_line_to (cr, width-3, height*0.5);
1497 cairo_set_line_width (cr, 1.7);
1498 cairo_move_to (cr, 0.5 + (width*0.2), (height*0.5));
1499 cairo_line_to (cr, 0.5 + (width*0.4), (height*0.7));
1501 cairo_curve_to (cr, 0.5 + (width*0.4), (height*0.7),
1502 0.5 + (width*0.5), (height*0.4),
1503 0.5 + (width*0.70), (height*0.25));
1507 ge_cairo_set_color (cr, dot);
1513 clearlooks_register_style_gummy (ClearlooksStyleFunctions *functions)
1515 functions->draw_button = clearlooks_gummy_draw_button;
1516 functions->draw_entry = clearlooks_gummy_draw_entry;
1517 functions->draw_progressbar_trough = clearlooks_gummy_draw_progressbar_trough;
1518 functions->draw_progressbar_fill = clearlooks_gummy_draw_progressbar_fill;
1519 functions->draw_scale_trough = clearlooks_gummy_draw_scale_trough;
1520 functions->draw_tab = clearlooks_gummy_draw_tab;
1521 functions->draw_separator = clearlooks_gummy_draw_separator;
1522 functions->draw_slider = clearlooks_gummy_draw_slider;
1523 functions->draw_slider_button = clearlooks_gummy_draw_slider_button;
1524 functions->draw_scrollbar_stepper = clearlooks_gummy_draw_scrollbar_stepper;
1525 functions->draw_scrollbar_slider = clearlooks_gummy_draw_scrollbar_slider;
1526 functions->draw_list_view_header = clearlooks_gummy_draw_list_view_header;
1527 functions->draw_toolbar = clearlooks_gummy_draw_toolbar;
1528 functions->draw_menuitem = clearlooks_gummy_draw_menuitem;
1529 functions->draw_menubaritem = clearlooks_gummy_draw_menubaritem;
1530 functions->draw_selected_cell = clearlooks_gummy_draw_selected_cell;
1531 functions->draw_statusbar = clearlooks_gummy_draw_statusbar;
1532 functions->draw_checkbox = clearlooks_gummy_draw_checkbox;
1533 functions->draw_radiobutton = clearlooks_gummy_draw_radiobutton;