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;
669 radius = MIN (params->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
672 cairo_rectangle (cr, x, y, width, height);
676 /* Translate and set line width */
677 cairo_set_line_width (cr, 1.0);
678 cairo_translate (cr, x+0.5, y+0.5);
680 /* Make the tabs slightly bigger than they should be, to create a gap */
681 /* And calculate the strip size too, while you're at it */
682 if (tab->gap_side == CL_GAP_TOP || tab->gap_side == CL_GAP_BOTTOM)
686 if (tab->gap_side == CL_GAP_TOP)
687 cairo_translate (cr, 0.0, -3.0); /* gap at the other side */
693 if (tab->gap_side == CL_GAP_LEFT)
694 cairo_translate (cr, -3.0, 0.0); /* gap at the other side */
697 /* Set the fill color */
698 fill = &colors->bg[params->state_type];
701 ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1,
702 radius, params->corners);
705 ge_cairo_set_color (cr, fill);
711 ShadowParameters shadow;
713 shadow.shadow = CL_SHADOW_OUT;
714 shadow.corners = params->corners;
716 clearlooks_gummy_draw_highlight_and_shade (cr, &colors->bg[0], &shadow,
717 width, height, radius);
723 CairoColor shade1, shade2, shade3;
725 pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-1 : 0,
726 tab->gap_side == CL_GAP_TOP ? height-2 : 1,
727 tab->gap_side == CL_GAP_RIGHT ? width : 0,
728 tab->gap_side == CL_GAP_BOTTOM ? height : 0);
730 ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
732 ge_shade_color (fill, 1.14, &hilight);
733 ge_shade_color (fill, SHADE_TOP, &shade1);
734 ge_shade_color (fill, SHADE_CENTER_TOP, &shade2);
735 ge_shade_color (fill, SHADE_BOTTOM, &shade3);
737 cairo_pattern_add_color_stop_rgb (pattern, 0.0, hilight.r, hilight.g, hilight.b);
738 cairo_pattern_add_color_stop_rgb (pattern, 1.0/height, hilight.r, hilight.g, hilight.b);
739 cairo_pattern_add_color_stop_rgb (pattern, 1.0/height, shade1.r, shade1.g, shade1.b);
740 cairo_pattern_add_color_stop_rgb (pattern, 0.45, shade2.r, shade2.g, shade2.b);
741 cairo_pattern_add_color_stop_rgb (pattern, 0.45, fill->r, fill->g, fill->b);
742 cairo_pattern_add_color_stop_rgb (pattern, 1.0, shade3.r, shade3.g, shade3.b);
743 cairo_set_source (cr, pattern);
745 cairo_pattern_destroy (pattern);
750 pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-2 : 0,
751 tab->gap_side == CL_GAP_TOP ? height-2 : 0,
752 tab->gap_side == CL_GAP_RIGHT ? width : 0,
753 tab->gap_side == CL_GAP_BOTTOM ? height : 0);
755 ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
757 cairo_pattern_add_color_stop_rgba (pattern, 0.0, stripe_fill->r, stripe_fill->g, stripe_fill->b, 0.5);
758 cairo_pattern_add_color_stop_rgba (pattern, 0.8, fill->r, fill->g, fill->b, 0.0);
759 cairo_set_source (cr, pattern);
761 cairo_pattern_destroy (pattern);
764 ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
768 ge_cairo_set_color (cr, border);
773 pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-2 : 2,
774 tab->gap_side == CL_GAP_TOP ? height-2 : 2,
775 tab->gap_side == CL_GAP_RIGHT ? width : 2,
776 tab->gap_side == CL_GAP_BOTTOM ? height : 2);
778 cairo_pattern_add_color_stop_rgb (pattern, 0.0, stripe_border->r, stripe_border->g, stripe_border->b);
779 cairo_pattern_add_color_stop_rgb (pattern, 0.8, border->r, border->g, border->b);
780 cairo_set_source (cr, pattern);
782 cairo_pattern_destroy (pattern);
787 clearlooks_gummy_draw_separator (cairo_t *cr,
788 const ClearlooksColors *colors,
789 const WidgetParameters *widget,
790 const SeparatorParameters *separator,
791 int x, int y, int width, int height)
794 CairoColor color = colors->shade[3];
797 ge_shade_color (&color, 1.3, &hilight);
800 cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
802 if (separator->horizontal)
804 cairo_set_line_width (cr, 1.0);
805 cairo_translate (cr, x, y+0.5);
807 cairo_move_to (cr, 0.0, 0.0);
808 cairo_line_to (cr, width, 0.0);
809 ge_cairo_set_color (cr, &color);
812 cairo_move_to (cr, 0.0, 1.0);
813 cairo_line_to (cr, width, 1.0);
814 ge_cairo_set_color (cr, &hilight);
819 cairo_set_line_width (cr, 1.0);
820 cairo_translate (cr, x+0.5, y);
822 cairo_move_to (cr, 0.0, 0.0);
823 cairo_line_to (cr, 0.0, height);
824 ge_cairo_set_color (cr, &color);
827 cairo_move_to (cr, 1.0, 0.0);
828 cairo_line_to (cr, 1.0, height);
829 ge_cairo_set_color (cr, &hilight);
837 clearlooks_gummy_draw_slider (cairo_t *cr,
838 const ClearlooksColors *colors,
839 const WidgetParameters *params,
840 int x, int y, int width, int height)
842 const CairoColor *border = &colors->shade[7];
844 CairoColor shade1, shade2, shade3;
845 cairo_pattern_t *pattern;
849 cairo_set_line_width (cr, 1.0);
850 cairo_translate (cr, x, y);
852 cairo_translate (cr, -0.5, -0.5);
854 ge_shade_color (&colors->bg[params->state_type], 1.0, &fill);
855 if (params->prelight)
856 ge_shade_color (&fill, 1.04, &fill);
858 ge_shade_color (&fill, SHADE_TOP, &shade1);
859 ge_shade_color (&fill, SHADE_CENTER_TOP, &shade2);
860 ge_shade_color (&fill, SHADE_BOTTOM, &shade3);
862 pattern = cairo_pattern_create_linear (1, 1, 1, height-2);
863 cairo_pattern_add_color_stop_rgb(pattern, 0, shade1.r, shade1.g, shade1.b);
864 cairo_pattern_add_color_stop_rgb(pattern, 0.5, shade2.r, shade2.g, shade2.b);
865 cairo_pattern_add_color_stop_rgb(pattern, 0.5, fill.r, fill.g, fill.b);
866 cairo_pattern_add_color_stop_rgb(pattern, 1.0, shade3.r, shade3.g, shade3.b);
867 cairo_rectangle (cr, 1, 1, width-2, height-2);
868 cairo_set_source (cr, pattern);
870 cairo_pattern_destroy (pattern);
872 clearlooks_set_mixed_color (cr, border, &fill, 0.2);
873 if (params->prelight)
874 ge_cairo_set_color (cr, &colors->spot[2]);
875 ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, 2.5, params->corners);
879 shift_x = (width%2 == 0 ? 1 : 0);
880 bar_x = width/2-3+shift_x;
881 cairo_translate (cr, 0.5, 0.5);
882 ge_cairo_set_color (cr, border);
883 for (i=0; i<3-shift_x; i++)
885 cairo_move_to (cr, bar_x, 4);
886 cairo_line_to (cr, bar_x, height-5);
891 clearlooks_gummy_draw_top_left_highlight (cr, &fill, params, width, height, 2.0);
895 clearlooks_gummy_draw_slider_button (cairo_t *cr,
896 const ClearlooksColors *colors,
897 const WidgetParameters *params,
898 const SliderParameters *slider,
899 int x, int y, int width, int height)
901 double radius = MIN (params->radius, MIN ((width - 1.0) / 2.0, (height - 1.0) / 2.0));
903 cairo_set_line_width (cr, 1.0);
905 if (!slider->horizontal)
906 ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
908 cairo_translate (cr, x+0.5, y+0.5);
910 params->style_functions->draw_shadow (cr, colors, radius, width-1, height-1);
911 params->style_functions->draw_slider (cr, colors, params, 1, 1, width-2, height-2);
915 clearlooks_gummy_draw_scrollbar_stepper (cairo_t *cr,
916 const ClearlooksColors *colors,
917 const WidgetParameters *widget,
918 const ScrollBarParameters *scrollbar,
919 const ScrollBarStepperParameters *stepper,
920 int x, int y, int width, int height)
922 CairoCorners corners = CR_CORNER_NONE;
923 const CairoColor *border = &colors->shade[scrollbar->has_color ? 7 : 6];
925 CairoColor shade1, shade2, shade3;
926 cairo_pattern_t *pattern;
927 double radius = MIN (widget->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
929 if (scrollbar->horizontal)
931 if (stepper->stepper == CL_STEPPER_A)
932 corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
933 else if (stepper->stepper == CL_STEPPER_D)
934 corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
938 if (stepper->stepper == CL_STEPPER_A)
939 corners = CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT;
940 else if (stepper->stepper == CL_STEPPER_D)
941 corners = CR_CORNER_BOTTOMLEFT | CR_CORNER_BOTTOMRIGHT;
944 cairo_translate (cr, x, y);
945 cairo_set_line_width (cr, 1);
947 ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius, corners);
949 if (scrollbar->horizontal)
950 pattern = cairo_pattern_create_linear (0, 0, 0, height);
952 pattern = cairo_pattern_create_linear (0, 0, width, 0);
954 fill = colors->bg[widget->state_type];
955 ge_shade_color(&fill, SHADE_TOP, &shade1);
956 ge_shade_color(&fill, SHADE_CENTER_TOP, &shade2);
957 ge_shade_color(&fill, SHADE_BOTTOM, &shade3);
959 cairo_pattern_add_color_stop_rgb(pattern, 0, shade1.r, shade1.g, shade1.b);
960 cairo_pattern_add_color_stop_rgb(pattern, 0.5, shade2.r, shade2.g, shade2.b);
961 cairo_pattern_add_color_stop_rgb(pattern, 0.5, fill.r, fill.g, fill.b);
962 cairo_pattern_add_color_stop_rgb(pattern, 1.0, shade3.r, shade3.g, shade3.b);
963 cairo_set_source (cr, pattern);
965 cairo_pattern_destroy (pattern);
967 cairo_translate (cr, 0.5, 0.5);
968 clearlooks_gummy_draw_top_left_highlight (cr, &fill, widget, width, height, (stepper->stepper == CL_STEPPER_A) ? radius : 0);
969 cairo_translate (cr, -0.5, -0.5);
971 ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, radius, corners);
972 clearlooks_set_mixed_color (cr, border, &fill, 0.2);
975 cairo_translate (cr, 0.5, 0.5);
979 clearlooks_gummy_draw_scrollbar_slider (cairo_t *cr,
980 const ClearlooksColors *colors,
981 const WidgetParameters *widget,
982 const ScrollBarParameters *scrollbar,
983 int x, int y, int width, int height)
985 CairoColor fill = scrollbar->color;
986 CairoColor border, handles;
988 CairoColor shade1, shade2, shade3;
989 cairo_pattern_t *pattern;
992 gdouble hue_scroll, brightness_scroll, saturation_scroll;
993 gdouble hue_bg, brightness_bg, saturation_bg;
995 ge_hsb_from_color (&fill, &hue_scroll, &saturation_scroll, &brightness_scroll);
996 ge_hsb_from_color (&colors->bg[0], &hue_bg, &saturation_bg, &brightness_bg);
998 /* Set the right color for border and handles */
999 if ((fabs(saturation_scroll - saturation_bg) < 0.30) &&
1000 (fabs(brightness_scroll - brightness_bg) < 0.20))
1001 ge_shade_color (&fill, 0.475, &border);
1003 ge_shade_color (&fill, 0.575, &border);
1004 /* The following lines increase contrast when the HUE is between 25 and 195, */
1005 /* fixing a LOT of colorschemes! */
1006 if (scrollbar->has_color && (hue_scroll < 195) && (hue_scroll > 25))
1007 ge_shade_color (&border, 0.85, &border);
1010 ge_mix_color (&border, &fill, scrollbar->has_color? 0.3 : 0.2, &border);
1012 if (scrollbar->junction & CL_JUNCTION_BEGIN)
1014 if (scrollbar->horizontal)
1025 if (scrollbar->junction & CL_JUNCTION_END)
1027 if (scrollbar->horizontal)
1033 if (!scrollbar->horizontal)
1034 ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
1036 cairo_translate (cr, x, y);
1038 if (widget->prelight)
1039 ge_shade_color (&fill, 1.04, &fill);
1041 cairo_set_line_width (cr, 1);
1043 ge_shade_color (&fill, TOPLEFT_HIGHLIGHT_SHADE, &hilight);
1044 ge_shade_color (&fill, SHADE_TOP, &shade1);
1045 ge_shade_color (&fill, SHADE_CENTER_TOP, &shade2);
1046 ge_shade_color (&fill, SHADE_BOTTOM, &shade3);
1048 pattern = cairo_pattern_create_linear (1, 1, 1, height-2);
1049 cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
1050 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1051 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill.r, fill.g, fill.b);
1052 cairo_pattern_add_color_stop_rgb (pattern, 1, shade3.r, shade3.g, shade3.b);
1053 cairo_rectangle (cr, 1, 1, width-2, height-2);
1054 cairo_set_source (cr, pattern);
1056 cairo_pattern_destroy (pattern);
1058 if (scrollbar->has_color)
1060 cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, 0.2);
1061 ge_cairo_stroke_rectangle (cr, 1.5, 1.5, width-3, height-3);
1065 cairo_move_to (cr, 1.5, height-1.5);
1066 cairo_line_to (cr, 1.5, 1.5);
1067 cairo_line_to (cr, width-1.5, 1.5);
1068 cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, TOPLEFT_HIGHLIGHT_ALPHA);
1072 ge_cairo_set_color (cr, &border);
1073 ge_cairo_stroke_rectangle (cr, 0.5, 0.5, width-1, height-1);
1076 bar_x = width/2 - 4;
1077 cairo_translate(cr, 0.5, 0.5);
1078 ge_cairo_set_color (cr, &handles);
1081 cairo_move_to (cr, bar_x, 5);
1082 cairo_line_to (cr, bar_x, height-6);
1089 clearlooks_gummy_draw_list_view_header (cairo_t *cr,
1090 const ClearlooksColors *colors,
1091 const WidgetParameters *params,
1092 const ListViewHeaderParameters *header,
1093 int x, int y, int width, int height)
1096 CairoColor *border = !params->prelight? (CairoColor*)&colors->shade[4] : (CairoColor*)&colors->spot[1];
1098 const CairoColor *border = &colors->shade[4];
1099 const CairoColor *fill = &colors->bg[params->state_type];
1101 CairoColor shade1, shade2, shade3;
1103 cairo_pattern_t *pattern;
1105 ge_shade_color (fill, 1.11, &hilight);
1106 ge_shade_color (fill, LISTVIEW_SHADE_TOP, &shade1);
1107 ge_shade_color (fill, LISTVIEW_SHADE_CENTER_TOP, &shade2);
1108 ge_shade_color (fill, LISTVIEW_SHADE_BOTTOM, &shade3);
1110 cairo_translate (cr, x, y);
1111 cairo_set_line_width (cr, 1.0);
1114 pattern = cairo_pattern_create_linear (0, 0, 0, height);
1115 cairo_pattern_add_color_stop_rgb (pattern, 0.0, shade1.r, shade1.g, shade1.b);
1116 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1117 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1118 cairo_pattern_add_color_stop_rgb (pattern, 1.0-1.0/height, shade3.r, shade3.g, shade3.b);
1119 cairo_pattern_add_color_stop_rgb (pattern, 1.0-1.0/height, border->r, border->g, border->b);
1120 cairo_pattern_add_color_stop_rgb (pattern, 1.0, border->r, border->g, border->b);
1122 cairo_set_source (cr, pattern);
1123 cairo_rectangle (cr, 0, 0, width, height);
1126 cairo_pattern_destroy (pattern);
1128 /* Draw highlight */
1129 if (header->order == CL_ORDER_FIRST)
1131 cairo_move_to (cr, 0.5, height-1.5);
1132 cairo_line_to (cr, 0.5, 0.5);
1135 cairo_move_to (cr, 0.0, 0.5);
1137 cairo_line_to (cr, width, 0.5);
1139 ge_cairo_set_color (cr, &hilight);
1142 /* Draw resize grip */
1143 if ((params->ltr && header->order != CL_ORDER_LAST) ||
1144 (!params->ltr && header->order != CL_ORDER_FIRST) || header->resizable)
1146 SeparatorParameters separator;
1147 separator.horizontal = FALSE;
1150 params->style_functions->draw_separator (cr, colors, params, &separator,
1151 width-1.5, 4.0, 2, height-8.0);
1153 params->style_functions->draw_separator (cr, colors, params, &separator,
1154 1.5, 4.0, 2, height-8.0);
1159 clearlooks_gummy_draw_toolbar (cairo_t *cr,
1160 const ClearlooksColors *colors,
1161 const WidgetParameters *widget,
1162 const ToolbarParameters *toolbar,
1163 int x, int y, int width, int height)
1166 const CairoColor *dark;
1167 const CairoColor *fill = &colors->bg[GTK_STATE_NORMAL];
1171 dark = &colors->shade[3];
1173 ge_shade_color (fill, toolbar->style == 1 ? 1.1 : 1.05, &light);
1175 cairo_set_line_width (cr, 1.0);
1176 cairo_translate (cr, x, y);
1178 if (toolbar->style == 1) /* Enable Extra features */
1180 cairo_pattern_t *pattern;
1181 CairoColor shade1, shade2, shade3;
1183 ge_shade_color (fill, TOOLBAR_SHADE_TOP, &shade1);
1184 ge_shade_color (fill, TOOLBAR_SHADE_CENTER_TOP, &shade2);
1185 ge_shade_color (fill, TOOLBAR_SHADE_BOTTOM, &shade3);
1188 pattern = cairo_pattern_create_linear (0, 0, 0, height);
1189 cairo_pattern_add_color_stop_rgb (pattern, 0.0, shade1.r, shade1.g, shade1.b);
1190 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1191 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1192 cairo_pattern_add_color_stop_rgb (pattern, 1.0, shade3.r, shade3.g, shade3.b);
1194 cairo_set_source (cr, pattern);
1195 cairo_rectangle (cr, 0, 0, width, height);
1198 cairo_pattern_destroy (pattern);
1202 ge_cairo_set_color (cr, fill);
1206 if (!toolbar->topmost)
1208 /* Draw highlight */
1209 cairo_move_to (cr, 0, 0.5);
1210 cairo_line_to (cr, width-1, 0.5);
1211 ge_cairo_set_color (cr, &light);
1216 cairo_move_to (cr, 0, height-0.5);
1217 cairo_line_to (cr, width-1, height-0.5);
1218 ge_cairo_set_color (cr, dark);
1223 clearlooks_gummy_draw_menuitem (cairo_t *cr,
1224 const ClearlooksColors *colors,
1225 const WidgetParameters *params,
1226 int x, int y, int width, int height)
1228 const CairoColor *fill = &colors->spot[1];
1229 const CairoColor *border = &colors->spot[2];
1230 CairoColor shade1, shade2, shade3;
1231 cairo_pattern_t *pattern;
1233 ge_shade_color (fill, SHADE_TOP, &shade1);
1234 ge_shade_color (fill, SHADE_CENTER_TOP, &shade2);
1235 ge_shade_color (fill, SHADE_BOTTOM, &shade3);
1236 cairo_set_line_width (cr, 1.0);
1238 ge_cairo_rounded_rectangle (cr, x+0.5, y+0.5, width - 1, height - 1, params->radius, params->corners);
1240 pattern = cairo_pattern_create_linear (x, y, x, y + height);
1241 cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
1242 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1243 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1244 cairo_pattern_add_color_stop_rgb (pattern, 1, shade3.r, shade3.g, shade3.b);
1246 cairo_set_source (cr, pattern);
1247 cairo_fill_preserve (cr);
1248 cairo_pattern_destroy (pattern);
1250 ge_cairo_set_color (cr, border);
1255 clearlooks_gummy_draw_menubaritem (cairo_t *cr,
1256 const ClearlooksColors *colors,
1257 const WidgetParameters *params,
1258 int x, int y, int width, int height)
1260 const CairoColor *fill = &colors->spot[1];
1261 const CairoColor *border = &colors->spot[2];
1262 CairoColor shade1, shade2, shade3;
1263 cairo_pattern_t *pattern;
1265 ge_shade_color (fill, SHADE_TOP, &shade1);
1266 ge_shade_color (fill, SHADE_CENTER_TOP, &shade2);
1267 ge_shade_color (fill, SHADE_BOTTOM, &shade3);
1268 cairo_set_line_width (cr, 1.0);
1270 ge_cairo_rounded_rectangle (cr, x+0.5, y+0.5, width - 1, height - 1, params->radius, params->corners);
1272 pattern = cairo_pattern_create_linear (x, y, x, y + height);
1273 cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
1274 cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1275 cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1276 cairo_pattern_add_color_stop_rgb (pattern, 1, shade3.r, shade3.g, shade3.b);
1278 cairo_set_source (cr, pattern);
1279 cairo_fill_preserve (cr);
1280 cairo_pattern_destroy (pattern);
1282 ge_cairo_set_color (cr, border);
1287 clearlooks_gummy_draw_selected_cell (cairo_t *cr,
1288 const ClearlooksColors *colors,
1289 const WidgetParameters *params,
1290 int x, int y, int width, int height)
1295 color = colors->base[params->state_type];
1297 color = colors->base[GTK_STATE_ACTIVE];
1299 clearlooks_draw_gummy_gradient (cr, x, y, width, height, &color, params->disabled, 0.0, CR_CORNER_NONE);
1303 clearlooks_gummy_draw_statusbar (cairo_t *cr,
1304 const ClearlooksColors *colors,
1305 const WidgetParameters *widget,
1306 int x, int y, int width, int height)
1309 const CairoColor *dark = &colors->shade[3];
1314 ge_shade_color (dark, 1.3, &hilight);
1316 cairo_set_line_width (cr, 1);
1317 cairo_translate (cr, x, y+0.5);
1318 cairo_move_to (cr, 0, 0);
1319 cairo_line_to (cr, width, 0);
1320 ge_cairo_set_color (cr, dark);
1323 cairo_translate (cr, 0, 1);
1324 cairo_move_to (cr, 0, 0);
1325 cairo_line_to (cr, width, 0);
1326 ge_cairo_set_color (cr, &hilight);
1331 clearlooks_gummy_draw_radiobutton (cairo_t *cr,
1332 const ClearlooksColors *colors,
1333 const WidgetParameters *widget,
1334 const CheckboxParameters *checkbox,
1335 int x, int y, int width, int height)
1337 const CairoColor *border;
1338 const CairoColor *dot;
1340 CairoColor highlight;
1341 cairo_pattern_t *pt;
1342 gboolean inconsistent;
1343 gboolean draw_bullet = (checkbox->shadow_type == (ClearlooksShadowType)GTK_SHADOW_IN);
1348 inconsistent = (checkbox->shadow_type == (ClearlooksShadowType)GTK_SHADOW_ETCHED_IN);
1349 draw_bullet |= inconsistent;
1351 if (widget->disabled)
1353 border = &colors->shade[5];
1354 dot = &colors->shade[6];
1358 if (widget->prelight)
1359 border = &colors->spot[2];
1361 border = &colors->shade[6];
1362 dot = &colors->text[0];
1365 ge_shade_color (&widget->parentbg, 0.9, &shadow);
1366 ge_shade_color (&widget->parentbg, 1.1, &highlight);
1368 pt = cairo_pattern_create_linear (0, 0, 13, 13);
1369 cairo_pattern_add_color_stop_rgb (pt, 0.0, shadow.r, shadow.b, shadow.g);
1370 cairo_pattern_add_color_stop_rgba (pt, 0.5, shadow.r, shadow.b, shadow.g, 0.5);
1371 cairo_pattern_add_color_stop_rgba (pt, 0.5, highlight.r, highlight.g, highlight.b, 0.5);
1372 cairo_pattern_add_color_stop_rgb (pt, 1.0, highlight.r, highlight.g, highlight.b);
1374 cairo_translate (cr, x, y);
1376 cairo_set_line_width (cr, 2);
1377 cairo_arc (cr, 7, 7, 6, 0, G_PI*2);
1378 cairo_set_source (cr, pt);
1380 cairo_pattern_destroy (pt);
1382 cairo_set_line_width (cr, 1);
1384 cairo_arc (cr, 7, 7, 5.5, 0, G_PI*2);
1386 if (!widget->disabled)
1388 if (widget->prelight)
1389 clearlooks_set_mixed_color (cr, &colors->base[0], &colors->spot[1], 0.5);
1391 ge_cairo_set_color (cr, &colors->base[0]);
1392 cairo_fill_preserve (cr);
1395 ge_cairo_set_color (cr, border);
1402 cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
1403 cairo_set_line_width (cr, 4);
1405 cairo_move_to(cr, 5, 7);
1406 cairo_line_to(cr, 9, 7);
1408 ge_cairo_set_color (cr, dot);
1413 cairo_arc (cr, 7, 7, 3, 0, G_PI*2);
1414 ge_cairo_set_color (cr, dot);
1417 cairo_arc (cr, 6, 6, 1, 0, G_PI*2);
1418 cairo_set_source_rgba (cr, highlight.r, highlight.g, highlight.b, 0.5);
1425 clearlooks_gummy_draw_checkbox (cairo_t *cr,
1426 const ClearlooksColors *colors,
1427 const WidgetParameters *widget,
1428 const CheckboxParameters *checkbox,
1429 int x, int y, int width, int height)
1431 const CairoColor *border;
1432 const CairoColor *dot;
1433 gboolean inconsistent = FALSE;
1434 gboolean draw_bullet = (checkbox->shadow_type == (ClearlooksShadowType)GTK_SHADOW_IN);
1436 inconsistent = (checkbox->shadow_type == (ClearlooksShadowType)GTK_SHADOW_ETCHED_IN);
1437 draw_bullet |= inconsistent;
1439 if (widget->disabled)
1441 border = &colors->shade[5];
1442 dot = &colors->shade[6];
1446 if (widget->prelight)
1447 border = &colors->spot[2];
1449 border = &colors->shade[6];
1450 dot = &colors->text[GTK_STATE_NORMAL];
1453 cairo_translate (cr, x, y);
1454 cairo_set_line_width (cr, 1);
1456 if (widget->xthickness > 2 && widget->ythickness > 2)
1458 widget->style_functions->draw_inset (cr, &widget->parentbg, 0.5, 0.5,
1459 width-1, height-1, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
1461 /* Draw the rectangle for the checkbox itself */
1462 ge_cairo_rounded_rectangle (cr, 1.5, 1.5,
1463 width-3, height-3, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
1467 /* Draw the rectangle for the checkbox itself */
1468 ge_cairo_rounded_rectangle (cr, 0.5, 0.5,
1469 width-1, height-1, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
1472 if (!widget->disabled)
1474 if (widget->prelight)
1475 clearlooks_set_mixed_color (cr, &colors->base[0], &colors->spot[1], 0.5);
1477 ge_cairo_set_color (cr, &colors->base[0]);
1478 cairo_fill_preserve (cr);
1481 ge_cairo_set_color (cr, border);
1486 if (inconsistent) /* Inconsistent */
1488 cairo_set_line_width (cr, 2.0);
1489 cairo_move_to (cr, 3, height*0.5);
1490 cairo_line_to (cr, width-3, height*0.5);
1494 cairo_set_line_width (cr, 1.7);
1495 cairo_move_to (cr, 0.5 + (width*0.2), (height*0.5));
1496 cairo_line_to (cr, 0.5 + (width*0.4), (height*0.7));
1498 cairo_curve_to (cr, 0.5 + (width*0.4), (height*0.7),
1499 0.5 + (width*0.5), (height*0.4),
1500 0.5 + (width*0.70), (height*0.25));
1504 ge_cairo_set_color (cr, dot);
1510 clearlooks_register_style_gummy (ClearlooksStyleFunctions *functions)
1512 functions->draw_button = clearlooks_gummy_draw_button;
1513 functions->draw_entry = clearlooks_gummy_draw_entry;
1514 functions->draw_progressbar_trough = clearlooks_gummy_draw_progressbar_trough;
1515 functions->draw_progressbar_fill = clearlooks_gummy_draw_progressbar_fill;
1516 functions->draw_scale_trough = clearlooks_gummy_draw_scale_trough;
1517 functions->draw_tab = clearlooks_gummy_draw_tab;
1518 functions->draw_separator = clearlooks_gummy_draw_separator;
1519 functions->draw_slider = clearlooks_gummy_draw_slider;
1520 functions->draw_slider_button = clearlooks_gummy_draw_slider_button;
1521 functions->draw_scrollbar_stepper = clearlooks_gummy_draw_scrollbar_stepper;
1522 functions->draw_scrollbar_slider = clearlooks_gummy_draw_scrollbar_slider;
1523 functions->draw_list_view_header = clearlooks_gummy_draw_list_view_header;
1524 functions->draw_toolbar = clearlooks_gummy_draw_toolbar;
1525 functions->draw_menuitem = clearlooks_gummy_draw_menuitem;
1526 functions->draw_menubaritem = clearlooks_gummy_draw_menubaritem;
1527 functions->draw_selected_cell = clearlooks_gummy_draw_selected_cell;
1528 functions->draw_statusbar = clearlooks_gummy_draw_statusbar;
1529 functions->draw_checkbox = clearlooks_gummy_draw_checkbox;
1530 functions->draw_radiobutton = clearlooks_gummy_draw_radiobutton;