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)
796 CairoColor color = colors->shade[3];
798 ge_shade_color (&color, 1.3, &hilight);
801 cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
803 if (separator->horizontal)
805 cairo_set_line_width (cr, 1.0);
806 cairo_translate (cr, x, y+0.5);
808 cairo_move_to (cr, 0.0, 0.0);
809 cairo_line_to (cr, width, 0.0);
810 ge_cairo_set_color (cr, &color);
813 cairo_move_to (cr, 0.0, 1.0);
814 cairo_line_to (cr, width, 1.0);
815 ge_cairo_set_color (cr, &hilight);
820 cairo_set_line_width (cr, 1.0);
821 cairo_translate (cr, x+0.5, y);
823 cairo_move_to (cr, 0.0, 0.0);
824 cairo_line_to (cr, 0.0, height);
825 ge_cairo_set_color (cr, &color);
828 cairo_move_to (cr, 1.0, 0.0);
829 cairo_line_to (cr, 1.0, height);
830 ge_cairo_set_color (cr, &hilight);
838 clearlooks_gummy_draw_slider (cairo_t *cr,
839 const ClearlooksColors *colors,
840 const WidgetParameters *params,
841 int x, int y, int width, int height)
843 const CairoColor *border = &colors->shade[7];
845 CairoColor shade1, shade2, shade3;
846 cairo_pattern_t *pattern;
850 cairo_set_line_width (cr, 1.0);
851 cairo_translate (cr, x, y);
853 cairo_translate (cr, -0.5, -0.5);
855 ge_shade_color (&colors->bg[params->state_type], 1.0, &fill);
856 if (params->prelight)
857 ge_shade_color (&fill, 1.04, &fill);
859 ge_shade_color (&fill, SHADE_TOP, &shade1);
860 ge_shade_color (&fill, SHADE_CENTER_TOP, &shade2);
861 ge_shade_color (&fill, SHADE_BOTTOM, &shade3);
863 pattern = cairo_pattern_create_linear (1, 1, 1, height-2);
864 cairo_pattern_add_color_stop_rgb(pattern, 0, shade1.r, shade1.g, shade1.b);
865 cairo_pattern_add_color_stop_rgb(pattern, 0.5, shade2.r, shade2.g, shade2.b);
866 cairo_pattern_add_color_stop_rgb(pattern, 0.5, fill.r, fill.g, fill.b);
867 cairo_pattern_add_color_stop_rgb(pattern, 1.0, shade3.r, shade3.g, shade3.b);
868 cairo_rectangle (cr, 1, 1, width-2, height-2);
869 cairo_set_source (cr, pattern);
871 cairo_pattern_destroy (pattern);
873 clearlooks_set_mixed_color (cr, border, &fill, 0.2);
874 if (params->prelight)
875 ge_cairo_set_color (cr, &colors->spot[2]);
876 ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, 2.5, params->corners);
880 shift_x = (width%2 == 0 ? 1 : 0);
881 bar_x = width/2-3+shift_x;
882 cairo_translate (cr, 0.5, 0.5);
883 ge_cairo_set_color (cr, border);
884 for (i=0; i<3-shift_x; i++)
886 cairo_move_to (cr, bar_x, 4);
887 cairo_line_to (cr, bar_x, height-5);
892 clearlooks_gummy_draw_top_left_highlight (cr, &fill, params, width, height, 2.0);
896 clearlooks_gummy_draw_slider_button (cairo_t *cr,
897 const ClearlooksColors *colors,
898 const WidgetParameters *params,
899 const SliderParameters *slider,
900 int x, int y, int width, int height)
902 double radius = MIN (params->radius, MIN ((width - 1.0) / 2.0, (height - 1.0) / 2.0));
904 cairo_set_line_width (cr, 1.0);
906 if (!slider->horizontal)
907 ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
909 cairo_translate (cr, x+0.5, y+0.5);
911 params->style_functions->draw_shadow (cr, colors, radius, width-1, height-1);
912 params->style_functions->draw_slider (cr, colors, params, 1, 1, width-2, height-2);
916 clearlooks_gummy_draw_scrollbar_stepper (cairo_t *cr,
917 const ClearlooksColors *colors,
918 const WidgetParameters *widget,
919 const ScrollBarParameters *scrollbar,
920 const ScrollBarStepperParameters *stepper,
921 int x, int y, int width, int height)
923 CairoCorners corners = CR_CORNER_NONE;
924 const CairoColor *border = &colors->shade[scrollbar->has_color ? 7 : 6];
926 CairoColor shade1, shade2, shade3;
927 cairo_pattern_t *pattern;
928 ShadowParameters shadow;
929 double radius = MIN (widget->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
931 if (scrollbar->horizontal)
933 if (stepper->stepper == CL_STEPPER_A)
934 corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
935 else if (stepper->stepper == CL_STEPPER_D)
936 corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
940 if (stepper->stepper == CL_STEPPER_A)
941 corners = CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT;
942 else if (stepper->stepper == CL_STEPPER_D)
943 corners = CR_CORNER_BOTTOMLEFT | CR_CORNER_BOTTOMRIGHT;
946 cairo_translate (cr, x, y);
947 cairo_set_line_width (cr, 1);
949 ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius, corners);
951 if (scrollbar->horizontal)
952 pattern = cairo_pattern_create_linear (0, 0, 0, height);
954 pattern = cairo_pattern_create_linear (0, 0, width, 0);
956 fill = colors->bg[widget->state_type];
957 ge_shade_color(&fill, SHADE_TOP, &shade1);
958 ge_shade_color(&fill, SHADE_CENTER_TOP, &shade2);
959 ge_shade_color(&fill, SHADE_BOTTOM, &shade3);
961 cairo_pattern_add_color_stop_rgb(pattern, 0, shade1.r, shade1.g, shade1.b);
962 cairo_pattern_add_color_stop_rgb(pattern, 0.5, shade2.r, shade2.g, shade2.b);
963 cairo_pattern_add_color_stop_rgb(pattern, 0.5, fill.r, fill.g, fill.b);
964 cairo_pattern_add_color_stop_rgb(pattern, 1.0, shade3.r, shade3.g, shade3.b);
965 cairo_set_source (cr, pattern);
967 cairo_pattern_destroy (pattern);
969 cairo_translate (cr, 0.5, 0.5);
970 clearlooks_gummy_draw_top_left_highlight (cr, &fill, widget, width, height, (stepper->stepper == CL_STEPPER_A) ? radius : 0);
971 cairo_translate (cr, -0.5, -0.5);
973 ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, radius, corners);
974 clearlooks_set_mixed_color (cr, border, &fill, 0.2);
977 cairo_translate (cr, 0.5, 0.5);
978 shadow.shadow = CL_SHADOW_OUT;
979 shadow.corners = corners;
983 clearlooks_gummy_draw_scrollbar_slider (cairo_t *cr,
984 const ClearlooksColors *colors,
985 const WidgetParameters *widget,
986 const ScrollBarParameters *scrollbar,
987 int x, int y, int width, int height)
989 CairoColor fill = scrollbar->color;
990 CairoColor border, handles;
992 CairoColor shade1, shade2, shade3;
993 cairo_pattern_t *pattern;
996 gdouble hue_scroll, brightness_scroll, saturation_scroll;
997 gdouble hue_bg, brightness_bg, saturation_bg;
999 ge_hsb_from_color (&fill, &hue_scroll, &saturation_scroll, &brightness_scroll);
1000 ge_hsb_from_color (&colors->bg[0], &hue_bg, &saturation_bg, &brightness_bg);
1002 /* Set the right color for border and handles */
1003 if ((fabs(saturation_scroll - saturation_bg) < 0.30) &&
1004 (fabs(brightness_scroll - brightness_bg) < 0.20))
1005 ge_shade_color (&fill, 0.475, &border);
1007 ge_shade_color (&fill, 0.575, &border);
1008 /* The following lines increase contrast when the HUE is between 25 and 195, */
1009 /* fixing a LOT of colorschemes! */
1010 if (scrollbar->has_color && (hue_scroll < 195) && (hue_scroll > 25))
1011 ge_shade_color (&border, 0.85, &border);
1014 ge_mix_color (&border, &fill, scrollbar->has_color? 0.3 : 0.2, &border);
1016 if (scrollbar->junction & CL_JUNCTION_BEGIN)
1018 if (scrollbar->horizontal)
1029 if (scrollbar->junction & CL_JUNCTION_END)
1031 if (scrollbar->horizontal)
1037 if (!scrollbar->horizontal)
1038 ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
1040 cairo_translate (cr, x, y);
1042 if (widget->prelight)
1043 ge_shade_color (&fill, 1.04, &fill);
1045 cairo_set_line_width (cr, 1);
1047 ge_shade_color (&fill, TOPLEFT_HIGHLIGHT_SHADE, &hilight);
1048 ge_shade_color (&fill, SHADE_TOP, &shade1);
1049 ge_shade_color (&fill, SHADE_CENTER_TOP, &shade2);
1050 ge_shade_color (&fill, SHADE_BOTTOM, &shade3);
1052 pattern = cairo_pattern_create_linear (1, 1, 1, height-2);
1053 cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
1054 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1055 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill.r, fill.g, fill.b);
1056 cairo_pattern_add_color_stop_rgb (pattern, 1, shade3.r, shade3.g, shade3.b);
1057 cairo_rectangle (cr, 1, 1, width-2, height-2);
1058 cairo_set_source (cr, pattern);
1060 cairo_pattern_destroy (pattern);
1062 if (scrollbar->has_color)
1064 cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, 0.2);
1065 ge_cairo_stroke_rectangle (cr, 1.5, 1.5, width-3, height-3);
1069 cairo_move_to (cr, 1.5, height-1.5);
1070 cairo_line_to (cr, 1.5, 1.5);
1071 cairo_line_to (cr, width-1.5, 1.5);
1072 cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, TOPLEFT_HIGHLIGHT_ALPHA);
1076 ge_cairo_set_color (cr, &border);
1077 ge_cairo_stroke_rectangle (cr, 0.5, 0.5, width-1, height-1);
1080 bar_x = width/2 - 4;
1081 cairo_translate(cr, 0.5, 0.5);
1082 ge_cairo_set_color (cr, &handles);
1085 cairo_move_to (cr, bar_x, 5);
1086 cairo_line_to (cr, bar_x, height-6);
1093 clearlooks_gummy_draw_list_view_header (cairo_t *cr,
1094 const ClearlooksColors *colors,
1095 const WidgetParameters *params,
1096 const ListViewHeaderParameters *header,
1097 int x, int y, int width, int height)
1100 CairoColor *border = !params->prelight? (CairoColor*)&colors->shade[4] : (CairoColor*)&colors->spot[1];
1102 const CairoColor *border = &colors->shade[4];
1103 const CairoColor *fill = &colors->bg[params->state_type];
1105 CairoColor shade1, shade2, shade3;
1107 cairo_pattern_t *pattern;
1109 ge_shade_color (fill, 1.11, &hilight);
1110 ge_shade_color (fill, LISTVIEW_SHADE_TOP, &shade1);
1111 ge_shade_color (fill, LISTVIEW_SHADE_CENTER_TOP, &shade2);
1112 ge_shade_color (fill, LISTVIEW_SHADE_BOTTOM, &shade3);
1114 cairo_translate (cr, x, y);
1115 cairo_set_line_width (cr, 1.0);
1118 pattern = cairo_pattern_create_linear (0, 0, 0, height);
1119 cairo_pattern_add_color_stop_rgb (pattern, 0.0, shade1.r, shade1.g, shade1.b);
1120 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1121 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1122 cairo_pattern_add_color_stop_rgb (pattern, 1.0-1.0/height, shade3.r, shade3.g, shade3.b);
1123 cairo_pattern_add_color_stop_rgb (pattern, 1.0-1.0/height, border->r, border->g, border->b);
1124 cairo_pattern_add_color_stop_rgb (pattern, 1.0, border->r, border->g, border->b);
1126 cairo_set_source (cr, pattern);
1127 cairo_rectangle (cr, 0, 0, width, height);
1130 cairo_pattern_destroy (pattern);
1132 /* Draw highlight */
1133 if (header->order == CL_ORDER_FIRST)
1135 cairo_move_to (cr, 0.5, height-1.5);
1136 cairo_line_to (cr, 0.5, 0.5);
1139 cairo_move_to (cr, 0.0, 0.5);
1141 cairo_line_to (cr, width, 0.5);
1143 ge_cairo_set_color (cr, &hilight);
1146 /* Draw resize grip */
1147 if ((params->ltr && header->order != CL_ORDER_LAST) ||
1148 (!params->ltr && header->order != CL_ORDER_FIRST) || header->resizable)
1150 SeparatorParameters separator;
1151 separator.horizontal = FALSE;
1154 params->style_functions->draw_separator (cr, colors, params, &separator,
1155 width-1.5, 4.0, 2, height-8.0);
1157 params->style_functions->draw_separator (cr, colors, params, &separator,
1158 1.5, 4.0, 2, height-8.0);
1163 clearlooks_gummy_draw_toolbar (cairo_t *cr,
1164 const ClearlooksColors *colors,
1165 const WidgetParameters *widget,
1166 const ToolbarParameters *toolbar,
1167 int x, int y, int width, int height)
1169 const CairoColor *fill = &colors->bg[GTK_STATE_NORMAL];
1170 const CairoColor *dark = &colors->shade[3];
1172 ge_shade_color (fill, toolbar->style == 1 ? 1.1 : 1.05, &light);
1174 cairo_set_line_width (cr, 1.0);
1175 cairo_translate (cr, x, y);
1177 if (toolbar->style == 1) /* Enable Extra features */
1179 cairo_pattern_t *pattern;
1180 CairoColor shade1, shade2, shade3;
1182 ge_shade_color (fill, TOOLBAR_SHADE_TOP, &shade1);
1183 ge_shade_color (fill, TOOLBAR_SHADE_CENTER_TOP, &shade2);
1184 ge_shade_color (fill, TOOLBAR_SHADE_BOTTOM, &shade3);
1187 pattern = cairo_pattern_create_linear (0, 0, 0, height);
1188 cairo_pattern_add_color_stop_rgb (pattern, 0.0, shade1.r, shade1.g, shade1.b);
1189 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1190 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1191 cairo_pattern_add_color_stop_rgb (pattern, 1.0, shade3.r, shade3.g, shade3.b);
1193 cairo_set_source (cr, pattern);
1194 cairo_rectangle (cr, 0, 0, width, height);
1197 cairo_pattern_destroy (pattern);
1201 ge_cairo_set_color (cr, fill);
1205 if (!toolbar->topmost)
1207 /* Draw highlight */
1208 cairo_move_to (cr, 0, 0.5);
1209 cairo_line_to (cr, width-1, 0.5);
1210 ge_cairo_set_color (cr, &light);
1215 cairo_move_to (cr, 0, height-0.5);
1216 cairo_line_to (cr, width-1, height-0.5);
1217 ge_cairo_set_color (cr, dark);
1222 clearlooks_gummy_draw_menuitem (cairo_t *cr,
1223 const ClearlooksColors *colors,
1224 const WidgetParameters *params,
1225 int x, int y, int width, int height)
1227 const CairoColor *fill = &colors->spot[1];
1228 const CairoColor *border = &colors->spot[2];
1229 CairoColor shade1, shade2, shade3;
1230 cairo_pattern_t *pattern;
1232 ge_shade_color (fill, SHADE_TOP, &shade1);
1233 ge_shade_color (fill, SHADE_CENTER_TOP, &shade2);
1234 ge_shade_color (fill, SHADE_BOTTOM, &shade3);
1235 cairo_set_line_width (cr, 1.0);
1237 ge_cairo_rounded_rectangle (cr, x+0.5, y+0.5, width - 1, height - 1, params->radius, params->corners);
1239 pattern = cairo_pattern_create_linear (x, y, x, y + height);
1240 cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
1241 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1242 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1243 cairo_pattern_add_color_stop_rgb (pattern, 1, shade3.r, shade3.g, shade3.b);
1245 cairo_set_source (cr, pattern);
1246 cairo_fill_preserve (cr);
1247 cairo_pattern_destroy (pattern);
1249 ge_cairo_set_color (cr, border);
1254 clearlooks_gummy_draw_menubaritem (cairo_t *cr,
1255 const ClearlooksColors *colors,
1256 const WidgetParameters *params,
1257 int x, int y, int width, int height)
1259 const CairoColor *fill = &colors->spot[1];
1260 const CairoColor *border = &colors->spot[2];
1261 CairoColor shade1, shade2, shade3;
1262 cairo_pattern_t *pattern;
1264 ge_shade_color (fill, SHADE_TOP, &shade1);
1265 ge_shade_color (fill, SHADE_CENTER_TOP, &shade2);
1266 ge_shade_color (fill, SHADE_BOTTOM, &shade3);
1267 cairo_set_line_width (cr, 1.0);
1269 ge_cairo_rounded_rectangle (cr, x+0.5, y+0.5, width - 1, height - 1, params->radius, params->corners);
1271 pattern = cairo_pattern_create_linear (x, y, x, y + height);
1272 cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
1273 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1274 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1275 cairo_pattern_add_color_stop_rgb (pattern, 1, shade3.r, shade3.g, shade3.b);
1277 cairo_set_source (cr, pattern);
1278 cairo_fill_preserve (cr);
1279 cairo_pattern_destroy (pattern);
1281 ge_cairo_set_color (cr, border);
1286 clearlooks_gummy_draw_selected_cell (cairo_t *cr,
1287 const ClearlooksColors *colors,
1288 const WidgetParameters *params,
1289 int x, int y, int width, int height)
1294 color = colors->base[params->state_type];
1296 color = colors->base[GTK_STATE_ACTIVE];
1298 clearlooks_draw_gummy_gradient (cr, x, y, width, height, &color, params->disabled, 0.0, CR_CORNER_NONE);
1302 clearlooks_gummy_draw_statusbar (cairo_t *cr,
1303 const ClearlooksColors *colors,
1304 const WidgetParameters *widget,
1305 int x, int y, int width, int height)
1307 const CairoColor *dark = &colors->shade[3];
1310 ge_shade_color (dark, 1.3, &hilight);
1312 cairo_set_line_width (cr, 1);
1313 cairo_translate (cr, x, y+0.5);
1314 cairo_move_to (cr, 0, 0);
1315 cairo_line_to (cr, width, 0);
1316 ge_cairo_set_color (cr, dark);
1319 cairo_translate (cr, 0, 1);
1320 cairo_move_to (cr, 0, 0);
1321 cairo_line_to (cr, width, 0);
1322 ge_cairo_set_color (cr, &hilight);
1327 clearlooks_gummy_draw_radiobutton (cairo_t *cr,
1328 const ClearlooksColors *colors,
1329 const WidgetParameters *widget,
1330 const CheckboxParameters *checkbox,
1331 int x, int y, int width, int height)
1333 const CairoColor *border;
1334 const CairoColor *dot;
1336 CairoColor highlight;
1337 cairo_pattern_t *pt;
1338 gboolean inconsistent;
1339 gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
1341 inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
1342 draw_bullet |= inconsistent;
1344 if (widget->disabled)
1346 border = &colors->shade[5];
1347 dot = &colors->shade[6];
1351 if (widget->prelight)
1352 border = &colors->spot[2];
1354 border = &colors->shade[6];
1355 dot = &colors->text[0];
1358 ge_shade_color (&widget->parentbg, 0.9, &shadow);
1359 ge_shade_color (&widget->parentbg, 1.1, &highlight);
1361 pt = cairo_pattern_create_linear (0, 0, 13, 13);
1362 cairo_pattern_add_color_stop_rgb (pt, 0.0, shadow.r, shadow.b, shadow.g);
1363 cairo_pattern_add_color_stop_rgba (pt, 0.5, shadow.r, shadow.b, shadow.g, 0.5);
1364 cairo_pattern_add_color_stop_rgba (pt, 0.5, highlight.r, highlight.g, highlight.b, 0.5);
1365 cairo_pattern_add_color_stop_rgb (pt, 1.0, highlight.r, highlight.g, highlight.b);
1367 cairo_translate (cr, x, y);
1369 cairo_set_line_width (cr, 2);
1370 cairo_arc (cr, 7, 7, 6, 0, G_PI*2);
1371 cairo_set_source (cr, pt);
1373 cairo_pattern_destroy (pt);
1375 cairo_set_line_width (cr, 1);
1377 cairo_arc (cr, 7, 7, 5.5, 0, G_PI*2);
1379 if (!widget->disabled)
1381 if (widget->prelight)
1382 clearlooks_set_mixed_color (cr, &colors->base[0], &colors->spot[1], 0.5);
1384 ge_cairo_set_color (cr, &colors->base[0]);
1385 cairo_fill_preserve (cr);
1388 ge_cairo_set_color (cr, border);
1395 cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
1396 cairo_set_line_width (cr, 4);
1398 cairo_move_to(cr, 5, 7);
1399 cairo_line_to(cr, 9, 7);
1401 ge_cairo_set_color (cr, dot);
1406 cairo_arc (cr, 7, 7, 3, 0, G_PI*2);
1407 ge_cairo_set_color (cr, dot);
1410 cairo_arc (cr, 6, 6, 1, 0, G_PI*2);
1411 cairo_set_source_rgba (cr, highlight.r, highlight.g, highlight.b, 0.5);
1418 clearlooks_gummy_draw_checkbox (cairo_t *cr,
1419 const ClearlooksColors *colors,
1420 const WidgetParameters *widget,
1421 const CheckboxParameters *checkbox,
1422 int x, int y, int width, int height)
1424 const CairoColor *border;
1425 const CairoColor *dot;
1426 gboolean inconsistent = FALSE;
1427 gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
1429 inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
1430 draw_bullet |= inconsistent;
1432 if (widget->disabled)
1434 border = &colors->shade[5];
1435 dot = &colors->shade[6];
1439 if (widget->prelight)
1440 border = &colors->spot[2];
1442 border = &colors->shade[6];
1443 dot = &colors->text[GTK_STATE_NORMAL];
1446 cairo_translate (cr, x, y);
1447 cairo_set_line_width (cr, 1);
1449 if (widget->xthickness > 2 && widget->ythickness > 2)
1451 widget->style_functions->draw_inset (cr, &widget->parentbg, 0.5, 0.5,
1452 width-1, height-1, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
1454 /* Draw the rectangle for the checkbox itself */
1455 ge_cairo_rounded_rectangle (cr, 1.5, 1.5,
1456 width-3, height-3, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
1460 /* Draw the rectangle for the checkbox itself */
1461 ge_cairo_rounded_rectangle (cr, 0.5, 0.5,
1462 width-1, height-1, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
1465 if (!widget->disabled)
1467 if (widget->prelight)
1468 clearlooks_set_mixed_color (cr, &colors->base[0], &colors->spot[1], 0.5);
1470 ge_cairo_set_color (cr, &colors->base[0]);
1471 cairo_fill_preserve (cr);
1474 ge_cairo_set_color (cr, border);
1479 if (inconsistent) /* Inconsistent */
1481 cairo_set_line_width (cr, 2.0);
1482 cairo_move_to (cr, 3, height*0.5);
1483 cairo_line_to (cr, width-3, height*0.5);
1487 cairo_set_line_width (cr, 1.7);
1488 cairo_move_to (cr, 0.5 + (width*0.2), (height*0.5));
1489 cairo_line_to (cr, 0.5 + (width*0.4), (height*0.7));
1491 cairo_curve_to (cr, 0.5 + (width*0.4), (height*0.7),
1492 0.5 + (width*0.5), (height*0.4),
1493 0.5 + (width*0.70), (height*0.25));
1497 ge_cairo_set_color (cr, dot);
1503 clearlooks_register_style_gummy (ClearlooksStyleFunctions *functions)
1505 functions->draw_button = clearlooks_gummy_draw_button;
1506 functions->draw_entry = clearlooks_gummy_draw_entry;
1507 functions->draw_progressbar_trough = clearlooks_gummy_draw_progressbar_trough;
1508 functions->draw_progressbar_fill = clearlooks_gummy_draw_progressbar_fill;
1509 functions->draw_scale_trough = clearlooks_gummy_draw_scale_trough;
1510 functions->draw_tab = clearlooks_gummy_draw_tab;
1511 functions->draw_separator = clearlooks_gummy_draw_separator;
1512 functions->draw_slider = clearlooks_gummy_draw_slider;
1513 functions->draw_slider_button = clearlooks_gummy_draw_slider_button;
1514 functions->draw_scrollbar_stepper = clearlooks_gummy_draw_scrollbar_stepper;
1515 functions->draw_scrollbar_slider = clearlooks_gummy_draw_scrollbar_slider;
1516 functions->draw_list_view_header = clearlooks_gummy_draw_list_view_header;
1517 functions->draw_toolbar = clearlooks_gummy_draw_toolbar;
1518 functions->draw_menuitem = clearlooks_gummy_draw_menuitem;
1519 functions->draw_menubaritem = clearlooks_gummy_draw_menubaritem;
1520 functions->draw_selected_cell = clearlooks_gummy_draw_selected_cell;
1521 functions->draw_statusbar = clearlooks_gummy_draw_statusbar;
1522 functions->draw_checkbox = clearlooks_gummy_draw_checkbox;
1523 functions->draw_radiobutton = clearlooks_gummy_draw_radiobutton;