Update to clearlooks from gtk-engines-2.16.0
[ardour.git] / libs / clearlooks / clearlooks_style.c
1 /* Clearlooks theme engine
2  * Copyright (C) 2005 Richard Stellingwerff
3  * Copyright (C) 2007 Benjamin Berg
4  * Copyright (C) 2007 Andrea Cimitan
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  */
22
23 #include <gtk/gtk.h>
24 #include <cairo.h>
25 #include <math.h>
26 #include <string.h>
27
28 #include <ge-support.h>
29 #include "clearlooks_style.h"
30 #include "clearlooks_rc_style.h"
31 #include "clearlooks_draw.h"
32 #include "support.h"
33
34 /* #define DEBUG 1 */
35
36 #define DETAIL(xx)   ((detail) && (!strcmp(xx, detail)))
37 #define CHECK_HINT(xx) (ge_check_hint ((xx), CLEARLOOKS_RC_STYLE ((style)->rc_style)->hint, widget))
38
39 #define DRAW_ARGS    GtkStyle       *style, \
40                      GdkWindow      *window, \
41                      GtkStateType    state_type, \
42                      GtkShadowType   shadow_type, \
43                      GdkRectangle   *area, \
44                      GtkWidget      *widget, \
45                      const gchar    *detail, \
46                      gint            x, \
47                      gint            y, \
48                      gint            width, \
49                      gint            height
50
51 #ifdef HAVE_ANIMATION
52 #include "animation.h"
53 #endif
54
55 #define STYLE_FUNCTION(function) (CLEARLOOKS_STYLE_GET_CLASS (style)->style_functions[CLEARLOOKS_STYLE (style)->style].function)
56
57 G_DEFINE_DYNAMIC_TYPE (ClearlooksStyle, clearlooks_style, GTK_TYPE_STYLE)
58
59 static void
60 clearlooks_set_widget_parameters (const GtkWidget      *widget,
61                                   const GtkStyle       *style,
62                                   GtkStateType          state_type,
63                                   WidgetParameters     *params)
64 {
65         params->style_functions = &(CLEARLOOKS_STYLE_GET_CLASS (style)->style_functions[CLEARLOOKS_STYLE (style)->style]);
66         params->style_constants = &(CLEARLOOKS_STYLE_GET_CLASS (style)->style_constants[CLEARLOOKS_STYLE (style)->style]);
67
68         params->active        = (state_type == GTK_STATE_ACTIVE);
69         params->prelight      = (state_type == GTK_STATE_PRELIGHT);
70         params->disabled      = (state_type == GTK_STATE_INSENSITIVE);
71         params->state_type    = (ClearlooksStateType)state_type;
72         params->corners       = CR_CORNER_ALL;
73         params->ltr           = ge_widget_is_ltr ((GtkWidget*)widget);
74         params->focus         = widget && GTK_WIDGET_HAS_FOCUS (widget);
75         params->is_default    = widget && GE_WIDGET_HAS_DEFAULT (widget);
76         params->enable_shadow = FALSE;
77         params->radius        = CLEARLOOKS_STYLE (style)->radius;
78
79         params->xthickness    = style->xthickness;
80         params->ythickness    = style->ythickness;
81
82         /* This is used in GtkEntry to fake transparency. The reason to do this
83          * is that the entry has it's entire background filled with base[STATE].
84          * This is not a very good solution as it will eg. fail if one changes
85          * the background color of a notebook. */
86         params->parentbg = CLEARLOOKS_STYLE (style)->colors.bg[state_type];
87         clearlooks_get_parent_bg (widget, &params->parentbg);
88 }
89
90 static void
91 clearlooks_style_draw_flat_box (DRAW_ARGS)
92 {
93         if (detail &&
94             state_type == GTK_STATE_SELECTED && (
95             !strncmp ("cell_even", detail, 9) ||
96             !strncmp ("cell_odd", detail, 8)))
97         {
98                 WidgetParameters params;
99                 ClearlooksStyle  *clearlooks_style;
100                 ClearlooksColors *colors;
101                 cairo_t          *cr;
102
103                 CHECK_ARGS
104                 SANITIZE_SIZE
105
106                 clearlooks_style = CLEARLOOKS_STYLE (style);
107                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
108                 colors = &clearlooks_style->colors;
109                 cr = ge_gdk_drawable_to_cairo (window, area);
110
111                 /* XXX: We could expose the side details by setting params->corners accordingly
112                  *      or adding another option. */
113                 STYLE_FUNCTION (draw_selected_cell) (cr, colors, &params, x, y, width, height);
114
115                 cairo_destroy (cr);
116         }
117         else if (DETAIL ("tooltip"))
118         {
119                 WidgetParameters params;
120                 ClearlooksStyle  *clearlooks_style;
121                 ClearlooksColors *colors;
122                 cairo_t          *cr;
123
124                 CHECK_ARGS
125                 SANITIZE_SIZE
126
127                 clearlooks_style = CLEARLOOKS_STYLE (style);
128                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
129                 colors = &clearlooks_style->colors;
130                 cr = ge_gdk_drawable_to_cairo (window, area);
131
132                 STYLE_FUNCTION (draw_tooltip) (cr, colors, &params, x, y, width, height);
133
134                 cairo_destroy (cr);
135         }
136         else if ((CLEARLOOKS_STYLE (style)->style == CL_STYLE_GLOSSY || CLEARLOOKS_STYLE (style)->style == CL_STYLE_GUMMY) &&
137                  ((DETAIL("checkbutton") || DETAIL("radiobutton")) && state_type == GTK_STATE_PRELIGHT))
138         {
139                 /* XXX: Don't draw any check/radiobutton bg in GLOSSY or GUMMY mode. */
140         }
141         else
142         {
143                 GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_flat_box (style, window, state_type,
144                                                         shadow_type,
145                                                         area, widget, detail,
146                                                         x, y, width, height);
147         }
148 }
149
150 static void
151 clearlooks_style_draw_shadow (DRAW_ARGS)
152 {
153         ClearlooksStyle  *clearlooks_style = CLEARLOOKS_STYLE (style);
154         ClearlooksColors *colors = &clearlooks_style->colors;
155         cairo_t          *cr     = ge_gdk_drawable_to_cairo (window, area);
156
157         CHECK_ARGS
158         SANITIZE_SIZE
159
160         /* The "frame" thing is a hack because of GtkCombo. */
161         if ((DETAIL ("entry") && !CHECK_HINT (GE_HINT_TREEVIEW)) ||
162             (DETAIL ("frame") && CHECK_HINT (GE_HINT_COMBOBOX_ENTRY)))
163         {
164                 WidgetParameters params;
165
166                 /* Override the entries state type, because we are too lame to handle this via
167                  * the focus ring, and GtkEntry doesn't even set the INSENSITIVE state ... */
168                 if (state_type == GTK_STATE_NORMAL && widget && GE_IS_ENTRY (widget))
169                         state_type = GTK_WIDGET_STATE (widget);
170
171                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
172
173                 if (CHECK_HINT (GE_HINT_COMBOBOX_ENTRY) || CHECK_HINT (GE_HINT_SPINBUTTON))
174                 {
175                         width += style->xthickness;
176                         if (!params.ltr)
177                                 x -= style->xthickness;
178
179                         if (params.ltr)
180                                 params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
181                         else
182                                 params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
183                 }
184                 
185                 /* Fill the background as it is initilized to base[NORMAL].
186                  * Relevant GTK+ bug: http://bugzilla.gnome.org/show_bug.cgi?id=513471
187                  * The fill only happens if no hint has been added by some application
188                  * that is faking GTK+ widgets. */
189                 if (!widget || !g_object_get_data(G_OBJECT (widget), "transparent-bg-hint"))
190                 {
191                         cairo_rectangle (cr, 0, 0, width, height);
192                         ge_cairo_set_color (cr, &params.parentbg);
193                         cairo_fill (cr);
194                 }
195
196                 STYLE_FUNCTION (draw_entry) (cr, &clearlooks_style->colors, &params,
197                                              x, y, width, height);
198         }
199         else if (DETAIL ("frame") && CHECK_HINT (GE_HINT_STATUSBAR))
200         {
201                 WidgetParameters params;
202
203                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
204
205                 gtk_style_apply_default_background (style, window, TRUE, state_type,
206                                                     area, x, y, width, height);
207                 if (shadow_type != GTK_SHADOW_NONE)
208                         STYLE_FUNCTION (draw_statusbar) (cr, colors, &params,
209                                                          x, y, width, height);
210         }
211         else if (DETAIL ("frame") || DETAIL ("calendar"))
212         {
213                 WidgetParameters params;
214                 FrameParameters  frame;
215                 frame.shadow  = shadow_type;
216                 frame.gap_x   = -1;  /* No gap will be drawn */
217                 frame.border  = &colors->shade[4];
218
219                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
220                 params.corners = CR_CORNER_NONE;
221
222                 if (widget && !g_str_equal ("XfcePanelWindow", gtk_widget_get_name (gtk_widget_get_toplevel (widget))))
223                         STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame,
224                                                     x, y, width, height);
225         }
226         else if (DETAIL ("scrolled_window") || DETAIL ("viewport") || detail == NULL)
227         {
228                 CairoColor border;
229
230                 if (CLEARLOOKS_STYLE (style)->style == CL_STYLE_CLASSIC)
231                         ge_shade_color ((CairoColor*)&colors->bg[0], 0.78, &border);
232                 else
233                         border = colors->shade[5];
234
235                 cairo_rectangle (cr, x+0.5, y+0.5, width-1, height-1);
236                 ge_cairo_set_color (cr, &border);
237                 cairo_set_line_width (cr, 1);
238                 cairo_stroke (cr);
239         }
240         else
241         {
242                 WidgetParameters params;
243                 FrameParameters frame;
244
245                 frame.shadow = shadow_type;
246                 frame.gap_x  = -1;
247                 frame.border = &colors->shade[5];
248                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
249                 params.corners = CR_CORNER_ALL;
250
251                 STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame, x, y, width, height);
252         }
253
254         cairo_destroy (cr);
255 }
256
257 static void
258 clearlooks_style_draw_box_gap (DRAW_ARGS,
259                                GtkPositionType gap_side,
260                                gint            gap_x,
261                                gint            gap_width)
262 {
263         ClearlooksStyle  *clearlooks_style = CLEARLOOKS_STYLE (style);
264         ClearlooksColors *colors = &clearlooks_style->colors;
265         cairo_t          *cr;
266
267         CHECK_ARGS
268         SANITIZE_SIZE
269
270         cr = ge_gdk_drawable_to_cairo (window, area);
271
272         if (DETAIL ("notebook"))
273         {
274                 WidgetParameters params;
275                 FrameParameters  frame;
276                 gboolean start, end;
277
278                 frame.shadow    = shadow_type;
279                 frame.gap_side  = gap_side;
280                 frame.gap_x     = gap_x;
281                 frame.gap_width = gap_width;
282                 frame.border    = &colors->shade[5];
283
284                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
285
286                 clearlooks_get_notebook_tab_position (widget, &start, &end);
287
288                 params.corners = CR_CORNER_ALL;
289                 switch (gap_side)
290                 {
291                         case GTK_POS_TOP:
292                                 if (ge_widget_is_ltr (widget))
293                                 {
294                                         if (start)
295                                                 params.corners ^= CR_CORNER_TOPLEFT;
296                                         if (end)
297                                                 params.corners ^= CR_CORNER_TOPRIGHT;
298                                 }
299                                 else
300                                 {
301                                         if (start)
302                                                 params.corners ^= CR_CORNER_TOPRIGHT;
303                                         if (end)
304                                                 params.corners ^= CR_CORNER_TOPLEFT;
305                                 }
306                         break;
307                         case GTK_POS_BOTTOM:
308                                 if (ge_widget_is_ltr (widget))
309                                 {
310                                         if (start)
311                                                 params.corners ^= CR_CORNER_BOTTOMLEFT;
312                                         if (end)
313                                                 params.corners ^= CR_CORNER_BOTTOMRIGHT;
314                                 }
315                                 else
316                                 {
317                                         if (start)
318                                                 params.corners ^= CR_CORNER_BOTTOMRIGHT;
319                                         if (end)
320                                                 params.corners ^= CR_CORNER_BOTTOMLEFT;
321                                 }
322                         break;
323                         case GTK_POS_LEFT:
324                                 if (start)
325                                         params.corners ^= CR_CORNER_TOPLEFT;
326                                 if (end)
327                                         params.corners ^= CR_CORNER_BOTTOMLEFT;
328                         break;
329                         case GTK_POS_RIGHT:
330                                 if (start)
331                                         params.corners ^= CR_CORNER_TOPRIGHT;
332                                 if (end)
333                                         params.corners ^= CR_CORNER_BOTTOMRIGHT;
334                         break;
335                 }
336
337                 /* Fill the background with bg[NORMAL] */
338                 ge_cairo_rounded_rectangle (cr, x, y, width, height, params.radius, params.corners);
339                 ge_cairo_set_color (cr, &colors->bg[GTK_STATE_NORMAL]);
340                 cairo_fill (cr);
341
342                 STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame,
343                                             x, y, width, height);
344         }
345         else
346         {
347                 GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_box_gap (style, window, state_type, shadow_type,
348                                                        area, widget, detail,
349                                                        x, y, width, height,
350                                                        gap_side, gap_x, gap_width);
351         }
352
353         cairo_destroy (cr);
354 }
355
356 static void
357 clearlooks_style_draw_extension (DRAW_ARGS, GtkPositionType gap_side)
358 {
359         ClearlooksStyle  *clearlooks_style = CLEARLOOKS_STYLE (style);
360         ClearlooksColors *colors = &clearlooks_style->colors;
361         cairo_t          *cr;
362
363         CHECK_ARGS
364         SANITIZE_SIZE
365
366         cr = ge_gdk_drawable_to_cairo (window, area);
367
368         if (DETAIL ("tab"))
369         {
370                 WidgetParameters params;
371                 TabParameters    tab;
372                 FocusParameters  focus;
373
374                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
375
376                 tab.gap_side = (ClearlooksGapSide)gap_side;
377
378                 switch (gap_side)
379                 {
380                         case CL_GAP_TOP:
381                                 params.corners = CR_CORNER_BOTTOMLEFT | CR_CORNER_BOTTOMRIGHT;
382                                 break;
383                         case CL_GAP_BOTTOM:
384                                 params.corners = CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT;
385                                 break;
386                         case CL_GAP_LEFT:
387                                 params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
388                                 break;
389                         case CL_GAP_RIGHT:
390                                 params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
391                                 break;
392                 }
393
394                 /* Focus color */
395                 if (clearlooks_style->has_focus_color)
396                 {
397                         ge_gdk_color_to_cairo (&clearlooks_style->focus_color, &focus.color);
398                         focus.has_color = TRUE;
399                 }
400                 else
401                         focus.color = colors->bg[GTK_STATE_SELECTED];
402
403                 tab.focus = focus;
404
405                 STYLE_FUNCTION(draw_tab) (cr, colors, &params, &tab,
406                                           x, y, width, height);
407         }
408         else
409         {
410                 GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_extension (style, window, state_type, shadow_type, area,
411                                                          widget, detail, x, y, width, height,
412                                                          gap_side);
413         }
414
415         cairo_destroy (cr);
416 }
417
418 static void
419 clearlooks_style_draw_handle (DRAW_ARGS, GtkOrientation orientation)
420 {
421         ClearlooksStyle  *clearlooks_style = CLEARLOOKS_STYLE (style);
422         ClearlooksColors *colors = &clearlooks_style->colors;
423         cairo_t          *cr;
424
425         CHECK_ARGS
426         SANITIZE_SIZE
427
428         cr = ge_gdk_drawable_to_cairo (window, area);
429
430         if (DETAIL ("handlebox"))
431         {
432                 WidgetParameters params;
433                 HandleParameters handle;
434
435                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
436                 handle.type = CL_HANDLE_TOOLBAR;
437                 handle.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
438
439                 STYLE_FUNCTION(draw_handle) (cr, colors, &params, &handle,
440                                              x, y, width, height);
441         }
442         else if (DETAIL ("paned"))
443         {
444                 WidgetParameters params;
445                 HandleParameters handle;
446
447                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
448                 handle.type = CL_HANDLE_SPLITTER;
449                 handle.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
450
451                 STYLE_FUNCTION(draw_handle) (cr, colors, &params, &handle,
452                                              x, y, width, height);
453         }
454         else
455         {
456                 WidgetParameters params;
457                 HandleParameters handle;
458
459                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
460                 handle.type = CL_HANDLE_TOOLBAR;
461                 handle.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
462
463                 STYLE_FUNCTION(draw_handle) (cr, colors, &params, &handle,
464                                              x, y, width, height);
465         }
466
467         cairo_destroy (cr);
468 }
469
470 static void
471 clearlooks_style_draw_box (DRAW_ARGS)
472 {
473         ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
474         const ClearlooksColors *colors;
475         cairo_t *cr;
476
477         cr     = ge_gdk_drawable_to_cairo (window, area);
478         colors = &clearlooks_style->colors;
479
480         CHECK_ARGS
481         SANITIZE_SIZE
482
483         if (DETAIL ("menubar"))
484         {
485                 WidgetParameters params;
486                 MenuBarParameters menubar;
487                 gboolean horizontal;
488
489                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
490
491                 menubar.style = clearlooks_style->menubarstyle;
492
493                 horizontal = height < 2*width;
494                 /* This is not that great. Ideally we would have a nice vertical menubar. */
495                 if ((shadow_type != GTK_SHADOW_NONE) && horizontal)
496                         STYLE_FUNCTION(draw_menubar) (cr, colors, &params, &menubar,
497                                                       x, y, width, height);
498         }
499         else if (DETAIL ("button") && CHECK_HINT (GE_HINT_TREEVIEW_HEADER))
500         {
501                 WidgetParameters params;
502                 ListViewHeaderParameters header;
503
504                 gint columns, column_index;
505                 gboolean resizable = TRUE;
506
507                 /* XXX: This makes unknown treeview header "middle", in need for something nicer */
508                 columns = 3;
509                 column_index = 1;
510
511                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
512
513                 params.corners = CR_CORNER_NONE;
514
515                 if (GE_IS_TREE_VIEW (widget->parent))
516                 {
517                         clearlooks_treeview_get_header_index (GTK_TREE_VIEW(widget->parent),
518                                                               widget, &column_index, &columns,
519                                                               &resizable);
520                 }
521                 else if (GE_IS_CLIST (widget->parent))
522                 {
523                         clearlooks_clist_get_header_index (GTK_CLIST(widget->parent),
524                                                            widget, &column_index, &columns);
525                 }
526
527                 header.resizable = resizable;
528
529                 header.order = 0;
530                 if (column_index == 0)
531                         header.order |= params.ltr ? CL_ORDER_FIRST : CL_ORDER_LAST;
532                 if (column_index == columns-1)
533                         header.order |= params.ltr ? CL_ORDER_LAST : CL_ORDER_FIRST;
534
535                 gtk_style_apply_default_background (style, window, FALSE, state_type, area, x, y, width, height);
536
537                 STYLE_FUNCTION(draw_list_view_header) (cr, colors, &params, &header,
538                                                        x, y, width, height);
539         }
540         else if (DETAIL ("button") || DETAIL ("buttondefault"))
541         {
542                 WidgetParameters params;
543                 ShadowParameters shadow = { CR_CORNER_ALL, CL_SHADOW_NONE } ;
544                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
545                 params.active = shadow_type == GTK_SHADOW_IN;
546
547                 if (CHECK_HINT (GE_HINT_COMBOBOX_ENTRY))
548                 {
549                         if (params.ltr)
550                                 params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
551                         else
552                                 params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
553
554                         shadow.shadow = CL_SHADOW_IN;
555
556                         if (params.xthickness > 2)
557                         {
558                                 if (params.ltr)
559                                         x--;
560                                 width++;
561                         }
562                 }
563                 else
564                 {
565                         params.corners = CR_CORNER_ALL;
566                         if (clearlooks_style->reliefstyle != 0)
567                                 params.enable_shadow = TRUE;
568                 }
569
570                 STYLE_FUNCTION(draw_button) (cr, &clearlooks_style->colors, &params,
571                                              x, y, width, height);
572         }
573         else if (DETAIL ("spinbutton_up") || DETAIL ("spinbutton_down"))
574         {
575                 if (state_type == GTK_STATE_ACTIVE)
576                 {
577                         WidgetParameters params;
578                         clearlooks_set_widget_parameters (widget, style, state_type, &params);
579
580                         if (style->xthickness == 3)
581                         {
582                                 width++;
583                                 if (params.ltr)
584                                         x--;
585                         }
586
587                         if (DETAIL ("spinbutton_up"))
588                         {
589                                 height+=2;
590                                 if (params.ltr)
591                                         params.corners = CR_CORNER_TOPRIGHT;
592                                 else
593                                         params.corners = CR_CORNER_TOPLEFT;
594                         }
595                         else
596                         {
597                                 if (params.ltr)
598                                         params.corners = CR_CORNER_BOTTOMRIGHT;
599                                 else
600                                         params.corners = CR_CORNER_BOTTOMLEFT;
601                         }
602
603                         STYLE_FUNCTION(draw_spinbutton_down) (cr, &clearlooks_style->colors, &params, x, y, width, height);
604                 }
605         }
606         else if (DETAIL ("spinbutton"))
607         {
608                 WidgetParameters params;
609
610                 /* The "spinbutton" box is always drawn with state NORMAL, even if it is insensitive.
611                  * So work around this here. */
612                 if (state_type == GTK_STATE_NORMAL && widget && GE_IS_ENTRY (widget))
613                         state_type = GTK_WIDGET_STATE (widget);
614
615                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
616
617                 if (params.ltr)
618                         params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
619                 else
620                         params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
621
622                 if (style->xthickness == 3)
623                 {
624                         if (params.ltr)
625                                 x--;
626                         width++;
627                 }
628
629                 STYLE_FUNCTION(draw_spinbutton) (cr, &clearlooks_style->colors, &params,
630                                                  x, y, width, height);
631         }
632         else if (detail && g_str_has_prefix (detail, "trough") && CHECK_HINT (GE_HINT_SCALE))
633         {
634                 WidgetParameters params;
635                 SliderParameters slider;
636
637                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
638                 params.corners    = CR_CORNER_NONE;
639
640                 slider.lower = DETAIL ("trough-lower");
641                 slider.fill_level = DETAIL ("trough-fill-level") || DETAIL ("trough-fill-level-full");
642
643                 if (CHECK_HINT (GE_HINT_HSCALE))
644                         slider.horizontal = TRUE;
645                 else if (CHECK_HINT (GE_HINT_VSCALE))
646                         slider.horizontal = FALSE;
647                 else /* Fallback based on the size... */
648                         slider.horizontal = width >= height;
649
650                 STYLE_FUNCTION(draw_scale_trough) (cr, &clearlooks_style->colors,
651                                                    &params, &slider,
652                                                    x, y, width, height);
653         }
654         else if (DETAIL ("trough") && CHECK_HINT (GE_HINT_PROGRESSBAR))
655         {
656                 WidgetParameters params;
657
658                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
659
660                 /* Fill the background as it is initilized to base[NORMAL].
661                  * Relevant GTK+ bug: http://bugzilla.gnome.org/show_bug.cgi?id=513476
662                  * The fill only happens if no hint has been added by some application
663                  * that is faking GTK+ widgets. */
664                 if (!widget || !g_object_get_data(G_OBJECT (widget), "transparent-bg-hint"))
665                 {
666                         cairo_rectangle (cr, 0, 0, width, height);
667                         ge_cairo_set_color (cr, &params.parentbg);
668                         cairo_fill (cr);
669                 }
670                 STYLE_FUNCTION(draw_progressbar_trough) (cr, colors, &params,
671                                                          x, y, width, height);
672         }
673         else if (DETAIL ("trough") && CHECK_HINT (GE_HINT_SCROLLBAR))
674         {
675                 WidgetParameters params;
676                 ScrollBarParameters scrollbar;
677                 gboolean trough_under_steppers = TRUE;
678                 ClearlooksStepper steppers;
679
680                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
681                 params.corners = CR_CORNER_ALL;
682
683                 scrollbar.horizontal = TRUE;
684                 scrollbar.junction   = clearlooks_scrollbar_get_junction (widget);
685                 
686                 steppers = clearlooks_scrollbar_visible_steppers (widget);
687
688                 if (CHECK_HINT (GE_HINT_HSCROLLBAR))
689                         scrollbar.horizontal = TRUE;
690                 else if (CHECK_HINT (GE_HINT_VSCROLLBAR))
691                         scrollbar.horizontal = FALSE;
692                 else /* Fallback based on the size  ... */
693                         scrollbar.horizontal = width >= height;
694
695                 if (widget)
696                         gtk_widget_style_get (widget,
697                                               "trough-under-steppers", &trough_under_steppers,
698                                               NULL);
699
700                 if (trough_under_steppers)
701                 {
702                         /* If trough under steppers is set, then we decrease the size
703                          * slightly. The size is decreased so that the trough is not
704                          * visible underneath the steppers. This is not really needed
705                          * as one can use the trough-under-steppers style property,
706                          * but it needs to exist for backward compatibility. */
707                         if (scrollbar.horizontal)
708                         {
709                                 if (steppers & (CL_STEPPER_A | CL_STEPPER_B))
710                                 {
711                                         x += 2;
712                                         width -= 2;
713                                 }
714                                 if (steppers & (CL_STEPPER_C | CL_STEPPER_D))
715                                 {
716                                         width -= 2;
717                                 }
718                         }
719                         else
720                         {
721                                 if (steppers & (CL_STEPPER_A | CL_STEPPER_B))
722                                 {
723                                         y += 2;
724                                         height -= 2;
725                                 }
726                                 if (steppers & (CL_STEPPER_C | CL_STEPPER_D))
727                                 {
728                                         height -= 2;
729                                 }
730                         }
731                 }
732
733                 STYLE_FUNCTION(draw_scrollbar_trough) (cr, colors, &params, &scrollbar,
734                                                        x, y, width, height);
735         }
736         else if (DETAIL ("bar"))
737         {
738                 WidgetParameters      params;
739                 ProgressBarParameters progressbar;
740                 gdouble               elapsed = 0.0;
741
742 #ifdef HAVE_ANIMATION
743                 if(clearlooks_style->animation && CL_IS_PROGRESS_BAR (widget))
744                 {
745                         gboolean activity_mode = GTK_PROGRESS (widget)->activity_mode;
746
747                         if (!activity_mode)
748                                 clearlooks_animation_progressbar_add ((gpointer)widget);
749                 }
750
751                 elapsed = clearlooks_animation_elapsed (widget);
752 #endif
753
754                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
755
756                 if (widget && GE_IS_PROGRESS_BAR (widget))
757                 {
758                         progressbar.orientation = gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (widget));
759                         progressbar.value = gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(widget));
760                         progressbar.pulsing = GTK_PROGRESS (widget)->activity_mode;
761                 }
762                 else
763                 {
764                         progressbar.orientation = CL_ORIENTATION_LEFT_TO_RIGHT;
765                         progressbar.value = 0;
766                         progressbar.pulsing = FALSE;
767                 }
768
769                 if (!params.ltr)
770                 {
771                         if (progressbar.orientation == GTK_PROGRESS_LEFT_TO_RIGHT)
772                                 progressbar.orientation = GTK_PROGRESS_RIGHT_TO_LEFT;
773                         else if (progressbar.orientation == GTK_PROGRESS_RIGHT_TO_LEFT)
774                                 progressbar.orientation = GTK_PROGRESS_LEFT_TO_RIGHT;
775                 }
776
777                 /* Following is a hack to have a larger clip area, the one passed in
778                  * does not allow for the shadow. */
779                 if (area)
780                 {
781                         GdkRectangle tmp = *area;
782                         if (!progressbar.pulsing)
783                         {
784                                 switch (progressbar.orientation)
785                                 {
786                                         case GTK_PROGRESS_RIGHT_TO_LEFT:
787                                                 tmp.x -= 1;
788                                         case GTK_PROGRESS_LEFT_TO_RIGHT:
789                                                 tmp.width += 1;
790                                                 break;
791                                         case GTK_PROGRESS_BOTTOM_TO_TOP:
792                                                 tmp.y -= 1;
793                                         case GTK_PROGRESS_TOP_TO_BOTTOM:
794                                                 tmp.height += 1;
795                                                 break;
796                                 }
797                         }
798                         else
799                         {
800                                 if (progressbar.orientation == GTK_PROGRESS_RIGHT_TO_LEFT ||
801                                     progressbar.orientation == GTK_PROGRESS_LEFT_TO_RIGHT)
802                                 {
803                                         tmp.x -= 1;
804                                         tmp.width += 2;
805                                 }
806                                 else
807                                 {
808                                         tmp.y -= 1;
809                                         tmp.height += 2;
810                                 }
811                         }
812
813                         cairo_reset_clip (cr);
814                         gdk_cairo_rectangle (cr, &tmp);
815                         cairo_clip (cr);
816                 }
817
818                 STYLE_FUNCTION(draw_progressbar_fill) (cr, colors, &params, &progressbar,
819                                                        x, y, width, height,
820                                                        10 - (int)(elapsed * 10.0) % 10);
821         }
822         else if (DETAIL ("optionmenu"))
823         {
824                 WidgetParameters params;
825                 OptionMenuParameters optionmenu;
826
827                 GtkRequisition indicator_size;
828                 GtkBorder indicator_spacing;
829
830                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
831
832                 if (clearlooks_style->reliefstyle != 0)
833                         params.enable_shadow = TRUE;
834
835                 ge_option_menu_get_props (widget, &indicator_size, &indicator_spacing);
836
837                 if (ge_widget_is_ltr (widget))
838                         optionmenu.linepos = width - (indicator_size.width + indicator_spacing.left + indicator_spacing.right) - 1;
839                 else
840                         optionmenu.linepos = (indicator_size.width + indicator_spacing.left + indicator_spacing.right) + 1;
841
842                 STYLE_FUNCTION(draw_optionmenu) (cr, colors, &params, &optionmenu,
843                                                  x, y, width, height);
844         }
845         else if (DETAIL ("menuitem"))
846         {
847                 WidgetParameters params;
848                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
849
850                 if (CHECK_HINT (GE_HINT_MENUBAR))
851                 {
852                         params.corners = CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT;
853                         height += 1;
854                         STYLE_FUNCTION(draw_menubaritem) (cr, colors, &params, x, y, width, height);
855                 }
856                 else
857                 {
858                         params.corners = CR_CORNER_ALL;
859                         STYLE_FUNCTION(draw_menuitem) (cr, colors, &params, x, y, width, height);
860                 }
861         }
862         else if (DETAIL ("hscrollbar") || DETAIL ("vscrollbar")) /* This can't be "stepper" for scrollbars ... */
863         {
864                 WidgetParameters    params;
865                 ScrollBarParameters scrollbar;
866                 ScrollBarStepperParameters stepper;
867                 GdkRectangle this_rectangle;
868
869                 this_rectangle.x = x;
870                 this_rectangle.y = y;
871                 this_rectangle.width  = width;
872                 this_rectangle.height = height;
873
874                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
875                 params.corners = CR_CORNER_NONE;
876
877                 scrollbar.has_color  = FALSE;
878                 scrollbar.horizontal = TRUE;
879                 scrollbar.junction   = clearlooks_scrollbar_get_junction (widget);
880
881                 if (clearlooks_style->colorize_scrollbar || clearlooks_style->has_scrollbar_color)
882                         scrollbar.has_color = TRUE;
883
884                 scrollbar.horizontal = DETAIL ("hscrollbar");
885
886                 stepper.stepper = clearlooks_scrollbar_get_stepper (widget, &this_rectangle);
887
888                 STYLE_FUNCTION(draw_scrollbar_stepper) (cr, colors, &params, &scrollbar, &stepper,
889                                                         x, y, width, height);
890         }
891         else if (DETAIL ("toolbar") || DETAIL ("handlebox_bin") || DETAIL ("dockitem_bin"))
892         {
893                 WidgetParameters  params;
894                 ToolbarParameters toolbar;
895                 gboolean horizontal;
896
897                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
898                 clearlooks_set_toolbar_parameters (&toolbar, widget, window, x, y);
899
900                 toolbar.style = clearlooks_style->toolbarstyle;
901
902                 if ((DETAIL ("handlebox_bin") || DETAIL ("dockitem_bin")) && GE_IS_BIN (widget))
903                 {
904                         GtkWidget* child = gtk_bin_get_child ((GtkBin*) widget);
905                         /* This is to draw the correct shadow on the handlebox.
906                          * We need to draw it here, as otherwise the handle will not get the
907                          * background. */
908                         if (GE_IS_TOOLBAR (child))
909                                 gtk_widget_style_get (child, "shadow-type", &shadow_type, NULL);
910                 }
911                 
912                 horizontal = height < 2*width;
913                 /* This is not that great. Ideally we would have a nice vertical toolbar. */
914                 if ((shadow_type != GTK_SHADOW_NONE) && horizontal)
915                         STYLE_FUNCTION(draw_toolbar) (cr, colors, &params, &toolbar, x, y, width, height);
916         }
917         else if (DETAIL ("trough"))
918         {
919                 /* Nothing? Why benjamin? */
920         }
921         else if (DETAIL ("menu"))
922         {
923                 WidgetParameters params;
924
925                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
926
927                 STYLE_FUNCTION(draw_menu_frame) (cr, colors, &params, x, y, width, height);
928         }
929         else if (DETAIL ("hseparator") || DETAIL ("vseparator"))
930         {
931                 gchar *new_detail = (gchar*) detail;
932                 /* Draw a normal separator, we just use this because it gives more control
933                  * over sizing (currently). */
934
935                 /* This isn't nice ... but it seems like the best cleanest way to me right now.
936                  * It will get slightly nicer in the future hopefully. */
937                 if (GE_IS_MENU_ITEM (widget))
938                         new_detail = "menuitem";
939
940                 if (DETAIL ("hseparator"))
941                 {
942                         gtk_paint_hline (style, window, state_type, area, widget, new_detail,
943                                          x, x + width - 1, y + height/2);
944                 }
945                 else
946                         gtk_paint_vline (style, window, state_type, area, widget, new_detail,
947                                          y, y + height - 1, x + width/2);
948         }
949         else
950         {
951                 GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_box (style, window, state_type, shadow_type, area,
952                                                    widget, detail, x, y, width, height);
953         }
954
955         cairo_destroy (cr);
956 }
957
958 static void
959 clearlooks_style_draw_slider (DRAW_ARGS, GtkOrientation orientation)
960 {
961         ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
962         const ClearlooksColors *colors;
963         cairo_t *cr;
964
965         cr     = ge_gdk_drawable_to_cairo (window, area);
966         colors = &clearlooks_style->colors;
967
968         CHECK_ARGS
969         SANITIZE_SIZE
970
971         if (DETAIL ("hscale") || DETAIL ("vscale"))
972         {
973                 WidgetParameters params;
974                 SliderParameters slider;
975
976                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
977
978                 slider.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
979                 slider.lower = FALSE;
980                 slider.fill_level = FALSE;
981
982                 if (clearlooks_style->style == CL_STYLE_GLOSSY) /* XXX! */
983                         params.corners = CR_CORNER_ALL;
984
985                 STYLE_FUNCTION(draw_slider_button) (cr, &clearlooks_style->colors,
986                                                     &params, &slider,
987                                                     x, y, width, height);
988         }
989         else if (DETAIL ("slider"))
990         {
991                 WidgetParameters    params;
992                 ScrollBarParameters scrollbar;
993
994                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
995                 params.corners = CR_CORNER_NONE;
996
997                 scrollbar.has_color  = FALSE;
998                 scrollbar.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
999                 scrollbar.junction   = clearlooks_scrollbar_get_junction (widget);
1000
1001                 if (clearlooks_style->colorize_scrollbar)
1002                 {
1003                         scrollbar.color = colors->spot[1];
1004                         scrollbar.has_color = TRUE;
1005                 }
1006
1007                 /* Set scrollbar color */
1008                 if (clearlooks_style->has_scrollbar_color)
1009                 {
1010                         ge_gdk_color_to_cairo (&clearlooks_style->scrollbar_color, &scrollbar.color);
1011                         scrollbar.has_color = TRUE;
1012                 }
1013
1014                 if ((clearlooks_style->style == CL_STYLE_GLOSSY || clearlooks_style->style == CL_STYLE_GUMMY)
1015                         && !scrollbar.has_color)
1016                         scrollbar.color = colors->bg[0];
1017
1018                 STYLE_FUNCTION(draw_scrollbar_slider) (cr, colors, &params, &scrollbar,
1019                                                        x, y, width, height);
1020         }
1021         else
1022         {
1023                 GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_slider (style, window, state_type, shadow_type, area,
1024                                                       widget, detail, x, y, width, height, orientation);
1025         }
1026
1027         cairo_destroy (cr);
1028 }
1029
1030 static void
1031 clearlooks_style_draw_option (DRAW_ARGS)
1032 {
1033         ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1034         const ClearlooksColors *colors;
1035         WidgetParameters params;
1036         CheckboxParameters checkbox;
1037         cairo_t *cr;
1038
1039         CHECK_ARGS
1040         SANITIZE_SIZE
1041
1042         cr = ge_gdk_drawable_to_cairo (window, area);
1043         colors = &clearlooks_style->colors;
1044
1045         checkbox.shadow_type = shadow_type;
1046         checkbox.in_menu = (widget && GTK_IS_MENU(widget->parent));
1047
1048         clearlooks_set_widget_parameters (widget, style, state_type, &params);
1049
1050         STYLE_FUNCTION(draw_radiobutton) (cr, colors, &params, &checkbox, x, y, width, height);
1051
1052         cairo_destroy (cr);
1053 }
1054
1055 static void
1056 clearlooks_style_draw_check (DRAW_ARGS)
1057 {
1058         ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1059         WidgetParameters params;
1060         CheckboxParameters checkbox;
1061         cairo_t *cr;
1062
1063         CHECK_ARGS
1064         SANITIZE_SIZE
1065
1066         cr = ge_gdk_drawable_to_cairo (window, area);
1067
1068         clearlooks_set_widget_parameters (widget, style, state_type, &params);
1069
1070         params.corners = CR_CORNER_ALL;
1071
1072         checkbox.shadow_type = shadow_type;
1073         checkbox.in_cell = DETAIL("cellcheck");
1074
1075         checkbox.in_menu = (widget && widget->parent && GTK_IS_MENU(widget->parent));
1076
1077         STYLE_FUNCTION(draw_checkbox) (cr, &clearlooks_style->colors, &params, &checkbox,
1078                                        x, y, width, height);
1079
1080         cairo_destroy (cr);
1081 }
1082
1083 static void
1084 clearlooks_style_draw_vline (GtkStyle               *style,
1085                              GdkWindow              *window,
1086                              GtkStateType            state_type,
1087                              GdkRectangle           *area,
1088                              GtkWidget              *widget,
1089                              const gchar            *detail,
1090                              gint                    y1,
1091                              gint                    y2,
1092                              gint                    x)
1093 {
1094         ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1095         const ClearlooksColors *colors;
1096         SeparatorParameters separator = { FALSE };
1097         cairo_t *cr;
1098
1099         CHECK_ARGS
1100
1101         colors = &clearlooks_style->colors;
1102
1103         cr = ge_gdk_drawable_to_cairo (window, area);
1104
1105         /* There is no such thing as a vertical menu separator
1106          * (and even if, a normal one should be better on menu bars) */
1107         STYLE_FUNCTION(draw_separator) (cr, colors, NULL, &separator,
1108                                         x, y1, 2, y2-y1+1);
1109
1110         cairo_destroy (cr);
1111 }
1112
1113 static void
1114 clearlooks_style_draw_hline (GtkStyle               *style,
1115                              GdkWindow              *window,
1116                              GtkStateType            state_type,
1117                              GdkRectangle           *area,
1118                              GtkWidget              *widget,
1119                              const gchar            *detail,
1120                              gint                    x1,
1121                              gint                    x2,
1122                              gint                    y)
1123 {
1124         ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1125         const ClearlooksColors *colors;
1126         cairo_t *cr;
1127         SeparatorParameters separator;
1128
1129         CHECK_ARGS
1130
1131         colors = &clearlooks_style->colors;
1132
1133         cr = ge_gdk_drawable_to_cairo (window, area);
1134
1135         separator.horizontal = TRUE;
1136
1137         if (!DETAIL ("menuitem"))
1138                 STYLE_FUNCTION(draw_separator) (cr, colors, NULL, &separator,
1139                                                 x1, y, x2-x1+1, 2);
1140         else
1141                 STYLE_FUNCTION(draw_menu_item_separator) (cr, colors, NULL, &separator,
1142                                                           x1, y, x2-x1+1, 2);
1143
1144         cairo_destroy (cr);
1145 }
1146
1147 static void
1148 clearlooks_style_draw_shadow_gap (DRAW_ARGS,
1149                                   GtkPositionType gap_side,
1150                                   gint            gap_x,
1151                                   gint            gap_width)
1152 {
1153         ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1154         const ClearlooksColors *colors;
1155         cairo_t *cr;
1156
1157         CHECK_ARGS
1158         SANITIZE_SIZE
1159
1160         cr     = ge_gdk_drawable_to_cairo (window, area);
1161         colors = &clearlooks_style->colors;
1162
1163         if (DETAIL ("frame"))
1164         {
1165                 WidgetParameters params;
1166                 FrameParameters  frame;
1167
1168                 frame.shadow    = shadow_type;
1169                 frame.gap_side  = gap_side;
1170                 frame.gap_x     = gap_x;
1171                 frame.gap_width = gap_width;
1172                 frame.border    = &colors->shade[5];
1173
1174                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
1175
1176                 params.corners = CR_CORNER_ALL;
1177
1178                 STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame,
1179                                             x, y, width, height);
1180         }
1181         else
1182         {
1183                 GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_shadow_gap (style, window, state_type, shadow_type, area,
1184                                                           widget, detail, x, y, width, height,
1185                                                           gap_side, gap_x, gap_width);
1186         }
1187
1188         cairo_destroy (cr);
1189 }
1190
1191 static void
1192 clearlooks_style_draw_resize_grip (GtkStyle       *style,
1193                                    GdkWindow      *window,
1194                                    GtkStateType    state_type,
1195                                    GdkRectangle   *area,
1196                                    GtkWidget      *widget,
1197                                    const gchar    *detail,
1198                                    GdkWindowEdge   edge,
1199                                    gint            x,
1200                                    gint            y,
1201                                    gint            width,
1202                                    gint            height)
1203 {
1204         ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1205         ClearlooksColors *colors = &clearlooks_style->colors;
1206         cairo_t *cr;
1207         WidgetParameters params;
1208         ResizeGripParameters grip;
1209
1210         CHECK_ARGS
1211         SANITIZE_SIZE
1212
1213         grip.edge = (ClearlooksWindowEdge)edge;
1214
1215         g_return_if_fail (window != NULL);
1216
1217         cr = ge_gdk_drawable_to_cairo (window, area);
1218
1219         clearlooks_set_widget_parameters (widget, style, state_type, &params);
1220
1221         STYLE_FUNCTION(draw_resize_grip) (cr, colors, &params, &grip,
1222                                           x, y, width, height);
1223
1224         cairo_destroy (cr);
1225 }
1226
1227 static void
1228 clearlooks_style_draw_tab (DRAW_ARGS)
1229 {
1230         ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1231         ClearlooksColors *colors = &clearlooks_style->colors;
1232         WidgetParameters params;
1233         ArrowParameters  arrow;
1234         cairo_t *cr;
1235
1236         CHECK_ARGS
1237         SANITIZE_SIZE
1238
1239         cr = ge_gdk_drawable_to_cairo (window, area);
1240
1241         clearlooks_set_widget_parameters (widget, style, state_type, &params);
1242         arrow.type      = CL_ARROW_COMBO;
1243         arrow.direction = CL_DIRECTION_DOWN;
1244
1245         STYLE_FUNCTION(draw_arrow) (cr, colors, &params, &arrow, x, y, width, height);
1246
1247         cairo_destroy (cr);
1248 }
1249
1250 static void
1251 clearlooks_style_draw_arrow (GtkStyle  *style,
1252                              GdkWindow     *window,
1253                              GtkStateType   state_type,
1254                              GtkShadowType  shadow,
1255                              GdkRectangle  *area,
1256                              GtkWidget     *widget,
1257                              const gchar   *detail,
1258                              GtkArrowType   arrow_type,
1259                              gboolean       fill,
1260                              gint           x,
1261                              gint           y,
1262                              gint           width,
1263                              gint           height)
1264 {
1265         ClearlooksStyle  *clearlooks_style = CLEARLOOKS_STYLE (style);
1266         ClearlooksColors *colors = &clearlooks_style->colors;
1267         WidgetParameters params;
1268         ArrowParameters  arrow;
1269         cairo_t *cr = ge_gdk_drawable_to_cairo (window, area);
1270
1271         CHECK_ARGS
1272         SANITIZE_SIZE
1273
1274         if (arrow_type == GTK_ARROW_NONE)
1275         {
1276                 cairo_destroy (cr);
1277                 return;
1278         }
1279
1280         clearlooks_set_widget_parameters (widget, style, state_type, &params);
1281         arrow.type = CL_ARROW_NORMAL;
1282         arrow.direction = (ClearlooksDirection)arrow_type;
1283
1284         if (ge_is_combo_box (widget, FALSE) && !ge_is_combo_box_entry (widget))
1285         {
1286                 arrow.type = CL_ARROW_COMBO;
1287         }
1288
1289         /* I have no idea why, but the arrow of GtkCombo is larger than in other places.
1290          * Subtracting 3 seems to fix this. */
1291         if (widget && widget->parent && GE_IS_COMBO (widget->parent->parent))
1292         {
1293                 if (params.ltr)
1294                         x += 1;
1295                 else
1296                         x += 2;
1297                 width -= 3;
1298         }
1299
1300         STYLE_FUNCTION(draw_arrow) (cr, colors, &params, &arrow, x, y, width, height);
1301
1302         cairo_destroy (cr);
1303 }
1304
1305 static void
1306 clearlooks_style_init_from_rc (GtkStyle * style,
1307                                GtkRcStyle * rc_style)
1308 {
1309         ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1310
1311         GTK_STYLE_CLASS (clearlooks_style_parent_class)->init_from_rc (style, rc_style);
1312
1313         g_assert ((CLEARLOOKS_RC_STYLE (rc_style)->style >= 0) && (CLEARLOOKS_RC_STYLE (rc_style)->style < CL_NUM_STYLES));
1314         clearlooks_style->style               = CLEARLOOKS_RC_STYLE (rc_style)->style;
1315
1316         clearlooks_style->reliefstyle         = CLEARLOOKS_RC_STYLE (rc_style)->reliefstyle;
1317         clearlooks_style->menubarstyle        = CLEARLOOKS_RC_STYLE (rc_style)->menubarstyle;
1318         clearlooks_style->toolbarstyle        = CLEARLOOKS_RC_STYLE (rc_style)->toolbarstyle;
1319         clearlooks_style->has_focus_color     = CLEARLOOKS_RC_STYLE (rc_style)->flags & CL_FLAG_FOCUS_COLOR;
1320         clearlooks_style->has_scrollbar_color = CLEARLOOKS_RC_STYLE (rc_style)->flags & CL_FLAG_SCROLLBAR_COLOR;
1321         clearlooks_style->colorize_scrollbar  = CLEARLOOKS_RC_STYLE (rc_style)->colorize_scrollbar;
1322         clearlooks_style->animation           = CLEARLOOKS_RC_STYLE (rc_style)->animation;
1323         clearlooks_style->radius              = CLAMP (CLEARLOOKS_RC_STYLE (rc_style)->radius, 0.0, 10.0);
1324
1325         if (clearlooks_style->has_focus_color)
1326                 clearlooks_style->focus_color     = CLEARLOOKS_RC_STYLE (rc_style)->focus_color;
1327         if (clearlooks_style->has_scrollbar_color)
1328                 clearlooks_style->scrollbar_color = CLEARLOOKS_RC_STYLE (rc_style)->scrollbar_color;
1329 }
1330
1331 static void
1332 clearlooks_style_realize (GtkStyle * style)
1333 {
1334         ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1335         double shades[] = {1.15, 0.95, 0.896, 0.82, 0.7, 0.665, 0.475, 0.45, 0.4};
1336         CairoColor spot_color;
1337         CairoColor bg_normal;
1338         double contrast;
1339         int i;
1340
1341         GTK_STYLE_CLASS (clearlooks_style_parent_class)->realize (style);
1342
1343         contrast = CLEARLOOKS_RC_STYLE (style->rc_style)->contrast;
1344
1345         /* Lighter to darker */
1346         ge_gdk_color_to_cairo (&style->bg[GTK_STATE_NORMAL], &bg_normal);
1347
1348         for (i = 0; i < 9; i++)
1349         {
1350                 ge_shade_color (&bg_normal, (shades[i] < 1.0) ?
1351                                 (shades[i]/contrast) : (shades[i]*contrast),
1352                                 &clearlooks_style->colors.shade[i]);
1353         }
1354
1355         ge_gdk_color_to_cairo (&style->bg[GTK_STATE_SELECTED], &spot_color);
1356
1357         /* Andrea Cimitan wants something like the following to handle dark themes.
1358          * However, these two lines are broken currently, as ge_hsb_from_color expects
1359          * a CairoColor and not GdkColor
1360          *  ge_hsb_from_color (&style->bg[GTK_STATE_SELECTED], &hue_spot, &saturation_spot, &brightness_spot);
1361          *  ge_hsb_from_color (&style->bg[GTK_STATE_NORMAL],   &hue_bg,   &saturation_bg,   &brightness_bg);
1362          */
1363
1364         /* Here to place some checks for dark themes.
1365          * We should use a different shade value for spot[2]. */
1366
1367         ge_shade_color (&spot_color, 1.25, &clearlooks_style->colors.spot[0]);
1368         ge_shade_color (&spot_color, 1.05, &clearlooks_style->colors.spot[1]);
1369         ge_shade_color (&spot_color, 0.65, &clearlooks_style->colors.spot[2]);
1370
1371         for (i=0; i<5; i++)
1372         {
1373                 ge_gdk_color_to_cairo (&style->fg[i], &clearlooks_style->colors.fg[i]);
1374                 ge_gdk_color_to_cairo (&style->bg[i], &clearlooks_style->colors.bg[i]);
1375                 ge_gdk_color_to_cairo (&style->base[i], &clearlooks_style->colors.base[i]);
1376                 ge_gdk_color_to_cairo (&style->text[i], &clearlooks_style->colors.text[i]);
1377         }
1378 }
1379
1380 static void
1381 clearlooks_style_draw_focus (GtkStyle *style, GdkWindow *window, GtkStateType state_type,
1382                              GdkRectangle *area, GtkWidget *widget, const gchar *detail,
1383                              gint x, gint y, gint width, gint height)
1384 {
1385         ClearlooksStyle  *clearlooks_style = CLEARLOOKS_STYLE (style);
1386         ClearlooksColors *colors = &clearlooks_style->colors;
1387         WidgetParameters params;
1388         FocusParameters focus;
1389         guint8* dash_list;
1390
1391         cairo_t *cr;
1392
1393         CHECK_ARGS
1394         SANITIZE_SIZE
1395
1396         cr = gdk_cairo_create (window);
1397
1398         clearlooks_set_widget_parameters (widget, style, state_type, &params);
1399
1400         /* Corners */
1401         params.corners = CR_CORNER_ALL;
1402         if (CHECK_HINT (GE_HINT_COMBOBOX_ENTRY))
1403         {
1404                 if (params.ltr)
1405                         params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
1406                 else
1407                         params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
1408
1409                 if (params.xthickness > 2)
1410                 {
1411                         if (params.ltr)
1412                                 x--;
1413                         width++;
1414                 }
1415         }
1416
1417         focus.has_color = FALSE;
1418         focus.interior = FALSE;
1419         focus.line_width = 1;
1420         focus.padding = 1;
1421         dash_list = NULL;
1422
1423         if (widget)
1424         {
1425                 gtk_widget_style_get (widget,
1426                                       "focus-line-width", &focus.line_width,
1427                                       "focus-line-pattern", &dash_list,
1428                                       "focus-padding", &focus.padding,
1429                                       "interior-focus", &focus.interior,
1430                                       NULL);
1431         }
1432         if (dash_list)
1433                 focus.dash_list = dash_list;
1434         else
1435                 focus.dash_list = (guint8*) g_strdup ("\1\1");
1436
1437         /* Focus type */
1438         if (DETAIL("button"))
1439         {
1440                 if (CHECK_HINT (GE_HINT_TREEVIEW_HEADER))
1441                 {
1442                         focus.type = CL_FOCUS_TREEVIEW_HEADER;
1443                 }
1444                 else
1445                 {
1446                         GtkReliefStyle relief = GTK_RELIEF_NORMAL;
1447                         /* Check for the shadow type. */
1448                         if (widget && GTK_IS_BUTTON (widget))
1449                                 g_object_get (G_OBJECT (widget), "relief", &relief, NULL);
1450
1451                         if (relief == GTK_RELIEF_NORMAL)
1452                                 focus.type = CL_FOCUS_BUTTON;
1453                         else
1454                                 focus.type = CL_FOCUS_BUTTON_FLAT;
1455
1456                         /* This is a workaround for the bogus focus handling that
1457                          * clearlooks has currently.
1458                          * I truely dislike putting it here, but I guess it is better
1459                          * then having such a visible bug. It should be removed in the
1460                          * next unstable release cycle.  -- Benjamin */
1461                         if (ge_object_is_a (G_OBJECT (widget), "ButtonWidget"))
1462                                 focus.type = CL_FOCUS_LABEL;
1463                 }
1464         }
1465         else if (detail && g_str_has_prefix (detail, "treeview"))
1466         {
1467                 /* Focus in a treeview, and that means a lot of different detail strings. */
1468                 if (g_str_has_prefix (detail, "treeview-drop-indicator"))
1469                         focus.type = CL_FOCUS_TREEVIEW_DND;
1470                 else
1471                         focus.type = CL_FOCUS_TREEVIEW_ROW;
1472
1473                 if (g_str_has_suffix (detail, "left"))
1474                 {
1475                         focus.continue_side = CL_CONT_RIGHT;
1476                 }
1477                 else if (g_str_has_suffix (detail, "right"))
1478                 {
1479                         focus.continue_side = CL_CONT_LEFT;
1480                 }
1481                 else if (g_str_has_suffix (detail, "middle"))
1482                 {
1483                         focus.continue_side = CL_CONT_LEFT | CL_CONT_RIGHT;
1484                 }
1485                 else
1486                 {
1487                         /* This may either mean no continuation, or unknown ...
1488                          * if it is unknown we assume it continues on both sides */
1489                         gboolean row_ending_details = FALSE;
1490
1491                         /* Try to get the style property. */
1492                         if (widget)
1493                                 gtk_widget_style_get (widget,
1494                                                       "row-ending-details", &row_ending_details,
1495                                                       NULL);
1496
1497                         if (row_ending_details)
1498                                 focus.continue_side = CL_CONT_NONE;
1499                         else
1500                                 focus.continue_side = CL_CONT_LEFT | CL_CONT_RIGHT;
1501                 }
1502
1503         }
1504         else if (detail && g_str_has_prefix (detail, "trough") && CHECK_HINT (GE_HINT_SCALE))
1505         {
1506                 focus.type = CL_FOCUS_SCALE;
1507         }
1508         else if (DETAIL("tab"))
1509         {
1510                 focus.type = CL_FOCUS_TAB;
1511         }
1512         else if (detail && g_str_has_prefix (detail, "colorwheel"))
1513         {
1514                 if (DETAIL ("colorwheel_dark"))
1515                         focus.type = CL_FOCUS_COLOR_WHEEL_DARK;
1516                 else
1517                         focus.type = CL_FOCUS_COLOR_WHEEL_LIGHT;
1518         }
1519         else if (DETAIL("checkbutton") || DETAIL("radiobutton"))
1520         {
1521                 focus.type = CL_FOCUS_LABEL; /* Let's call it "LABEL" :) */
1522         }
1523         else if (CHECK_HINT (GE_HINT_TREEVIEW))
1524         {
1525                 focus.type = CL_FOCUS_TREEVIEW; /* Treeview without content is focused. */
1526         }
1527         else
1528         {
1529                 focus.type = CL_FOCUS_UNKNOWN; /* Custom widgets (Beagle) and something unknown */
1530         }
1531
1532         /* Focus color */
1533         if (clearlooks_style->has_focus_color)
1534         {
1535                 ge_gdk_color_to_cairo (&clearlooks_style->focus_color, &focus.color);
1536                 focus.has_color = TRUE;
1537         }
1538         else
1539                 focus.color = colors->bg[GTK_STATE_SELECTED];
1540
1541         STYLE_FUNCTION(draw_focus) (cr, colors, &params, &focus, x, y, width, height);
1542
1543         g_free (focus.dash_list);
1544
1545         cairo_destroy (cr);
1546 }
1547
1548 static void
1549 clearlooks_style_copy (GtkStyle * style, GtkStyle * src)
1550 {
1551         ClearlooksStyle * cl_style = CLEARLOOKS_STYLE (style);
1552         ClearlooksStyle * cl_src = CLEARLOOKS_STYLE (src);
1553
1554         cl_style->colors              = cl_src->colors;
1555         cl_style->reliefstyle         = cl_src->reliefstyle;
1556         cl_style->menubarstyle        = cl_src->menubarstyle;
1557         cl_style->toolbarstyle        = cl_src->toolbarstyle;
1558         cl_style->focus_color         = cl_src->focus_color;
1559         cl_style->has_focus_color     = cl_src->has_focus_color;
1560         cl_style->scrollbar_color     = cl_src->scrollbar_color;
1561         cl_style->has_scrollbar_color = cl_src->has_scrollbar_color;
1562         cl_style->colorize_scrollbar  = cl_src->colorize_scrollbar;
1563         cl_style->animation           = cl_src->animation;
1564         cl_style->radius              = cl_src->radius;
1565         cl_style->style               = cl_src->style;
1566
1567         GTK_STYLE_CLASS (clearlooks_style_parent_class)->copy (style, src);
1568 }
1569
1570 static void
1571 clearlooks_style_unrealize (GtkStyle * style)
1572 {
1573         GTK_STYLE_CLASS (clearlooks_style_parent_class)->unrealize (style);
1574 }
1575
1576 static GdkPixbuf *
1577 set_transparency (const GdkPixbuf *pixbuf, gdouble alpha_percent)
1578 {
1579         GdkPixbuf *target;
1580         guchar *data, *current;
1581         guint x, y, rowstride, height, width;
1582
1583         g_return_val_if_fail (pixbuf != NULL, NULL);
1584         g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
1585
1586         /* Returns a copy of pixbuf with it's non-completely-transparent pixels to
1587            have an alpha level "alpha_percent" of their original value. */
1588
1589         target = gdk_pixbuf_add_alpha (pixbuf, FALSE, 0, 0, 0);
1590
1591         if (alpha_percent == 1.0)
1592                 return target;
1593         width = gdk_pixbuf_get_width (target);
1594         height = gdk_pixbuf_get_height (target);
1595         rowstride = gdk_pixbuf_get_rowstride (target);
1596         data = gdk_pixbuf_get_pixels (target);
1597
1598         for (y = 0; y < height; y++)
1599         {
1600                 for (x = 0; x < width; x++)
1601                 {
1602                         /* The "4" is the number of chars per pixel, in this case, RGBA,
1603                            the 3 means "skip to the alpha" */
1604                         current = data + (y * rowstride) + (x * 4) + 3;
1605                         *(current) = (guchar) (*(current) * alpha_percent);
1606                 }
1607         }
1608
1609         return target;
1610 }
1611
1612 static GdkPixbuf*
1613 scale_or_ref (GdkPixbuf *src,
1614               int width,
1615               int height)
1616 {
1617         if (width == gdk_pixbuf_get_width (src) &&
1618             height == gdk_pixbuf_get_height (src))
1619         {
1620                 return g_object_ref (src);
1621         }
1622         else
1623         {
1624                 return gdk_pixbuf_scale_simple (src,
1625                                                 width, height,
1626                                                 GDK_INTERP_BILINEAR);
1627         }
1628 }
1629
1630 static void
1631 clearlooks_style_draw_layout (GtkStyle * style,
1632                               GdkWindow * window,
1633                               GtkStateType state_type,
1634                               gboolean use_text,
1635                               GdkRectangle * area,
1636                               GtkWidget * widget,
1637                               const gchar * detail, gint x, gint y, PangoLayout * layout)
1638 {
1639         GdkGC *gc;
1640
1641         g_return_if_fail (GTK_IS_STYLE (style));
1642         g_return_if_fail (window != NULL);
1643
1644         gc = use_text ? style->text_gc[state_type] : style->fg_gc[state_type];
1645
1646         if (area)
1647                 gdk_gc_set_clip_rectangle (gc, area);
1648
1649         if (state_type == GTK_STATE_INSENSITIVE)
1650         {
1651                 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1652                 ClearlooksColors *colors = &clearlooks_style->colors;
1653
1654                 WidgetParameters params;
1655                 GdkColor etched;
1656                 CairoColor temp;
1657
1658                 clearlooks_set_widget_parameters (widget, style, state_type, &params);
1659
1660                 if (GTK_WIDGET_NO_WINDOW (widget))
1661                         ge_shade_color (&params.parentbg, 1.2, &temp);
1662                 else
1663                         ge_shade_color (&colors->bg[widget->state], 1.2, &temp);
1664
1665                 etched.red = (int) (temp.r * 65535);
1666                 etched.green = (int) (temp.g * 65535);
1667                 etched.blue = (int) (temp.b * 65535);
1668
1669                 gdk_draw_layout_with_colors (window, gc, x + 1, y + 1, layout, &etched, NULL);
1670                 gdk_draw_layout (window, gc, x, y, layout);
1671         }
1672         else
1673                 gdk_draw_layout (window, gc, x, y, layout);
1674
1675         if (area)
1676                 gdk_gc_set_clip_rectangle (gc, NULL);
1677 }
1678
1679 static GdkPixbuf *
1680 clearlooks_style_draw_render_icon (GtkStyle            *style,
1681                                    const GtkIconSource *source,
1682                                    GtkTextDirection     direction,
1683                                    GtkStateType         state,
1684                                    GtkIconSize          size,
1685                                    GtkWidget           *widget,
1686                                    const char          *detail)
1687 {
1688         int width = 1;
1689         int height = 1;
1690         GdkPixbuf *scaled;
1691         GdkPixbuf *stated;
1692         GdkPixbuf *base_pixbuf;
1693         GdkScreen *screen;
1694         GtkSettings *settings;
1695
1696         /* Oddly, style can be NULL in this function, because
1697          * GtkIconSet can be used without a style and if so
1698          * it uses this function.
1699          */
1700
1701         base_pixbuf = gtk_icon_source_get_pixbuf (source);
1702
1703         g_return_val_if_fail (base_pixbuf != NULL, NULL);
1704
1705         if (widget && gtk_widget_has_screen (widget))
1706         {
1707                 screen = gtk_widget_get_screen (widget);
1708                 settings = gtk_settings_get_for_screen (screen);
1709         }
1710         else if (style->colormap)
1711         {
1712                 screen = gdk_colormap_get_screen (style->colormap);
1713                 settings = gtk_settings_get_for_screen (screen);
1714         }
1715         else
1716         {
1717                 settings = gtk_settings_get_default ();
1718                 GTK_NOTE (MULTIHEAD,
1719                           g_warning ("Using the default screen for gtk_default_render_icon()"));
1720         }
1721
1722         if (size != (GtkIconSize) -1 && !gtk_icon_size_lookup_for_settings (settings, size, &width, &height))
1723         {
1724                 g_warning (G_STRLOC ": invalid icon size '%d'", size);
1725                 return NULL;
1726         }
1727
1728         /* If the size was wildcarded, and we're allowed to scale, then scale; otherwise,
1729          * leave it alone.
1730          */
1731         if (size != (GtkIconSize)-1 && gtk_icon_source_get_size_wildcarded (source))
1732                 scaled = scale_or_ref (base_pixbuf, width, height);
1733         else
1734                 scaled = g_object_ref (base_pixbuf);
1735
1736         /* If the state was wildcarded, then generate a state. */
1737         if (gtk_icon_source_get_state_wildcarded (source))
1738         {
1739                 if (state == GTK_STATE_INSENSITIVE)
1740                 {
1741                         stated = set_transparency (scaled, 0.3);
1742                         gdk_pixbuf_saturate_and_pixelate (stated, stated, 0.1, FALSE);
1743
1744                         g_object_unref (scaled);
1745                 }
1746                 else if (state == GTK_STATE_PRELIGHT)
1747                 {
1748                         stated = gdk_pixbuf_copy (scaled);
1749
1750                         gdk_pixbuf_saturate_and_pixelate (scaled, stated, 1.2, FALSE);
1751
1752                         g_object_unref (scaled);
1753                 }
1754                 else
1755                 {
1756                         stated = scaled;
1757                 }
1758         }
1759         else
1760                 stated = scaled;
1761
1762         return stated;
1763 }
1764
1765 void
1766 clearlooks_style_register_types (GTypeModule *module)
1767 {
1768   clearlooks_style_register_type (module);
1769 }
1770
1771 static void
1772 clearlooks_style_init (ClearlooksStyle * style)
1773 {
1774 }
1775
1776 static void
1777 clearlooks_style_class_init (ClearlooksStyleClass * klass)
1778 {
1779         GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
1780
1781         style_class->copy             = clearlooks_style_copy;
1782         style_class->realize          = clearlooks_style_realize;
1783         style_class->unrealize        = clearlooks_style_unrealize;
1784         style_class->init_from_rc     = clearlooks_style_init_from_rc;
1785         style_class->draw_handle      = clearlooks_style_draw_handle;
1786         style_class->draw_slider      = clearlooks_style_draw_slider;
1787         style_class->draw_shadow_gap  = clearlooks_style_draw_shadow_gap;
1788         style_class->draw_focus       = clearlooks_style_draw_focus;
1789         style_class->draw_box         = clearlooks_style_draw_box;
1790         style_class->draw_shadow      = clearlooks_style_draw_shadow;
1791         style_class->draw_box_gap     = clearlooks_style_draw_box_gap;
1792         style_class->draw_extension   = clearlooks_style_draw_extension;
1793         style_class->draw_option      = clearlooks_style_draw_option;
1794         style_class->draw_check       = clearlooks_style_draw_check;
1795         style_class->draw_flat_box    = clearlooks_style_draw_flat_box;
1796         style_class->draw_vline       = clearlooks_style_draw_vline;
1797         style_class->draw_hline       = clearlooks_style_draw_hline;
1798         style_class->draw_resize_grip = clearlooks_style_draw_resize_grip;
1799         style_class->draw_tab         = clearlooks_style_draw_tab;
1800         style_class->draw_arrow       = clearlooks_style_draw_arrow;
1801         style_class->draw_layout      = clearlooks_style_draw_layout;
1802         style_class->render_icon      = clearlooks_style_draw_render_icon;
1803
1804         clearlooks_register_style_classic (&klass->style_functions[CL_STYLE_CLASSIC],
1805                                            &klass->style_constants[CL_STYLE_CLASSIC]);
1806
1807         klass->style_functions[CL_STYLE_GLOSSY] = klass->style_functions[CL_STYLE_CLASSIC];
1808         klass->style_constants[CL_STYLE_GLOSSY] = klass->style_constants[CL_STYLE_CLASSIC];
1809         clearlooks_register_style_glossy (&klass->style_functions[CL_STYLE_GLOSSY],
1810                                           &klass->style_constants[CL_STYLE_GLOSSY]);
1811
1812         klass->style_functions[CL_STYLE_INVERTED] = klass->style_functions[CL_STYLE_CLASSIC];
1813         klass->style_constants[CL_STYLE_INVERTED] = klass->style_constants[CL_STYLE_CLASSIC];
1814         clearlooks_register_style_inverted (&klass->style_functions[CL_STYLE_INVERTED],
1815                                             &klass->style_constants[CL_STYLE_INVERTED]);
1816
1817         klass->style_functions[CL_STYLE_GUMMY] = klass->style_functions[CL_STYLE_CLASSIC];
1818         klass->style_constants[CL_STYLE_GUMMY] = klass->style_constants[CL_STYLE_CLASSIC];
1819         clearlooks_register_style_gummy (&klass->style_functions[CL_STYLE_GUMMY],
1820                                          &klass->style_constants[CL_STYLE_GUMMY]);
1821 }
1822
1823 static void
1824 clearlooks_style_class_finalize (ClearlooksStyleClass *klass)
1825 {
1826 }