1
/* Clearlooks Glossy style
2
* Copyright (C) 2006 Benjamin Berg
3
* Copyright (C) 2007 Andrea Cimitan
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Library General Public License for more details.
15
* You should have received a copy of the GNU Library General Public
16
* License along with this library; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
20
* Written by Andrea Cimitan <andrea.cimitan@gmail.com>
21
* and Benjamin Berg <benjamin@sipsolutions.net>
22
* Based on code by Richard Stellingwerff <remenic@gmail.com>
23
* and Daniel Borgmann <daniel.borgmann@gmail.com>
24
* from the ubuntulooks engine.
27
#include "clearlooks_draw.h"
28
#include "clearlooks_style.h"
29
#include "clearlooks_types.h"
32
#include <ge-support.h>
37
#define M_PI 3.14159265358979323846
41
clearlooks_draw_glossy_gradient (cairo_t *cr,
42
double x, double y, int width, int height,
43
const CairoColor *color,
44
gboolean disabled, gboolean radius, CairoCorners corners)
46
CairoColor a, b, c, d;
49
ge_shade_color (color, disabled? 1.06 : 1.16, &a);
50
ge_shade_color (color, disabled? 1.02 : 1.08, &b);
51
ge_shade_color (color, disabled? 0.98 : 1.00, &c);
52
ge_shade_color (color, disabled? 1.02 : 1.08, &d);
54
pt = cairo_pattern_create_linear (x, y, x, y+height);
55
cairo_pattern_add_color_stop_rgb (pt, 0.0, a.r, a.g, a.b);
56
cairo_pattern_add_color_stop_rgb (pt, 0.5, b.r, b.g, b.b);
57
cairo_pattern_add_color_stop_rgb (pt, 0.5, c.r, c.g, c.b);
58
cairo_pattern_add_color_stop_rgb (pt, 1.0, d.r, d.g, d.b);
60
cairo_set_source (cr, pt);
61
ge_cairo_rounded_rectangle (cr, x, y, width, height, radius, corners);
64
cairo_pattern_destroy (pt);
68
clearlooks_set_mixed_color (cairo_t *cr,
69
const CairoColor *color1,
70
const CairoColor *color2,
75
ge_mix_color (color1, color2, mix_factor, &composite);
76
ge_cairo_set_color (cr, &composite);
80
clearlooks_glossy_draw_inset (cairo_t *cr,
81
const CairoColor *bg_color,
82
double x, double y, double w, double h,
83
double radius, uint8 corners)
88
/* not really sure of shading ratios... we will think */
89
ge_shade_color (bg_color, 0.93, &shadow);
90
ge_shade_color (bg_color, 1.07, &highlight);
93
cairo_move_to (cr, x + w + (radius * -0.2928932188), y - (radius * -0.2928932188)); /* 0.2928932... 1-sqrt(2)/2 gives middle of curve */
95
if (corners & CR_CORNER_TOPRIGHT)
96
cairo_arc (cr, x + w - radius, y + radius, radius, G_PI * 1.75, G_PI * 2);
98
cairo_line_to (cr, x + w, y);
100
if (corners & CR_CORNER_BOTTOMRIGHT)
101
cairo_arc (cr, x + w - radius, y + h - radius, radius, 0, G_PI * 0.5);
103
cairo_line_to (cr, x + w, y + h);
105
if (corners & CR_CORNER_BOTTOMLEFT)
106
cairo_arc (cr, x + radius, y + h - radius, radius, G_PI * 0.5, G_PI * 0.75);
108
cairo_line_to (cr, x, y + h);
110
ge_cairo_set_color (cr, &highlight);
114
cairo_move_to (cr, x + (radius * 0.2928932188), y + h + (radius * -0.2928932188));
116
if (corners & CR_CORNER_BOTTOMLEFT)
117
cairo_arc (cr, x + radius, y + h - radius, radius, M_PI * 0.75, M_PI);
119
cairo_line_to (cr, x, y + h);
121
if (corners & CR_CORNER_TOPLEFT)
122
cairo_arc (cr, x + radius, y + radius, radius, M_PI, M_PI * 1.5);
124
cairo_line_to (cr, x, y);
126
if (corners & CR_CORNER_TOPRIGHT)
127
cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.5, M_PI * 1.75);
129
cairo_line_to (cr, x + w, y);
131
ge_cairo_set_color (cr, &shadow);
136
clearlooks_glossy_draw_light_inset (cairo_t *cr,
137
const CairoColor *bg_color,
138
double x, double y, double w, double h,
139
double radius, uint8 corners)
142
CairoColor highlight;
144
/* not really sure of shading ratios... we will think */
145
ge_shade_color (bg_color, 0.95, &shadow);
146
ge_shade_color (bg_color, 1.05, &highlight);
149
cairo_move_to (cr, x + w + (radius * -0.2928932188), y - (radius * -0.2928932188)); /* 0.2928932... 1-sqrt(2)/2 gives middle of curve */
151
if (corners & CR_CORNER_TOPRIGHT)
152
cairo_arc (cr, x + w - radius, y + radius, radius, G_PI * 1.75, G_PI * 2);
154
cairo_line_to (cr, x + w, y);
156
if (corners & CR_CORNER_BOTTOMRIGHT)
157
cairo_arc (cr, x + w - radius, y + h - radius, radius, 0, G_PI * 0.5);
159
cairo_line_to (cr, x + w, y + h);
161
if (corners & CR_CORNER_BOTTOMLEFT)
162
cairo_arc (cr, x + radius, y + h - radius, radius, G_PI * 0.5, G_PI * 0.75);
164
cairo_line_to (cr, x, y + h);
166
ge_cairo_set_color (cr, &highlight);
170
cairo_move_to (cr, x + (radius * 0.2928932188), y + h + (radius * -0.2928932188));
172
if (corners & CR_CORNER_BOTTOMLEFT)
173
cairo_arc (cr, x + radius, y + h - radius, radius, M_PI * 0.75, M_PI);
175
cairo_line_to (cr, x, y + h);
177
if (corners & CR_CORNER_TOPLEFT)
178
cairo_arc (cr, x + radius, y + radius, radius, M_PI, M_PI * 1.5);
180
cairo_line_to (cr, x, y);
182
if (corners & CR_CORNER_TOPRIGHT)
183
cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.5, M_PI * 1.75);
185
cairo_line_to (cr, x + w, y);
187
ge_cairo_set_color (cr, &shadow);
192
clearlooks_glossy_draw_highlight_and_shade (cairo_t *cr,
193
const CairoColor *bg_color,
194
const ShadowParameters *params,
195
int width, int height, gdouble radius)
198
CairoColor highlight;
199
uint8 corners = params->corners;
203
/* not really sure of shading ratios... we will think */
204
ge_shade_color (bg_color, 0.8, &shadow);
205
ge_shade_color (bg_color, 1.2, &highlight);
209
/* Top/Left highlight */
210
if (corners & CR_CORNER_BOTTOMLEFT)
211
cairo_move_to (cr, x, y+height-radius);
213
cairo_move_to (cr, x, y+height);
215
ge_cairo_rounded_corner (cr, x, y, radius, corners & CR_CORNER_TOPLEFT);
217
if (corners & CR_CORNER_TOPRIGHT)
218
cairo_line_to (cr, x+width-radius, y);
220
cairo_line_to (cr, x+width, y);
222
if (params->shadow & CL_SHADOW_OUT)
223
cairo_set_source_rgba (cr, highlight.r, highlight.g, highlight.b, 0.5);
225
cairo_set_source_rgba (cr, shadow.r, shadow.g, shadow.b, 0.5);
229
/* Bottom/Right highlight -- this includes the corners */
230
cairo_move_to (cr, x+width-radius, y); /* topright and by radius to the left */
231
ge_cairo_rounded_corner (cr, x+width, y, radius, corners & CR_CORNER_TOPRIGHT);
232
ge_cairo_rounded_corner (cr, x+width, y+height, radius, corners & CR_CORNER_BOTTOMRIGHT);
233
ge_cairo_rounded_corner (cr, x, y+height, radius, corners & CR_CORNER_BOTTOMLEFT);
235
if (params->shadow & CL_SHADOW_OUT)
236
cairo_set_source_rgba (cr, shadow.r, shadow.g, shadow.b, 0.5);
238
cairo_set_source_rgba (cr, highlight.r, highlight.g, highlight.b, 0.5);
246
clearlooks_glossy_draw_button (cairo_t *cr,
247
const ClearlooksColors *colors,
248
const WidgetParameters *params,
249
int x, int y, int width, int height)
251
double xoffset = 0, yoffset = 0;
252
CairoColor fill = colors->bg[params->state_type];
253
CairoColor border_normal = colors->shade[6];
254
CairoColor border_disabled = colors->shade[4];
257
cairo_pattern_t *pattern;
260
cairo_translate (cr, x, y);
261
cairo_set_line_width (cr, 1.0);
263
/* Shadows and Glow */
264
if (params->xthickness == 3 || params->ythickness == 3)
266
if (params->xthickness == 3)
268
if (params->ythickness == 3)
272
radius = MIN (params->radius, MIN ((width - 2.0 - 2*xoffset) / 2.0, (height - 2.0 - 2*yoffset) / 2.0));
274
if (params->xthickness == 3 || params->ythickness == 3)
276
cairo_translate (cr, 0.5, 0.5);
278
/* if (params->enable_glow && !params->active && !params->disabled) */
279
if (params->prelight && params->enable_glow && !params->active)
281
/* Glow becomes a shadow to have 3d prelight buttons :) */
284
radius = MIN (params->radius, MIN ((width - 2.0 - 2*xoffset) / 2.0 - 1.0, (height - 2.0 - 2*yoffset) / 2.0 - 1.0));
286
ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius+1, params->corners);
287
ge_shade_color (¶ms->parentbg, 0.96, &glow);
288
ge_cairo_set_color (cr, &glow);
291
ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius+1, params->corners);
292
ge_shade_color (¶ms->parentbg, 0.92, &glow);
293
ge_cairo_set_color (cr, &glow);
297
/* if (!(params->enable_glow && !params->active && !params->disabled)) */
298
if (!(params->prelight && params->enable_glow && !params->active)) {
299
if (!(params->disabled))
300
params->style_functions->draw_inset (cr, ¶ms->parentbg, 0, 0, width-1, height-1, params->radius+1, params->corners);
302
/*Draw a lighter inset */
303
clearlooks_glossy_draw_light_inset (cr, ¶ms->parentbg, 0, 0, width-1, height-1, params->radius+1, params->corners);
305
cairo_translate (cr, -0.5, -0.5);
308
clearlooks_draw_glossy_gradient (cr, xoffset+1, yoffset+1,
309
width-(xoffset*2)-2, height-(yoffset*2)-2,
310
&fill, params->disabled, radius, params->corners);
312
/* Pressed button shadow */
316
ge_shade_color (&fill, 0.92, &shadow);
320
ge_cairo_rounded_rectangle (cr, xoffset+1, yoffset+1, width-(xoffset*2)-2, height, radius, params->corners & (CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMLEFT));
322
cairo_rectangle (cr, xoffset+1, yoffset+1, width-(xoffset*2)-2, 3);
324
pattern = cairo_pattern_create_linear (xoffset+1, yoffset+1, xoffset+1, yoffset+4);
325
cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.58);
326
cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.0);
327
cairo_set_source (cr, pattern);
329
cairo_pattern_destroy (pattern);
331
cairo_rectangle (cr, xoffset+1, yoffset+1, 3, height-(yoffset*2)-2);
333
pattern = cairo_pattern_create_linear (xoffset+1, yoffset+1, xoffset+4, yoffset+1);
334
cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.58);
335
cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.0);
336
cairo_set_source (cr, pattern);
338
cairo_pattern_destroy (pattern);
343
/* Default button highlight */
344
if (params->is_default && !params->active && !params->disabled)
346
const CairoColor *glow = &colors->spot[0];
347
double hh = (height-5)/2.0 + 1;
349
cairo_rectangle (cr, 3.5, 3.5, width-7, height-7);
350
ge_cairo_set_color (cr, glow);
353
glow = &colors->spot[0];
354
cairo_move_to (cr, 2.5, 2.5+hh); cairo_rel_line_to (cr, 0, -hh);
355
cairo_rel_line_to (cr, width-5, 0); cairo_rel_line_to (cr, 0, hh);
356
ge_cairo_set_color (cr, glow);
361
glow = &colors->spot[1];
362
cairo_move_to (cr, 2.5, 2.5+hh); cairo_rel_line_to (cr, 0, hh);
363
cairo_rel_line_to (cr, width-5, 0); cairo_rel_line_to (cr, 0, -hh);
364
ge_cairo_set_color (cr, glow);
369
if (params->is_default || (params->prelight && params->enable_glow))
370
border_normal = colors->spot[2];
371
/* ge_mix_color (&border_normal, &colors->spot[2], 0.5, &border_normal); */
372
if (params->disabled)
373
ge_cairo_set_color (cr, &border_disabled);
375
clearlooks_set_mixed_color (cr, &border_normal, &fill, 0.2);
376
ge_cairo_rounded_rectangle (cr, xoffset + 0.5, yoffset + 0.5,
377
width-(xoffset*2)-1, height-(yoffset*2)-1,
378
radius, params->corners);
384
clearlooks_glossy_draw_progressbar_trough (cairo_t *cr,
385
const ClearlooksColors *colors,
386
const WidgetParameters *params,
387
int x, int y, int width, int height)
389
const CairoColor *border = &colors->shade[6];
391
cairo_pattern_t *pattern;
392
double radius = MIN (params->radius, MIN ((height-2.0) / 2.0, (width-2.0) / 2.0));
396
cairo_set_line_width (cr, 1.0);
398
/* Fill with bg color */
399
ge_cairo_set_color (cr, &colors->bg[params->state_type]);
401
cairo_rectangle (cr, x, y, width, height);
404
/* Create trough box */
405
ge_cairo_rounded_rectangle (cr, x+1, y+1, width-2, height-2, radius, params->corners);
406
ge_cairo_set_color (cr, &colors->shade[2]);
410
ge_cairo_rounded_rectangle (cr, x+0.5, y+0.5, width-1, height-1, radius, params->corners);
411
clearlooks_set_mixed_color (cr, border, &colors->shade[2], 0.3);
414
/* clip the corners of the shadows */
415
ge_cairo_rounded_rectangle (cr, x+1, y+1, width-2, height-2, radius, params->corners);
418
ge_shade_color (border, 0.92, &shadow);
421
cairo_rectangle (cr, x+1, y+1, width-2, 4);
422
pattern = cairo_pattern_create_linear (x, y, x, y+4);
423
cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.3);
424
cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.);
425
cairo_set_source (cr, pattern);
427
cairo_pattern_destroy (pattern);
430
cairo_rectangle (cr, x+1, y+1, 4, height-2);
431
pattern = cairo_pattern_create_linear (x, y, x+4, y);
432
cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.3);
433
cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.);
434
cairo_set_source (cr, pattern);
436
cairo_pattern_destroy (pattern);
442
clearlooks_glossy_draw_progressbar_fill (cairo_t *cr,
443
const ClearlooksColors *colors,
444
const WidgetParameters *params,
445
const ProgressBarParameters *progressbar,
446
int x, int y, int width, int height,
449
boolean is_horizontal = progressbar->orientation < 2;
455
cairo_pattern_t *pattern;
462
radius = MAX (0, params->radius - params->xthickness);
467
ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
469
if ((progressbar->orientation == CL_ORIENTATION_RIGHT_TO_LEFT) || (progressbar->orientation == CL_ORIENTATION_BOTTOM_TO_TOP))
470
ge_cairo_mirror (cr, CR_MIRROR_HORIZONTAL, &x, &y, &width, &height);
472
/* Clamp the radius so that the _height_ fits ... */
473
radius = MIN (radius, height / 2.0);
475
stroke_width = height*2;
476
x_step = (((float)stroke_width/10)*offset); /* This looks weird ... */
478
cairo_translate (cr, x, y);
481
/* This is kind of nasty ... Clip twice from each side in case the length
482
* of the fill is smaller than twice the radius. */
483
ge_cairo_rounded_rectangle (cr, 0, 0, width + radius, height, radius, CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT);
485
ge_cairo_rounded_rectangle (cr, -radius, 0, width + radius, height, radius, CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT);
488
/* Draw the background gradient */
489
ge_shade_color (&colors->spot[1], 1.16, &a);
490
ge_shade_color (&colors->spot[1], 1.08, &b);
491
ge_shade_color (&colors->spot[1], 1.08, &e);
492
pattern = cairo_pattern_create_linear (0, 0, 0, height);
493
cairo_pattern_add_color_stop_rgb (pattern, 0.0, a.r, a.g, a.b);
494
cairo_pattern_add_color_stop_rgb (pattern, 0.5, b.r, b.g, b.b);
495
cairo_pattern_add_color_stop_rgb (pattern, 0.5, colors->spot[1].r, colors->spot[1].g, colors->spot[1].b);
496
cairo_pattern_add_color_stop_rgb (pattern, 1.0, e.r, e.g, e.b);
497
cairo_set_source (cr, pattern);
499
cairo_pattern_destroy (pattern);
501
/* Draw the Strokes */
502
while (tile_pos <= width+x_step)
504
cairo_move_to (cr, stroke_width/2-x_step, 0);
505
cairo_line_to (cr, stroke_width-x_step, 0);
506
cairo_line_to (cr, stroke_width/2-x_step, height);
507
cairo_line_to (cr, -x_step, height);
509
cairo_translate (cr, stroke_width, 0);
510
tile_pos += stroke_width;
513
cairo_set_source_rgba (cr, colors->spot[2].r,
519
cairo_restore (cr); /* rounded clip region */
521
/* inner highlight border
522
* This is again kinda ugly. Draw once from each side, clipping away the other. */
523
cairo_set_source_rgba (cr, colors->spot[0].r, colors->spot[0].g, colors->spot[0].b, 0.3);
527
cairo_rectangle (cr, 0, 0, width / 2, height);
530
if (progressbar->pulsing)
531
ge_cairo_rounded_rectangle (cr, 1.5, 0.5, width + radius, height - 1, radius, CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT);
533
ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width + radius, height - 1, radius, CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT);
536
cairo_restore (cr); /* clip */
540
cairo_rectangle (cr, width / 2, 0, (width+1) / 2, height);
543
if (progressbar->value < 1.0 || progressbar->pulsing)
544
ge_cairo_rounded_rectangle (cr, -1.5 - radius, 0.5, width + radius, height - 1, radius, CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT);
546
ge_cairo_rounded_rectangle (cr, -0.5 - radius, 0.5, width + radius, height - 1, radius, CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT);
549
cairo_restore (cr); /* clip */
552
/* Draw the dark lines and the shadow */
554
/* Again, this weird clip area. */
555
ge_cairo_rounded_rectangle (cr, -1.0, 0, width + radius + 2.0, height, radius, CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT);
557
ge_cairo_rounded_rectangle (cr, -radius - 1.0, 0, width + radius + 2.0, height, radius, CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT);
560
border = colors->spot[2];
562
ge_shade_color (&colors->shade[6], 0.92, &shadow);
565
if (progressbar->pulsing)
567
/* At the beginning of the bar. */
568
cairo_move_to (cr, 0.5 + radius, height + 0.5);
569
ge_cairo_rounded_corner (cr, 0.5, height + 0.5, radius + 1, CR_CORNER_BOTTOMLEFT);
570
ge_cairo_rounded_corner (cr, 0.5, -0.5, radius + 1, CR_CORNER_TOPLEFT);
571
ge_cairo_set_color (cr, &border);
574
cairo_move_to (cr, -0.5 + radius, height + 0.5);
575
ge_cairo_rounded_corner (cr, -0.5, height + 0.5, radius + 1, CR_CORNER_BOTTOMLEFT);
576
ge_cairo_rounded_corner (cr, -0.5, -0.5, radius + 1, CR_CORNER_TOPLEFT);
577
ge_cairo_set_color (cr, &shadow);
580
if (progressbar->value < 1.0 || progressbar->pulsing)
582
/* At the end of the bar. */
583
cairo_move_to (cr, width - 0.5 - radius, -0.5);
584
ge_cairo_rounded_corner (cr, width - 0.5, -0.5, radius + 1, CR_CORNER_TOPRIGHT);
585
ge_cairo_rounded_corner (cr, width - 0.5, height + 0.5, radius + 1, CR_CORNER_BOTTOMRIGHT);
586
ge_cairo_set_color (cr, &border);
589
cairo_move_to (cr, width + 0.5 - radius, -0.5);
590
ge_cairo_rounded_corner (cr, width + 0.5, -0.5, radius + 1, CR_CORNER_TOPRIGHT);
591
ge_cairo_rounded_corner (cr, width + 0.5, height + 0.5, radius + 1, CR_CORNER_BOTTOMRIGHT);
592
ge_cairo_set_color (cr, &shadow);
598
cairo_restore (cr); /* rotation, mirroring */
602
clearlooks_glossy_scale_draw_gradient (cairo_t *cr,
603
const CairoColor *c1,
604
const CairoColor *c2,
605
const CairoColor *c3,
606
int x, int y, int width, int height,
609
cairo_pattern_t *pattern;
611
pattern = cairo_pattern_create_linear (0, 0, horizontal ? 0 : width, horizontal ? height : 0);
612
cairo_pattern_add_color_stop_rgb (pattern, 0.0, c1->r, c1->g, c1->b);
613
cairo_pattern_add_color_stop_rgb (pattern, 1.0, c2->r, c2->g, c2->b);
615
cairo_rectangle (cr, x+0.5, y+0.5, width-1, height-1);
616
cairo_set_source (cr, pattern);
618
cairo_pattern_destroy (pattern);
620
clearlooks_set_mixed_color (cr, c3, c1, 0.3);
621
ge_cairo_stroke_rectangle (cr, x, y, width, height);
624
#define TROUGH_SIZE 6
626
clearlooks_glossy_draw_scale_trough (cairo_t *cr,
627
const ClearlooksColors *colors,
628
const WidgetParameters *params,
629
const SliderParameters *slider,
630
int x, int y, int width, int height)
632
int trough_width, trough_height;
633
double translate_x, translate_y;
635
if (slider->horizontal)
637
trough_width = width-3;
638
trough_height = TROUGH_SIZE-2;
640
translate_x = x + 0.5;
641
translate_y = y + 0.5 + (height/2) - (TROUGH_SIZE/2);
645
trough_width = TROUGH_SIZE-2;
646
trough_height = height-3;
648
translate_x = x + 0.5 + (width/2) - (TROUGH_SIZE/2);
649
translate_y = y + 0.5;
652
cairo_set_line_width (cr, 1.0);
653
cairo_translate (cr, translate_x, translate_y);
655
if (!slider->fill_level)
656
params->style_functions->draw_inset (cr, ¶ms->parentbg, 0, 0, trough_width+2, trough_height+2, 0, 0);
658
cairo_translate (cr, 1, 1);
660
if (!slider->lower && !slider->fill_level)
661
clearlooks_glossy_scale_draw_gradient (cr, &colors->shade[3], /* top */
662
&colors->shade[2], /* bottom */
663
&colors->shade[6], /* border */
664
0, 0, trough_width, trough_height,
667
clearlooks_glossy_scale_draw_gradient (cr, &colors->spot[1], /* top */
668
&colors->spot[0], /* bottom */
669
&colors->spot[2], /* border */
670
0, 0, trough_width, trough_height,
675
clearlooks_glossy_draw_tab (cairo_t *cr,
676
const ClearlooksColors *colors,
677
const WidgetParameters *params,
678
const TabParameters *tab,
679
int x, int y, int width, int height)
682
const CairoColor *border = &colors->shade[5];
683
const CairoColor *stripe_fill = &colors->spot[1];
684
const CairoColor *stripe_border = &colors->spot[2];
685
const CairoColor *fill;
688
cairo_pattern_t *pattern;
692
radius = MIN (params->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
695
cairo_rectangle (cr, x, y, width, height);
699
/* Translate and set line width */
700
cairo_set_line_width (cr, 1.0);
701
cairo_translate (cr, x+0.5, y+0.5);
704
/* Make the tabs slightly bigger than they should be, to create a gap */
705
/* And calculate the strip size too, while you're at it */
706
if (tab->gap_side == CL_GAP_TOP || tab->gap_side == CL_GAP_BOTTOM)
710
if (tab->gap_side == CL_GAP_TOP)
711
cairo_translate (cr, 0.0, -3.0); /* gap at the other side */
717
if (tab->gap_side == CL_GAP_LEFT)
718
cairo_translate (cr, -3.0, 0.0); /* gap at the other side */
721
/* Set the fill color */
722
fill = &colors->bg[params->state_type];
725
ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1,
726
radius, params->corners);
729
ge_cairo_set_color (cr, fill);
732
ge_shade_color (fill, 1.3, &hilight);
737
ShadowParameters shadow;
739
shadow.shadow = CL_SHADOW_OUT;
740
shadow.corners = params->corners;
742
clearlooks_glossy_draw_highlight_and_shade (cr, &colors->bg[0], &shadow,
749
CairoColor shadow, hilight, f1, f2;
751
pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-1 : 0,
752
tab->gap_side == CL_GAP_TOP ? height-2 : 1,
753
tab->gap_side == CL_GAP_RIGHT ? width : 0,
754
tab->gap_side == CL_GAP_BOTTOM ? height : 0);
756
ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
758
ge_shade_color (fill, 1.06, &shadow);
759
ge_shade_color (fill, 1.18, &hilight);
760
ge_shade_color (fill, 1.12, &f1);
761
ge_shade_color (fill, 1.06, &f2);
763
cairo_pattern_add_color_stop_rgb (pattern, 0.0, hilight.r, hilight.g, hilight.b);
764
cairo_pattern_add_color_stop_rgb (pattern, 1.0/height, hilight.r, hilight.g, hilight.b);
765
cairo_pattern_add_color_stop_rgb (pattern, 1.0/height, f1.r, f1.g, f1.b);
766
cairo_pattern_add_color_stop_rgb (pattern, 0.45, f2.r, f2.g, f2.b);
767
cairo_pattern_add_color_stop_rgb (pattern, 0.45, fill->r, fill->g, fill->b);
768
cairo_pattern_add_color_stop_rgb (pattern, 1.0, shadow.r, shadow.g, shadow.b);
769
cairo_set_source (cr, pattern);
771
cairo_pattern_destroy (pattern);
776
pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-2 : 0,
777
tab->gap_side == CL_GAP_TOP ? height-2 : 0,
778
tab->gap_side == CL_GAP_RIGHT ? width : 0,
779
tab->gap_side == CL_GAP_BOTTOM ? height : 0);
781
ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
784
cairo_pattern_add_color_stop_rgba (pattern, 0.0, stripe_fill->r, stripe_fill->g, stripe_fill->b, 0.5);
785
cairo_pattern_add_color_stop_rgba (pattern, 0.8, fill->r, fill->g, fill->b, 0.0);
786
cairo_set_source (cr, pattern);
788
cairo_pattern_destroy (pattern);
791
ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
795
ge_cairo_set_color (cr, border);
800
pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-2 : 2,
801
tab->gap_side == CL_GAP_TOP ? height-2 : 2,
802
tab->gap_side == CL_GAP_RIGHT ? width : 2,
803
tab->gap_side == CL_GAP_BOTTOM ? height : 2);
805
cairo_pattern_add_color_stop_rgb (pattern, 0.0, stripe_border->r, stripe_border->g, stripe_border->b);
806
cairo_pattern_add_color_stop_rgb (pattern, 0.8, border->r, border->g, border->b);
807
cairo_set_source (cr, pattern);
809
cairo_pattern_destroy (pattern);
814
clearlooks_glossy_draw_slider (cairo_t *cr,
815
const ClearlooksColors *colors,
816
const WidgetParameters *params,
817
int x, int y, int width, int height)
819
const CairoColor *border = &colors->shade[7];
822
CairoColor a, b, c, d;
823
cairo_pattern_t *pattern;
825
cairo_set_line_width (cr, 1.0);
826
cairo_translate (cr, x, y);
828
cairo_translate (cr, -0.5, -0.5);
830
ge_shade_color (&colors->bg[params->state_type], 1.0, &fill);
831
if (params->prelight)
832
ge_shade_color (&fill, 1.1, &fill);
834
ge_shade_color (&fill, 1.25, &hilight);
835
ge_shade_color (&fill, 1.16, &a);
836
ge_shade_color (&fill, 1.08, &b);
837
ge_shade_color (&fill, 1.0, &c);
838
ge_shade_color (&fill, 1.08, &d);
840
pattern = cairo_pattern_create_linear (1, 1, 1, height-2);
841
cairo_pattern_add_color_stop_rgb (pattern, 0, a.r, a.g, a.b);
842
cairo_pattern_add_color_stop_rgb (pattern, 0.5, b.r, b.g, b.b);
843
cairo_pattern_add_color_stop_rgb (pattern, 0.5, c.r, c.g, c.b);
844
cairo_pattern_add_color_stop_rgb (pattern, 1.0, d.r, d.g, d.b);
845
cairo_rectangle (cr, 1, 1, width-2, height-2);
846
cairo_set_source (cr, pattern);
848
cairo_pattern_destroy (pattern);
850
clearlooks_set_mixed_color (cr, border, &fill, 0.2);
851
if (params->prelight)
852
ge_cairo_set_color (cr, &colors->spot[2]);
853
ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, 2.5, params->corners);
856
cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, 0.5);
857
ge_cairo_rounded_rectangle (cr, 1.5, 1.5, width-3, height-3, 2.0, params->corners);
862
clearlooks_glossy_draw_slider_button (cairo_t *cr,
863
const ClearlooksColors *colors,
864
const WidgetParameters *params,
865
const SliderParameters *slider,
866
int x, int y, int width, int height)
868
double radius = MIN (params->radius, MIN ((width - 1.0) / 2.0, (height - 1.0) / 2.0));
870
cairo_set_line_width (cr, 1.0);
872
if (!slider->horizontal)
873
ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
875
cairo_translate (cr, x+0.5, y+0.5);
877
params->style_functions->draw_shadow (cr, colors, radius, width-1, height-1);
878
params->style_functions->draw_slider (cr, colors, params, 1, 1, width-2, height-2);
882
clearlooks_glossy_draw_scrollbar_stepper (cairo_t *cr,
883
const ClearlooksColors *colors,
884
const WidgetParameters *widget,
885
const ScrollBarParameters *scrollbar,
886
const ScrollBarStepperParameters *stepper,
887
int x, int y, int width, int height)
889
CairoCorners corners = CR_CORNER_NONE;
890
const CairoColor *border = &colors->shade[7];
891
CairoColor fill, s1, s2, s4;
892
cairo_pattern_t *pattern;
893
double radius = MIN (widget->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
895
if (scrollbar->horizontal)
897
if (stepper->stepper == CL_STEPPER_A)
898
corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
899
else if (stepper->stepper == CL_STEPPER_D)
900
corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
904
if (stepper->stepper == CL_STEPPER_A)
905
corners = CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT;
906
else if (stepper->stepper == CL_STEPPER_D)
907
corners = CR_CORNER_BOTTOMLEFT | CR_CORNER_BOTTOMRIGHT;
910
cairo_translate (cr, x, y);
911
cairo_set_line_width (cr, 1);
913
ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius, corners);
915
if (scrollbar->horizontal)
916
pattern = cairo_pattern_create_linear (0, 0, 0, height);
918
pattern = cairo_pattern_create_linear (0, 0, width, 0);
920
fill = colors->bg[widget->state_type];
921
ge_shade_color(&fill, 1.16, &s1);
922
ge_shade_color(&fill, 1.08, &s2);
923
ge_shade_color(&fill, 1.08, &s4);
925
cairo_pattern_add_color_stop_rgb(pattern, 0, s1.r, s1.g, s1.b);
926
cairo_pattern_add_color_stop_rgb(pattern, 0.5, s2.r, s2.g, s2.b);
927
cairo_pattern_add_color_stop_rgb(pattern, 0.5, fill.r, fill.g, fill.b);
928
cairo_pattern_add_color_stop_rgb(pattern, 1.0, s4.r, s4.g, s4.b);
929
cairo_set_source (cr, pattern);
931
cairo_pattern_destroy (pattern);
933
cairo_translate (cr, 0.5, 0.5);
934
cairo_translate (cr, -0.5, -0.5);
936
ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, radius, corners);
937
clearlooks_set_mixed_color (cr, border, &fill, 0.2);
938
if (widget->prelight)
939
ge_cairo_set_color (cr, &colors->spot[2]);
942
cairo_translate (cr, 0.5, 0.5);
946
clearlooks_glossy_draw_scrollbar_slider (cairo_t *cr,
947
const ClearlooksColors *colors,
948
const WidgetParameters *widget,
949
const ScrollBarParameters *scrollbar,
950
int x, int y, int width, int height)
952
const CairoColor *border = &colors->shade[7];
953
CairoColor fill = scrollbar->color;
955
CairoColor shade1, shade2, shade3;
956
cairo_pattern_t *pattern;
958
if (scrollbar->junction & CL_JUNCTION_BEGIN)
960
if (scrollbar->horizontal)
971
if (scrollbar->junction & CL_JUNCTION_END)
973
if (scrollbar->horizontal)
979
if (!scrollbar->horizontal)
980
ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
982
cairo_translate (cr, x, y);
984
if (widget->prelight)
985
ge_shade_color (&fill, 1.1, &fill);
987
cairo_set_line_width (cr, 1);
989
ge_shade_color (&fill, 1.25, &hilight);
990
ge_shade_color (&fill, 1.16, &shade1);
991
ge_shade_color (&fill, 1.08, &shade2);
992
ge_shade_color (&fill, 1.08, &shade3);
994
pattern = cairo_pattern_create_linear (1, 1, 1, height-2);
995
cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
996
cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
997
cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill.r, fill.g, fill.b);
998
cairo_pattern_add_color_stop_rgb (pattern, 1, shade3.r, shade3.g, shade3.b);
999
cairo_rectangle (cr, 1, 1, width-2, height-2);
1000
cairo_set_source (cr, pattern);
1002
cairo_pattern_destroy (pattern);
1004
if (scrollbar->has_color)
1006
cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, 0.5);
1007
ge_cairo_stroke_rectangle (cr, 1.5, 1.5, width-3, height-3);
1010
clearlooks_set_mixed_color (cr, border, &fill, scrollbar->has_color? 0.4 : 0.2);
1011
ge_cairo_stroke_rectangle (cr, 0.5, 0.5, width-1, height-1);
1015
clearlooks_glossy_draw_list_view_header (cairo_t *cr,
1016
const ClearlooksColors *colors,
1017
const WidgetParameters *params,
1018
const ListViewHeaderParameters *header,
1019
int x, int y, int width, int height)
1022
CairoColor *border = !params->prelight? (CairoColor*)&colors->shade[4] : (CairoColor*)&colors->spot[1];
1024
const CairoColor *border = &colors->shade[4];
1025
const CairoColor *fill = &colors->bg[params->state_type];
1027
CairoColor shade1, shade2, shade3;
1029
cairo_pattern_t *pattern;
1031
ge_shade_color (fill, 1.2, &hilight);
1032
ge_shade_color (fill, 1.08, &shade1);
1033
ge_shade_color (fill, 1.04, &shade2);
1034
ge_shade_color (fill, 1.04, &shade3);
1036
cairo_translate (cr, x, y);
1037
cairo_set_line_width (cr, 1.0);
1040
pattern = cairo_pattern_create_linear (0, 0, 0, height);
1041
cairo_pattern_add_color_stop_rgb (pattern, 0.0, shade1.r, shade1.g, shade1.b);
1042
cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1043
cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1044
cairo_pattern_add_color_stop_rgb (pattern, 1.0-1.0/height, shade3.r, shade3.g, shade3.b);
1045
cairo_pattern_add_color_stop_rgb (pattern, 1.0-1.0/height, border->r, border->g, border->b);
1046
cairo_pattern_add_color_stop_rgb (pattern, 1.0, border->r, border->g, border->b);
1048
cairo_set_source (cr, pattern);
1049
cairo_rectangle (cr, 0, 0, width, height);
1052
cairo_pattern_destroy (pattern);
1054
/* Draw highlight */
1055
if (header->order == CL_ORDER_FIRST)
1057
cairo_move_to (cr, 0.5, height-1);
1058
cairo_line_to (cr, 0.5, 0.5);
1061
cairo_move_to (cr, 0.0, 0.5);
1063
cairo_line_to (cr, width, 0.5);
1065
cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, 0.5);
1068
/* Draw resize grip */
1069
if ((params->ltr && header->order != CL_ORDER_LAST) ||
1070
(!params->ltr && header->order != CL_ORDER_FIRST) || header->resizable)
1072
SeparatorParameters separator;
1073
separator.horizontal = FALSE;
1076
params->style_functions->draw_separator (cr, colors, params, &separator,
1077
width-1.5, 4.0, 2, height-8.0);
1079
params->style_functions->draw_separator (cr, colors, params, &separator,
1080
1.5, 4.0, 2, height-8.0);
1085
clearlooks_glossy_draw_toolbar (cairo_t *cr,
1086
const ClearlooksColors *colors,
1087
const WidgetParameters *widget,
1088
const ToolbarParameters *toolbar,
1089
int x, int y, int width, int height)
1095
const CairoColor *fill = &colors->bg[GTK_STATE_NORMAL];
1096
const CairoColor *dark = &colors->shade[3];
1098
ge_shade_color (fill, 1.1, &light);
1100
cairo_set_line_width (cr, 1.0);
1101
cairo_translate (cr, x, y);
1103
if (toolbar->style == 1) /* Enable Extra features */
1105
cairo_pattern_t *pattern;
1106
CairoColor shade1, shade2, shade3;
1108
ge_shade_color (fill, 1.08, &shade1);
1109
ge_shade_color (fill, 1.04, &shade2);
1110
ge_shade_color (fill, 1.04, &shade3);
1113
pattern = cairo_pattern_create_linear (0, 0, 0, height);
1114
cairo_pattern_add_color_stop_rgb (pattern, 0.0, shade1.r, shade1.g, shade1.b);
1115
cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1116
cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1117
cairo_pattern_add_color_stop_rgb (pattern, 1.0, shade3.r, shade3.g, shade3.b);
1119
cairo_set_source (cr, pattern);
1120
cairo_rectangle (cr, 0, 0, width, height);
1123
cairo_pattern_destroy (pattern);
1127
ge_cairo_set_color (cr, fill);
1130
if (!toolbar->topmost)
1132
/* Draw highlight */
1133
cairo_move_to (cr, 0, 0.5);
1134
cairo_line_to (cr, width-1, 0.5);
1135
ge_cairo_set_color (cr, &light);
1141
cairo_move_to (cr, 0, height-0.5);
1142
cairo_line_to (cr, width-1, height-0.5);
1143
ge_cairo_set_color (cr, dark);
1148
clearlooks_glossy_draw_menuitem (cairo_t *cr,
1149
const ClearlooksColors *colors,
1150
const WidgetParameters *params,
1151
int x, int y, int width, int height)
1153
const CairoColor *fill = &colors->spot[1];
1154
const CairoColor *border = &colors->spot[2];
1155
CairoColor shade1, shade2, shade3;
1156
cairo_pattern_t *pattern;
1158
ge_shade_color (fill, 1.16, &shade1);
1159
ge_shade_color (fill, 1.08, &shade2);
1160
ge_shade_color (fill, 1.08, &shade3);
1161
cairo_set_line_width (cr, 1.0);
1163
ge_cairo_rounded_rectangle (cr, x+0.5, y+0.5, width - 1, height - 1, params->radius, params->corners);
1165
pattern = cairo_pattern_create_linear (x, y, x, y + height);
1166
cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
1167
cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1168
cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1169
cairo_pattern_add_color_stop_rgb (pattern, 1, shade3.r, shade3.g, shade3.b);
1171
cairo_set_source (cr, pattern);
1172
cairo_fill_preserve (cr);
1173
cairo_pattern_destroy (pattern);
1175
ge_cairo_set_color (cr, border);
1180
clearlooks_glossy_draw_menubaritem (cairo_t *cr,
1181
const ClearlooksColors *colors,
1182
const WidgetParameters *params,
1183
int x, int y, int width, int height)
1185
const CairoColor *fill = &colors->spot[1];
1186
const CairoColor *border = &colors->spot[2];
1187
CairoColor shade1, shade2, shade3;
1188
cairo_pattern_t *pattern;
1190
ge_shade_color (fill, 1.16, &shade1);
1191
ge_shade_color (fill, 1.08, &shade2);
1192
ge_shade_color (fill, 1.08, &shade3);
1193
cairo_set_line_width (cr, 1.0);
1195
ge_cairo_rounded_rectangle (cr, x+0.5, y+0.5, width - 1, height - 1, params->radius, params->corners);
1197
pattern = cairo_pattern_create_linear (x, y, x, y + height);
1198
cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
1199
cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
1200
cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill->r, fill->g, fill->b);
1201
cairo_pattern_add_color_stop_rgb (pattern, 1, shade3.r, shade3.g, shade3.b);
1203
cairo_set_source (cr, pattern);
1204
cairo_fill_preserve (cr);
1205
cairo_pattern_destroy (pattern);
1207
ge_cairo_set_color (cr, border);
1212
clearlooks_glossy_draw_selected_cell (cairo_t *cr,
1213
const ClearlooksColors *colors,
1214
const WidgetParameters *params,
1215
int x, int y, int width, int height)
1220
color = colors->base[params->state_type];
1222
color = colors->base[GTK_STATE_ACTIVE];
1224
clearlooks_draw_glossy_gradient (cr, x, y, width, height, &color, params->disabled, 0.0, CR_CORNER_NONE);
1229
clearlooks_glossy_draw_radiobutton (cairo_t *cr,
1230
const ClearlooksColors *colors,
1231
const WidgetParameters *widget,
1232
const CheckboxParameters *checkbox,
1233
int x, int y, int width, int height)
1238
const CairoColor *border;
1239
const CairoColor *dot;
1241
CairoColor highlight;
1242
cairo_pattern_t *pt;
1243
gboolean inconsistent;
1244
gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
1246
inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
1247
draw_bullet |= inconsistent;
1249
if (widget->disabled)
1251
border = &colors->shade[5];
1252
dot = &colors->shade[6];
1256
if (widget->prelight)
1257
border = &colors->spot[2];
1259
border = &colors->shade[6];
1260
dot = &colors->text[0];
1263
ge_shade_color (&widget->parentbg, 0.9, &shadow);
1264
ge_shade_color (&widget->parentbg, 1.1, &highlight);
1266
pt = cairo_pattern_create_linear (0, 0, 13, 13);
1267
cairo_pattern_add_color_stop_rgb (pt, 0.0, shadow.r, shadow.b, shadow.g);
1268
cairo_pattern_add_color_stop_rgba (pt, 0.5, shadow.r, shadow.b, shadow.g, 0.5);
1269
cairo_pattern_add_color_stop_rgba (pt, 0.5, highlight.r, highlight.g, highlight.b, 0.5);
1270
cairo_pattern_add_color_stop_rgb (pt, 1.0, highlight.r, highlight.g, highlight.b);
1272
cairo_translate (cr, x, y);
1274
cairo_set_line_width (cr, 2);
1275
cairo_arc (cr, 7, 7, 6, 0, G_PI*2);
1276
cairo_set_source (cr, pt);
1278
cairo_pattern_destroy (pt);
1280
cairo_set_line_width (cr, 1);
1282
cairo_arc (cr, 7, 7, 5.5, 0, G_PI*2);
1284
if (!widget->disabled)
1286
if (widget->prelight)
1287
clearlooks_set_mixed_color (cr, &colors->base[0], &colors->spot[1], 0.5);
1289
ge_cairo_set_color (cr, &colors->base[0]);
1290
cairo_fill_preserve (cr);
1293
ge_cairo_set_color (cr, border);
1300
cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
1301
cairo_set_line_width (cr, 4);
1303
cairo_move_to(cr, 5, 7);
1304
cairo_line_to(cr, 9, 7);
1306
ge_cairo_set_color (cr, dot);
1311
cairo_arc (cr, 7, 7, 3, 0, G_PI*2);
1312
ge_cairo_set_color (cr, dot);
1315
cairo_arc (cr, 6, 6, 1, 0, G_PI*2);
1316
cairo_set_source_rgba (cr, highlight.r, highlight.g, highlight.b, 0.5);
1323
clearlooks_glossy_draw_checkbox (cairo_t *cr,
1324
const ClearlooksColors *colors,
1325
const WidgetParameters *widget,
1326
const CheckboxParameters *checkbox,
1327
int x, int y, int width, int height)
1329
const CairoColor *border;
1330
const CairoColor *dot;
1331
gboolean inconsistent = FALSE;
1332
gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
1334
inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
1335
draw_bullet |= inconsistent;
1337
if (widget->disabled)
1339
border = &colors->shade[5];
1340
dot = &colors->shade[6];
1344
if (widget->prelight)
1345
border = &colors->spot[2];
1347
border = &colors->shade[6];
1348
dot = &colors->text[GTK_STATE_NORMAL];
1351
cairo_translate (cr, x, y);
1352
cairo_set_line_width (cr, 1);
1354
if (widget->xthickness > 2 && widget->ythickness > 2)
1356
widget->style_functions->draw_inset (cr, &widget->parentbg, 0.5, 0.5,
1357
width-1, height-1, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
1359
/* Draw the rectangle for the checkbox itself */
1360
ge_cairo_rounded_rectangle (cr, 1.5, 1.5,
1361
width-3, height-3, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
1365
/* Draw the rectangle for the checkbox itself */
1366
ge_cairo_rounded_rectangle (cr, 0.5, 0.5,
1367
width-1, height-1, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
1370
if (!widget->disabled)
1372
if (widget->prelight)
1373
clearlooks_set_mixed_color (cr, &colors->base[0], &colors->spot[1], 0.5);
1375
ge_cairo_set_color (cr, &colors->base[0]);
1376
cairo_fill_preserve (cr);
1379
ge_cairo_set_color (cr, border);
1384
if (inconsistent) /* Inconsistent */
1386
cairo_set_line_width (cr, 2.0);
1387
cairo_move_to (cr, 3, height*0.5);
1388
cairo_line_to (cr, width-3, height*0.5);
1392
cairo_set_line_width (cr, 1.7);
1393
cairo_move_to (cr, 0.5 + (width*0.2), (height*0.5));
1394
cairo_line_to (cr, 0.5 + (width*0.4), (height*0.7));
1396
cairo_curve_to (cr, 0.5 + (width*0.4), (height*0.7),
1397
0.5 + (width*0.5), (height*0.4),
1398
0.5 + (width*0.70), (height*0.25));
1402
ge_cairo_set_color (cr, dot);
1408
clearlooks_register_style_glossy (ClearlooksStyleFunctions *functions)
1410
functions->draw_inset = clearlooks_glossy_draw_inset;
1411
functions->draw_button = clearlooks_glossy_draw_button;
1412
functions->draw_progressbar_trough = clearlooks_glossy_draw_progressbar_trough;
1413
functions->draw_progressbar_fill = clearlooks_glossy_draw_progressbar_fill;
1414
functions->draw_scale_trough = clearlooks_glossy_draw_scale_trough;
1415
functions->draw_tab = clearlooks_glossy_draw_tab;
1416
functions->draw_slider = clearlooks_glossy_draw_slider;
1417
functions->draw_slider_button = clearlooks_glossy_draw_slider_button;
1418
functions->draw_scrollbar_stepper = clearlooks_glossy_draw_scrollbar_stepper;
1419
functions->draw_scrollbar_slider = clearlooks_glossy_draw_scrollbar_slider;
1420
functions->draw_list_view_header = clearlooks_glossy_draw_list_view_header;
1421
functions->draw_toolbar = clearlooks_glossy_draw_toolbar;
1422
functions->draw_menuitem = clearlooks_glossy_draw_menuitem;
1423
functions->draw_menubaritem = clearlooks_glossy_draw_menubaritem;
1424
functions->draw_selected_cell = clearlooks_glossy_draw_selected_cell;
1425
functions->draw_checkbox = clearlooks_glossy_draw_checkbox;
1426
functions->draw_radiobutton = clearlooks_glossy_draw_radiobutton;