1 /* Clearlooks theme engine
2 * Copyright (C) 2005 Richard Stellingwerff.
3 * Copyright (C) 2007 Benjamin Berg <benjamin@sipsolutions.net>.
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.
27 #include <ge-support.h>
28 #include "clearlooks_style.h"
29 #include "clearlooks_rc_style.h"
30 #include "clearlooks_draw.h"
35 #define DETAIL(xx) ((detail) && (!strcmp(xx, detail)))
37 #define DRAW_ARGS GtkStyle *style, \
39 GtkStateType state_type, \
40 GtkShadowType shadow_type, \
43 const gchar *detail, \
50 #include "animation.h"
53 #define STYLE_FUNCTION(function) (clearlooks_style_class->style_functions[CLEARLOOKS_STYLE (style)->style].function)
55 static ClearlooksStyleClass *clearlooks_style_class;
56 static GtkStyleClass *clearlooks_parent_class;
59 clearlooks_set_widget_parameters (GtkWidget *widget,
60 const GtkStyle *style,
61 GtkStateType state_type,
62 WidgetParameters *params)
64 params->style_functions = &(clearlooks_style_class->style_functions[CLEARLOOKS_STYLE (style)->style]);
66 params->active = (state_type == GTK_STATE_ACTIVE);
67 params->prelight = (state_type == GTK_STATE_PRELIGHT);
68 params->disabled = (state_type == GTK_STATE_INSENSITIVE);
69 params->state_type = (ClearlooksStateType)state_type;
70 params->corners = CR_CORNER_ALL;
71 params->ltr = ge_widget_is_ltr ((GtkWidget*)widget);
72 params->focus = widget && GTK_WIDGET_HAS_FOCUS (widget);
73 params->is_default = widget && GE_WIDGET_HAS_DEFAULT (widget);
74 params->enable_glow = FALSE;
75 params->radius = CLEARLOOKS_STYLE (style)->radius;
77 if (!params->active && widget && GE_IS_TOGGLE_BUTTON (widget))
78 params->active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
80 params->xthickness = style->xthickness;
81 params->ythickness = style->ythickness;
83 /* This is used in GtkEntry to fake transparency. The reason to do this
84 * is that the entry has it's entire background filled with base[STATE].
85 * This is not a very good solution as it will eg. fail if one changes
86 * the background color of a notebook. */
87 params->parentbg = CLEARLOOKS_STYLE (style)->colors.bg[state_type];
88 clearlooks_get_parent_bg (widget, ¶ms->parentbg);
92 clearlooks_style_draw_flat_box (DRAW_ARGS)
95 state_type == GTK_STATE_SELECTED && (
96 !strncmp ("cell_even", detail, 9) ||
97 !strncmp ("cell_odd", detail, 8)))
99 WidgetParameters params;
100 ClearlooksStyle *clearlooks_style;
101 ClearlooksColors *colors;
107 clearlooks_style = CLEARLOOKS_STYLE (style);
108 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
109 colors = &clearlooks_style->colors;
110 cr = ge_gdk_drawable_to_cairo (window, area);
112 /* XXX: We could expose the side details by setting params->corners accordingly
113 * or adding another option. */
114 STYLE_FUNCTION (draw_selected_cell) (cr, colors, ¶ms, x, y, width, height);
118 else if (DETAIL ("tooltip"))
120 WidgetParameters params;
121 ClearlooksStyle *clearlooks_style;
122 ClearlooksColors *colors;
128 clearlooks_style = CLEARLOOKS_STYLE (style);
129 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
130 colors = &clearlooks_style->colors;
131 cr = ge_gdk_drawable_to_cairo (window, area);
133 STYLE_FUNCTION (draw_tooltip) (cr, colors, ¶ms, x, y, width, height);
137 else if ((CLEARLOOKS_STYLE (style)->style == CL_STYLE_GLOSSY || CLEARLOOKS_STYLE (style)->style == CL_STYLE_GUMMY) &&
138 ((DETAIL("checkbutton") || DETAIL("radiobutton")) && state_type == GTK_STATE_PRELIGHT))
140 /* XXX: Don't draw any check/radiobutton bg in GLOSSY or GUMMY mode. */
144 clearlooks_parent_class->draw_flat_box (style, window, state_type,
146 area, widget, detail,
147 x, y, width, height);
152 clearlooks_style_draw_shadow (DRAW_ARGS)
154 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
155 ClearlooksColors *colors = &clearlooks_style->colors;
156 cairo_t *cr = ge_gdk_drawable_to_cairo (window, area);
161 if ((DETAIL ("entry") && !(widget && widget->parent && GE_IS_TREE_VIEW (widget->parent))) ||
162 (DETAIL ("frame") && ge_is_in_combo_box (widget)))
164 WidgetParameters params;
166 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
168 /* Override the entries state type, because we are too lame to handle this via
169 * the focus ring, and GtkEntry doesn't even set the INSENSITIVE state ... */
170 if (state_type == GTK_STATE_NORMAL && widget && GE_IS_ENTRY (widget))
171 params.state_type = GTK_WIDGET_STATE (widget);
173 if (widget && (ge_is_in_combo_box (widget) || GE_IS_SPIN_BUTTON (widget)))
175 width += style->xthickness;
177 x -= style->xthickness;
180 params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
182 params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
185 STYLE_FUNCTION (draw_entry) (cr, &clearlooks_style->colors, ¶ms,
186 x, y, width, height);
188 else if (DETAIL ("frame") && widget && GE_IS_STATUSBAR (widget->parent))
190 WidgetParameters params;
192 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
194 gtk_style_apply_default_background (style, window, TRUE, state_type,
195 area, x, y, width, height);
197 STYLE_FUNCTION (draw_statusbar) (cr, colors, ¶ms,
198 x, y, width, height);
200 else if (DETAIL ("frame"))
202 WidgetParameters params;
203 FrameParameters frame;
204 frame.shadow = shadow_type;
205 frame.gap_x = -1; /* No gap will be drawn */
206 frame.border = &colors->shade[4];
208 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
209 params.corners = CR_CORNER_NONE;
211 if (widget && !g_str_equal ("XfcePanelWindow", gtk_widget_get_name (gtk_widget_get_toplevel (widget))))
212 STYLE_FUNCTION(draw_frame) (cr, colors, ¶ms, &frame,
213 x, y, width, height);
215 else if (DETAIL ("scrolled_window") || DETAIL ("viewport") || detail == NULL)
217 CairoColor *border = (CairoColor*)&colors->shade[5];
218 cairo_rectangle (cr, x+0.5, y+0.5, width-1, height-1);
219 ge_cairo_set_color (cr, border);
220 cairo_set_line_width (cr, 1);
225 WidgetParameters params;
226 FrameParameters frame;
228 frame.shadow = shadow_type;
230 frame.border = &colors->shade[5];
231 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
232 params.corners = CR_CORNER_ALL;
234 STYLE_FUNCTION(draw_frame) (cr, colors, ¶ms, &frame, x, y, width, height);
241 clearlooks_style_draw_box_gap (DRAW_ARGS,
242 GtkPositionType gap_side,
246 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
247 ClearlooksColors *colors = &clearlooks_style->colors;
253 cr = ge_gdk_drawable_to_cairo (window, area);
255 if (DETAIL ("notebook"))
257 WidgetParameters params;
258 FrameParameters frame;
261 frame.shadow = shadow_type;
262 frame.gap_side = gap_side;
264 frame.gap_width = gap_width;
265 frame.border = &colors->shade[5];
267 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
269 clearlooks_get_notebook_tab_position (widget, &start, &end);
271 params.corners = CR_CORNER_ALL;
275 params.corners ^= CR_CORNER_TOPLEFT;
277 params.corners ^= CR_CORNER_BOTTOMLEFT;
281 params.corners ^= CR_CORNER_TOPRIGHT;
283 params.corners ^= CR_CORNER_BOTTOMRIGHT;
286 if (ge_widget_is_ltr (widget)) {
288 params.corners ^= CR_CORNER_TOPLEFT;
290 params.corners ^= CR_CORNER_TOPRIGHT;
293 params.corners ^= CR_CORNER_TOPRIGHT;
295 params.corners ^= CR_CORNER_TOPLEFT;
299 if (ge_widget_is_ltr (widget)) {
301 params.corners ^= CR_CORNER_BOTTOMLEFT;
303 params.corners ^= CR_CORNER_BOTTOMRIGHT;
306 params.corners ^= CR_CORNER_BOTTOMRIGHT;
308 params.corners ^= CR_CORNER_BOTTOMLEFT;
313 /* Fill the background with bg[NORMAL] */
314 ge_cairo_rounded_rectangle (cr, x, y, width, height, params.radius, params.corners);
315 ge_cairo_set_color (cr, &colors->bg[GTK_STATE_NORMAL]);
318 STYLE_FUNCTION(draw_frame) (cr, colors, ¶ms, &frame,
319 x, y, width, height);
323 clearlooks_parent_class->draw_box_gap (style, window, state_type, shadow_type,
324 area, widget, detail,
326 gap_side, gap_x, gap_width);
333 clearlooks_style_draw_extension (DRAW_ARGS, GtkPositionType gap_side)
335 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
336 ClearlooksColors *colors = &clearlooks_style->colors;
342 cr = ge_gdk_drawable_to_cairo (window, area);
346 WidgetParameters params;
349 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
351 tab.gap_side = (ClearlooksGapSide)gap_side;
356 params.corners = CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT;
359 params.corners = CR_CORNER_BOTTOMLEFT | CR_CORNER_BOTTOMRIGHT;
362 params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
365 params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
368 STYLE_FUNCTION(draw_tab) (cr, colors, ¶ms, &tab,
369 x, y, width, height);
373 clearlooks_parent_class->draw_extension (style, window, state_type, shadow_type, area,
374 widget, detail, x, y, width, height,
383 clearlooks_style_draw_handle (DRAW_ARGS, GtkOrientation orientation)
385 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
386 ClearlooksColors *colors = &clearlooks_style->colors;
388 gboolean is_horizontal;
393 cr = ge_gdk_drawable_to_cairo (window, area);
395 /* Evil hack to work around broken orientation for toolbars */
396 is_horizontal = (width > height);
398 if (DETAIL ("handlebox"))
400 WidgetParameters params;
401 HandleParameters handle;
403 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
404 handle.type = CL_HANDLE_TOOLBAR;
405 handle.horizontal = is_horizontal;
407 /* Is this ever true? -Daniel */
408 if (GE_IS_TOOLBAR (widget) && shadow_type != GTK_SHADOW_NONE)
410 ToolbarParameters toolbar;
412 clearlooks_set_toolbar_parameters (&toolbar, widget, window, x, y);
414 toolbar.style = clearlooks_style->toolbarstyle;
417 STYLE_FUNCTION(draw_toolbar) (cr, colors, ¶ms, &toolbar, x, y, width, height);
421 STYLE_FUNCTION(draw_handle) (cr, colors, ¶ms, &handle,
422 x, y, width, height);
424 else if (DETAIL ("paned"))
426 WidgetParameters params;
427 HandleParameters handle;
429 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
430 handle.type = CL_HANDLE_SPLITTER;
431 handle.horizontal = orientation == GTK_ORIENTATION_HORIZONTAL;
433 STYLE_FUNCTION(draw_handle) (cr, colors, ¶ms, &handle,
434 x, y, width, height);
438 WidgetParameters params;
439 HandleParameters handle;
441 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
442 handle.type = CL_HANDLE_TOOLBAR;
443 handle.horizontal = is_horizontal;
445 /* Is this ever true? -Daniel */
446 if (GE_IS_TOOLBAR (widget) && shadow_type != GTK_SHADOW_NONE)
448 ToolbarParameters toolbar;
450 clearlooks_set_toolbar_parameters (&toolbar, widget, window, x, y);
452 toolbar.style = clearlooks_style->toolbarstyle;
455 STYLE_FUNCTION(draw_toolbar) (cr, colors, ¶ms, &toolbar, x, y, width, height);
459 STYLE_FUNCTION(draw_handle) (cr, colors, ¶ms, &handle,
460 x, y, width, height);
467 clearlooks_style_draw_box (DRAW_ARGS)
469 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
470 const ClearlooksColors *colors;
473 cr = ge_gdk_drawable_to_cairo (window, area);
474 colors = &clearlooks_style->colors;
479 if (DETAIL ("menubar") && !ge_is_panel_widget_item(widget))
481 WidgetParameters params;
482 MenuBarParameters menubar;
484 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
486 menubar.style = clearlooks_style->menubarstyle;
488 STYLE_FUNCTION(draw_menubar) (cr, colors, ¶ms, &menubar,
489 x, y, width, height);
491 else if (DETAIL ("button") && widget && widget->parent &&
492 (GE_IS_TREE_VIEW(widget->parent) ||
493 GE_IS_CLIST (widget->parent) ||
494 ge_object_is_a (G_OBJECT(widget->parent), "ETree"))) /* ECanvas inside ETree */
496 WidgetParameters params;
497 ListViewHeaderParameters header;
499 gint columns, column_index;
500 gboolean resizable = TRUE;
502 /* XXX: This makes unknown treeview header CL_ORDER_MIDDLE, in need for something nicer */
506 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
508 params.corners = CR_CORNER_NONE;
510 if (GE_IS_TREE_VIEW (widget->parent))
512 clearlooks_treeview_get_header_index (GTK_TREE_VIEW(widget->parent),
513 widget, &column_index, &columns,
516 else if (GE_IS_CLIST (widget->parent))
518 clearlooks_clist_get_header_index (GTK_CLIST(widget->parent),
519 widget, &column_index, &columns);
522 header.resizable = resizable;
524 if (column_index == 0)
525 header.order = params.ltr ? CL_ORDER_FIRST : CL_ORDER_LAST;
526 else if (column_index == columns-1)
527 header.order = params.ltr ? CL_ORDER_LAST : CL_ORDER_FIRST;
529 header.order = CL_ORDER_MIDDLE;
531 gtk_style_apply_default_background (style, window, FALSE, state_type, area, x, y, width, height);
533 STYLE_FUNCTION(draw_list_view_header) (cr, colors, ¶ms, &header,
534 x, y, width, height);
536 else if (DETAIL ("button") || DETAIL ("buttondefault"))
538 WidgetParameters params;
539 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
541 if (ge_is_in_combo_box(widget))
544 params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
546 params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
548 if (params.xthickness > 2)
557 params.corners = CR_CORNER_ALL;
558 /* if (!(ge_is_combo_box (widget, FALSE))) */
559 params.enable_glow = TRUE;
562 if (GE_IS_TOGGLE_BUTTON (widget) &&
563 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
564 params.active = TRUE;
566 STYLE_FUNCTION(draw_button) (cr, &clearlooks_style->colors, ¶ms,
567 x, y, width, height);
569 else if (DETAIL ("spinbutton_up") || DETAIL ("spinbutton_down"))
571 if (state_type == GTK_STATE_ACTIVE)
573 WidgetParameters params;
574 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
576 if (style->xthickness == 3)
583 if (DETAIL ("spinbutton_up"))
587 params.corners = CR_CORNER_TOPRIGHT;
589 params.corners = CR_CORNER_TOPLEFT;
594 params.corners = CR_CORNER_BOTTOMRIGHT;
596 params.corners = CR_CORNER_BOTTOMLEFT;
599 STYLE_FUNCTION(draw_spinbutton_down) (cr, &clearlooks_style->colors, ¶ms, x, y, width, height);
602 else if (DETAIL ("spinbutton"))
604 WidgetParameters params;
606 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
609 params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
611 params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
613 if (style->xthickness == 3)
620 STYLE_FUNCTION(draw_spinbutton) (cr, &clearlooks_style->colors, ¶ms,
621 x, y, width, height);
623 else if (detail && g_str_has_prefix (detail, "trough") && GE_IS_SCALE (widget))
625 WidgetParameters params;
626 SliderParameters slider;
628 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
629 params.corners = CR_CORNER_NONE;
631 slider.lower = DETAIL ("trough-lower");
632 slider.fill_level = DETAIL ("trough-fill-level") || DETAIL ("trough-fill-level-full");
634 slider.horizontal = (GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL);
636 STYLE_FUNCTION(draw_scale_trough) (cr, &clearlooks_style->colors,
638 x, y, width, height);
640 else if (DETAIL ("trough") && widget && GE_IS_PROGRESS_BAR (widget))
642 WidgetParameters params;
644 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
646 STYLE_FUNCTION(draw_progressbar_trough) (cr, colors, ¶ms,
647 x, y, width, height);
649 else if (DETAIL ("trough") && widget && (GE_IS_VSCROLLBAR (widget) || GE_IS_HSCROLLBAR (widget)))
651 WidgetParameters params;
652 ScrollBarParameters scrollbar;
654 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
655 params.corners = CR_CORNER_NONE;
657 scrollbar.horizontal = TRUE;
658 scrollbar.junction = clearlooks_scrollbar_get_junction (widget);
660 if (GE_IS_RANGE (widget))
661 scrollbar.horizontal = GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL;
663 if (scrollbar.horizontal)
674 STYLE_FUNCTION(draw_scrollbar_trough) (cr, colors, ¶ms, &scrollbar,
675 x, y, width, height);
677 else if (DETAIL ("bar"))
679 WidgetParameters params;
680 ProgressBarParameters progressbar;
681 gdouble elapsed = 0.0;
683 #ifdef HAVE_ANIMATION
684 if(clearlooks_style->animation && CL_IS_PROGRESS_BAR (widget))
686 gboolean activity_mode = GTK_PROGRESS (widget)->activity_mode;
689 clearlooks_animation_progressbar_add ((gpointer)widget);
692 elapsed = clearlooks_animation_elapsed (widget);
695 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
697 if (widget && GE_IS_PROGRESS_BAR (widget))
699 progressbar.orientation = gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (widget));
700 progressbar.value = gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(widget));
701 progressbar.pulsing = GTK_PROGRESS (widget)->activity_mode;
705 progressbar.orientation = CL_ORIENTATION_LEFT_TO_RIGHT;
706 progressbar.value = 0;
707 progressbar.pulsing = FALSE;
712 if (progressbar.orientation == (ClearlooksOrientation)GTK_PROGRESS_LEFT_TO_RIGHT)
713 progressbar.orientation = GTK_PROGRESS_RIGHT_TO_LEFT;
714 else if (progressbar.orientation == (ClearlooksOrientation)GTK_PROGRESS_RIGHT_TO_LEFT)
715 progressbar.orientation = GTK_PROGRESS_LEFT_TO_RIGHT;
718 /* Following is a hack to have a larger clip area, the one passed in
719 * does not allow for the shadow. */
722 GdkRectangle tmp = *area;
723 if (!progressbar.pulsing)
725 switch (progressbar.orientation)
727 case GTK_PROGRESS_RIGHT_TO_LEFT:
730 case GTK_PROGRESS_LEFT_TO_RIGHT:
733 case GTK_PROGRESS_BOTTOM_TO_TOP:
736 case GTK_PROGRESS_TOP_TO_BOTTOM:
743 if (progressbar.orientation == (ClearlooksOrientation)GTK_PROGRESS_RIGHT_TO_LEFT ||
744 progressbar.orientation == (ClearlooksOrientation)GTK_PROGRESS_LEFT_TO_RIGHT)
756 cairo_reset_clip (cr);
757 gdk_cairo_rectangle (cr, &tmp);
761 STYLE_FUNCTION(draw_progressbar_fill) (cr, colors, ¶ms, &progressbar,
763 10 - (int)(elapsed * 10.0) % 10);
765 else if (DETAIL ("optionmenu"))
767 WidgetParameters params;
768 OptionMenuParameters optionmenu;
770 GtkRequisition indicator_size;
771 GtkBorder indicator_spacing;
773 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
775 params.enable_glow = TRUE;
777 ge_option_menu_get_props (widget, &indicator_size, &indicator_spacing);
779 if (ge_widget_is_ltr (widget))
780 optionmenu.linepos = width - (indicator_size.width + indicator_spacing.left + indicator_spacing.right) - 1;
782 optionmenu.linepos = (indicator_size.width + indicator_spacing.left + indicator_spacing.right) + 1;
784 STYLE_FUNCTION(draw_optionmenu) (cr, colors, ¶ms, &optionmenu,
785 x, y, width, height);
787 else if (DETAIL ("menuitem"))
789 WidgetParameters params;
790 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
792 if (widget && GE_IS_MENU_BAR (widget->parent))
794 params.corners = CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT;
796 STYLE_FUNCTION(draw_menubaritem) (cr, colors, ¶ms, x, y, width, height);
800 params.corners = CR_CORNER_ALL;
801 STYLE_FUNCTION(draw_menuitem) (cr, colors, ¶ms, x, y, width, height);
804 else if (DETAIL ("hscrollbar") || DETAIL ("vscrollbar")) /* This can't be "stepper" for scrollbars ... */
806 WidgetParameters params;
807 ScrollBarParameters scrollbar;
808 ScrollBarStepperParameters stepper;
809 GdkRectangle this_rectangle;
811 this_rectangle.x = x;
812 this_rectangle.y = y;
813 this_rectangle.width = width;
814 this_rectangle.height = height;
816 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
817 params.corners = CR_CORNER_NONE;
819 scrollbar.has_color = FALSE;
820 scrollbar.horizontal = TRUE;
821 scrollbar.junction = clearlooks_scrollbar_get_junction (widget);
823 if (clearlooks_style->colorize_scrollbar || clearlooks_style->has_scrollbar_color) {
824 scrollbar.has_color = TRUE;
827 scrollbar.horizontal = DETAIL ("hscrollbar");
829 stepper.stepper = clearlooks_scrollbar_get_stepper (widget, &this_rectangle);
831 STYLE_FUNCTION(draw_scrollbar_stepper) (cr, colors, ¶ms, &scrollbar, &stepper,
832 x, y, width, height);
834 else if (DETAIL ("toolbar") || DETAIL ("handlebox_bin") || DETAIL ("dockitem_bin"))
836 WidgetParameters params;
837 ToolbarParameters toolbar;
839 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
840 clearlooks_set_toolbar_parameters (&toolbar, widget, window, x, y);
842 toolbar.style = clearlooks_style->toolbarstyle;
844 /* Only draw the shadows on horizontal toolbars */
845 if (shadow_type != GTK_SHADOW_NONE && height < 2*width )
846 STYLE_FUNCTION(draw_toolbar) (cr, colors, ¶ms, &toolbar, x, y, width, height);
848 else if (DETAIL ("trough"))
852 else if (DETAIL ("menu"))
854 WidgetParameters params;
856 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
858 STYLE_FUNCTION(draw_menu_frame) (cr, colors, ¶ms, x, y, width, height);
860 else if (DETAIL ("hseparator") || DETAIL ("vseparator"))
862 const gchar *new_detail = detail;
863 /* Draw a normal separator, we just use this because it gives more control
864 * over sizing (currently). */
866 /* This isn't nice ... but it seems like the best cleanest way to me right now.
867 * It will get slightly nicer in the future hopefully. */
868 if (GE_IS_MENU_ITEM (widget))
869 new_detail = "menuitem";
871 if (DETAIL ("hseparator")) {
872 gtk_paint_hline (style, window, state_type, area, widget, new_detail,
873 x, x + width - 1, y + height/2);
875 gtk_paint_vline (style, window, state_type, area, widget, new_detail,
876 y, y + height - 1, x + width/2);
880 clearlooks_parent_class->draw_box (style, window, state_type, shadow_type, area,
881 widget, detail, x, y, width, height);
888 clearlooks_style_draw_slider (DRAW_ARGS, GtkOrientation orientation)
890 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
891 const ClearlooksColors *colors;
894 cr = ge_gdk_drawable_to_cairo (window, area);
895 colors = &clearlooks_style->colors;
900 if (DETAIL ("hscale") || DETAIL ("vscale"))
902 WidgetParameters params;
903 SliderParameters slider;
905 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
907 slider.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
908 slider.lower = FALSE;
909 slider.fill_level = FALSE;
911 if (clearlooks_style->style == CL_STYLE_GLOSSY) /* XXX! */
912 params.corners = CR_CORNER_ALL;
914 STYLE_FUNCTION(draw_slider_button) (cr, &clearlooks_style->colors,
916 x, y, width, height);
918 else if (DETAIL ("slider"))
920 WidgetParameters params;
921 ScrollBarParameters scrollbar;
923 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
924 params.corners = CR_CORNER_NONE;
926 scrollbar.has_color = FALSE;
927 scrollbar.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
928 scrollbar.junction = clearlooks_scrollbar_get_junction (widget);
930 if (clearlooks_style->colorize_scrollbar) {
931 scrollbar.color = colors->spot[1];
932 scrollbar.has_color = TRUE;
935 /* Set scrollbar color */
936 if (clearlooks_style->has_scrollbar_color)
938 ge_gdk_color_to_cairo (&clearlooks_style->scrollbar_color, &scrollbar.color);
939 scrollbar.has_color = TRUE;
942 if ((clearlooks_style->style == CL_STYLE_GLOSSY || clearlooks_style->style == CL_STYLE_GUMMY)
943 && !scrollbar.has_color)
944 scrollbar.color = colors->bg[0];
946 STYLE_FUNCTION(draw_scrollbar_slider) (cr, colors, ¶ms, &scrollbar,
947 x, y, width, height);
951 clearlooks_parent_class->draw_slider (style, window, state_type, shadow_type, area,
952 widget, detail, x, y, width, height, orientation);
959 clearlooks_style_draw_option (DRAW_ARGS)
961 const ClearlooksColors *colors;
962 WidgetParameters params;
963 CheckboxParameters checkbox;
965 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
972 cr = ge_gdk_drawable_to_cairo (window, area);
973 colors = &clearlooks_style->colors;
975 checkbox.shadow_type = shadow_type;
976 checkbox.in_menu = (widget && GTK_IS_MENU(widget->parent));
978 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
980 STYLE_FUNCTION(draw_radiobutton) (cr, colors, ¶ms, &checkbox, x, y, width, height);
986 clearlooks_style_draw_check (DRAW_ARGS)
988 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
989 WidgetParameters params;
990 CheckboxParameters checkbox;
996 cr = ge_gdk_drawable_to_cairo (window, area);
998 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
1000 params.corners = CR_CORNER_ALL;
1002 checkbox.shadow_type = shadow_type;
1003 checkbox.in_cell = DETAIL("cellcheck");
1005 checkbox.in_menu = (widget && widget->parent && GTK_IS_MENU(widget->parent));
1007 STYLE_FUNCTION(draw_checkbox) (cr, &clearlooks_style->colors, ¶ms, &checkbox,
1008 x, y, width, height);
1014 clearlooks_style_draw_vline (GtkStyle *style,
1016 GtkStateType state_type,
1019 const gchar *detail,
1024 const ClearlooksColors *colors;
1025 SeparatorParameters separator;
1028 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1034 separator.horizontal = FALSE;
1038 colors = &clearlooks_style->colors;
1040 cr = ge_gdk_drawable_to_cairo (window, area);
1042 /* There is no such thing as a vertical menu separator
1043 * (and even if, a normal one should be better on menu bars) */
1044 STYLE_FUNCTION(draw_separator) (cr, colors, NULL, &separator,
1051 clearlooks_style_draw_hline (GtkStyle *style,
1053 GtkStateType state_type,
1056 const gchar *detail,
1061 const ClearlooksColors *colors;
1063 SeparatorParameters separator;
1064 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1071 colors = &clearlooks_style->colors;
1073 cr = ge_gdk_drawable_to_cairo (window, area);
1075 separator.horizontal = TRUE;
1077 if (!DETAIL ("menuitem"))
1078 STYLE_FUNCTION(draw_separator) (cr, colors, NULL, &separator,
1081 STYLE_FUNCTION(draw_menu_item_separator) (cr, colors, NULL, &separator,
1088 clearlooks_style_draw_shadow_gap (DRAW_ARGS,
1089 GtkPositionType gap_side,
1093 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1094 const ClearlooksColors *colors;
1100 cr = ge_gdk_drawable_to_cairo (window, area);
1101 colors = &clearlooks_style->colors;
1103 if (DETAIL ("frame"))
1105 WidgetParameters params;
1106 FrameParameters frame;
1108 frame.shadow = shadow_type;
1109 frame.gap_side = gap_side;
1110 frame.gap_x = gap_x;
1111 frame.gap_width = gap_width;
1112 frame.border = &colors->shade[5];
1114 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
1116 params.corners = CR_CORNER_ALL;
1118 STYLE_FUNCTION(draw_frame) (cr, colors, ¶ms, &frame,
1119 x, y, width, height);
1123 clearlooks_parent_class->draw_shadow_gap (style, window, state_type, shadow_type, area,
1124 widget, detail, x, y, width, height,
1125 gap_side, gap_x, gap_width);
1132 clearlooks_style_draw_resize_grip (GtkStyle *style,
1134 GtkStateType state_type,
1137 const gchar *detail,
1144 ClearlooksColors *colors;
1146 WidgetParameters params;
1147 ResizeGripParameters grip;
1148 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1151 colors = &clearlooks_style->colors;
1156 grip.edge = (ClearlooksWindowEdge)edge;
1158 g_return_if_fail (window != NULL);
1160 cr = ge_gdk_drawable_to_cairo (window, area);
1162 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
1164 STYLE_FUNCTION(draw_resize_grip) (cr, colors, ¶ms, &grip,
1165 x, y, width, height);
1171 clearlooks_style_draw_tab (DRAW_ARGS)
1173 ClearlooksColors *colors;
1174 WidgetParameters params;
1175 ArrowParameters arrow;
1177 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1181 colors = &clearlooks_style->colors;
1186 cr = ge_gdk_drawable_to_cairo (window, area);
1188 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
1189 arrow.type = CL_ARROW_COMBO;
1190 arrow.direction = CL_DIRECTION_DOWN;
1192 STYLE_FUNCTION(draw_arrow) (cr, colors, ¶ms, &arrow, x, y, width, height);
1198 clearlooks_style_draw_arrow (GtkStyle *style,
1200 GtkStateType state_type,
1201 GtkShadowType shadow,
1204 const gchar *detail,
1205 GtkArrowType arrow_type,
1212 ClearlooksColors *colors;
1213 WidgetParameters params;
1214 ArrowParameters arrow;
1216 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1222 cr = ge_gdk_drawable_to_cairo (window, area);
1223 colors = &clearlooks_style->colors;
1228 if (arrow_type == GTK_ARROW_NONE) {
1233 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
1234 arrow.type = CL_ARROW_NORMAL;
1235 arrow.direction = (ClearlooksDirection)arrow_type;
1237 if (ge_is_combo_box (widget, FALSE) && !ge_is_combo_box_entry (widget))
1239 arrow.type = CL_ARROW_COMBO;
1242 /* I have no idea why, but the arrow of GtkCombo is larger than in other places.
1243 * Subtracting 3 seems to fix this. */
1244 if (widget && widget->parent && GE_IS_COMBO (widget->parent->parent))
1253 STYLE_FUNCTION(draw_arrow) (cr, colors, ¶ms, &arrow, x, y, width, height);
1259 clearlooks_style_init_from_rc (GtkStyle * style,
1260 GtkRcStyle * rc_style)
1262 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1264 clearlooks_parent_class->init_from_rc (style, rc_style);
1266 g_assert ((CLEARLOOKS_RC_STYLE (rc_style)->style < CL_NUM_STYLES));
1267 clearlooks_style->style = CLEARLOOKS_RC_STYLE (rc_style)->style;
1269 clearlooks_style->menubarstyle = CLEARLOOKS_RC_STYLE (rc_style)->menubarstyle;
1270 clearlooks_style->toolbarstyle = CLEARLOOKS_RC_STYLE (rc_style)->toolbarstyle;
1271 clearlooks_style->has_scrollbar_color = CLEARLOOKS_RC_STYLE (rc_style)->flags & CL_FLAG_SCROLLBAR_COLOR;
1272 clearlooks_style->colorize_scrollbar = CLEARLOOKS_RC_STYLE (rc_style)->colorize_scrollbar;
1273 clearlooks_style->animation = CLEARLOOKS_RC_STYLE (rc_style)->animation;
1274 clearlooks_style->radius = CLAMP (CLEARLOOKS_RC_STYLE (rc_style)->radius, 0.0, 10.0);
1276 if (clearlooks_style->has_scrollbar_color)
1277 clearlooks_style->scrollbar_color = CLEARLOOKS_RC_STYLE (rc_style)->scrollbar_color;
1281 clearlooks_style_realize (GtkStyle * style)
1283 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1284 double shades[] = {1.15, 0.95, 0.896, 0.82, 0.7, 0.665, 0.475, 0.45, 0.4};
1285 CairoColor spot_color;
1286 CairoColor bg_normal;
1290 clearlooks_parent_class->realize (style);
1292 contrast = CLEARLOOKS_RC_STYLE (style->rc_style)->contrast;
1294 /* Lighter to darker */
1295 ge_gdk_color_to_cairo (&style->bg[GTK_STATE_NORMAL], &bg_normal);
1297 for (i = 0; i < 9; i++)
1299 ge_shade_color(&bg_normal, (shades[i]-0.7) * contrast + 0.7, &clearlooks_style->colors.shade[i]);
1302 ge_gdk_color_to_cairo (&style->bg[GTK_STATE_SELECTED], &spot_color);
1304 ge_shade_color(&spot_color, 1.42, &clearlooks_style->colors.spot[0]);
1305 ge_shade_color(&spot_color, 1.05, &clearlooks_style->colors.spot[1]);
1306 ge_shade_color(&spot_color, 0.65, &clearlooks_style->colors.spot[2]);
1310 ge_gdk_color_to_cairo (&style->fg[i], &clearlooks_style->colors.fg[i]);
1311 ge_gdk_color_to_cairo (&style->bg[i], &clearlooks_style->colors.bg[i]);
1312 ge_gdk_color_to_cairo (&style->base[i], &clearlooks_style->colors.base[i]);
1313 ge_gdk_color_to_cairo (&style->text[i], &clearlooks_style->colors.text[i]);
1318 clearlooks_style_draw_focus (GtkStyle *style, GdkWindow *window, GtkStateType state_type,
1319 GdkRectangle *area, GtkWidget *widget, const gchar *detail,
1320 gint x, gint y, gint width, gint height)
1323 gboolean free_dash_list = FALSE;
1324 gint line_width = 1;
1325 gint8 *dash_list = (gint8 *)"\1\1";
1329 gtk_widget_style_get (widget,
1330 "focus-line-width", &line_width,
1331 "focus-line-pattern",
1332 (gchar *) & dash_list, NULL);
1334 free_dash_list = TRUE;
1337 if (detail && !strcmp (detail, "add-mode"))
1342 dash_list = (gint8 *)"\4\4";
1343 free_dash_list = FALSE;
1349 cr = gdk_cairo_create (window);
1351 if (detail && !strcmp (detail, "colorwheel_light"))
1352 cairo_set_source_rgb (cr, 0., 0., 0.);
1353 else if (detail && !strcmp (detail, "colorwheel_dark"))
1354 cairo_set_source_rgb (cr, 1., 1., 1.);
1356 ge_cairo_set_gdk_color_with_alpha (cr, &style->fg[state_type],
1359 cairo_set_line_width (cr, line_width);
1363 gint n_dashes = strlen ((gchar *)dash_list);
1364 gdouble *dashes = g_new (gdouble, n_dashes);
1365 gdouble total_length = 0;
1366 gdouble dash_offset;
1369 for (i = 0; i < n_dashes; i++)
1371 dashes[i] = dash_list[i];
1372 total_length += dash_list[i];
1375 /* The dash offset here aligns the pattern to integer pixels
1376 * by starting the dash at the right side of the left border
1377 * Negative dash offsets in cairo don't work
1378 * (https://bugs.freedesktop.org/show_bug.cgi?id=2729)
1380 dash_offset = -line_width / 2.;
1381 while (dash_offset < 0)
1382 dash_offset += total_length;
1384 cairo_set_dash (cr, dashes, n_dashes, dash_offset);
1390 gdk_cairo_rectangle (cr, area);
1394 cairo_rectangle (cr,
1395 x + line_width / 2.,
1396 y + line_width / 2.,
1397 width - line_width, height - line_width);
1406 clearlooks_style_copy (GtkStyle * style, GtkStyle * src)
1408 ClearlooksStyle * cl_style = CLEARLOOKS_STYLE (style);
1409 ClearlooksStyle * cl_src = CLEARLOOKS_STYLE (src);
1411 cl_style->colors = cl_src->colors;
1412 cl_style->menubarstyle = cl_src->menubarstyle;
1413 cl_style->toolbarstyle = cl_src->toolbarstyle;
1414 cl_style->scrollbar_color = cl_src->scrollbar_color;
1415 cl_style->has_scrollbar_color = cl_src->has_scrollbar_color;
1416 cl_style->colorize_scrollbar = cl_src->colorize_scrollbar;
1417 cl_style->animation = cl_src->animation;
1418 cl_style->radius = cl_src->radius;
1419 cl_style->style = cl_src->style;
1421 clearlooks_parent_class->copy (style, src);
1425 clearlooks_style_unrealize (GtkStyle * style)
1427 clearlooks_parent_class->unrealize (style);
1431 set_transparency (const GdkPixbuf *pixbuf, gdouble alpha_percent)
1434 guchar *data, *current;
1435 guint x, y, rowstride, height, width;
1437 g_return_val_if_fail (pixbuf != NULL, NULL);
1438 g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
1440 /* Returns a copy of pixbuf with it's non-completely-transparent pixels to
1441 have an alpha level "alpha_percent" of their original value. */
1443 target = gdk_pixbuf_add_alpha (pixbuf, FALSE, 0, 0, 0);
1445 if (alpha_percent == 1.0)
1447 width = gdk_pixbuf_get_width (target);
1448 height = gdk_pixbuf_get_height (target);
1449 rowstride = gdk_pixbuf_get_rowstride (target);
1450 data = gdk_pixbuf_get_pixels (target);
1452 for (y = 0; y < height; y++) {
1453 for (x = 0; x < width; x++) {
1454 /* The "4" is the number of chars per pixel, in this case, RGBA,
1455 the 3 means "skip to the alpha" */
1456 current = data + (y * rowstride) + (x * 4) + 3;
1457 *(current) = (guchar) (*(current) * alpha_percent);
1465 scale_or_ref (GdkPixbuf *src,
1469 if (width == gdk_pixbuf_get_width (src) &&
1470 height == gdk_pixbuf_get_height (src)) {
1471 return g_object_ref (src);
1473 return gdk_pixbuf_scale_simple (src,
1475 GDK_INTERP_BILINEAR);
1480 clearlooks_style_draw_layout (GtkStyle * style,
1482 GtkStateType state_type,
1484 GdkRectangle * area,
1486 const gchar * detail, gint x, gint y, PangoLayout * layout)
1491 g_return_if_fail (GTK_IS_STYLE (style));
1492 g_return_if_fail (window != NULL);
1494 gc = use_text ? style->text_gc[state_type] : style->fg_gc[state_type];
1497 gdk_gc_set_clip_rectangle (gc, area);
1499 if (state_type == GTK_STATE_INSENSITIVE) {
1500 ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
1501 ClearlooksColors *colors = &clearlooks_style->colors;
1503 WidgetParameters params;
1507 clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
1509 if (GTK_WIDGET_NO_WINDOW (widget))
1510 ge_shade_color (¶ms.parentbg, 1.2, &temp);
1512 ge_shade_color (&colors->bg[widget->state], 1.2, &temp);
1514 etched.red = (int) (temp.r * 65535);
1515 etched.green = (int) (temp.g * 65535);
1516 etched.blue = (int) (temp.b * 65535);
1518 gdk_draw_layout_with_colors (window, gc, x + 1, y + 1, layout, &etched, NULL);
1519 gdk_draw_layout (window, gc, x, y, layout);
1522 gdk_draw_layout (window, gc, x, y, layout);
1525 gdk_gc_set_clip_rectangle (gc, NULL);
1529 clearlooks_style_draw_render_icon (GtkStyle *style,
1530 const GtkIconSource *source,
1531 GtkTextDirection direction,
1541 GdkPixbuf *base_pixbuf;
1543 GtkSettings *settings;
1551 /* Oddly, style can be NULL in this function, because
1552 * GtkIconSet can be used without a style and if so
1553 * it uses this function.
1556 base_pixbuf = gtk_icon_source_get_pixbuf (source);
1558 g_return_val_if_fail (base_pixbuf != NULL, NULL);
1560 if (widget && gtk_widget_has_screen (widget)) {
1561 screen = gtk_widget_get_screen (widget);
1562 settings = gtk_settings_get_for_screen (screen);
1563 } else if (style->colormap) {
1564 screen = gdk_colormap_get_screen (style->colormap);
1565 settings = gtk_settings_get_for_screen (screen);
1567 settings = gtk_settings_get_default ();
1568 GTK_NOTE (MULTIHEAD,
1569 g_warning ("Using the default screen for gtk_default_render_icon()"));
1573 if (size != (GtkIconSize) -1 && !gtk_icon_size_lookup_for_settings (settings, size, &width, &height)) {
1574 g_warning (G_STRLOC ": invalid icon size '%d'", size);
1578 /* If the size was wildcarded, and we're allowed to scale, then scale; otherwise,
1581 if (size != (GtkIconSize)-1 && gtk_icon_source_get_size_wildcarded (source))
1582 scaled = scale_or_ref (base_pixbuf, width, height);
1584 scaled = g_object_ref (base_pixbuf);
1586 /* If the state was wildcarded, then generate a state. */
1587 if (gtk_icon_source_get_state_wildcarded (source)) {
1588 if (state == GTK_STATE_INSENSITIVE) {
1589 stated = set_transparency (scaled, 0.3);
1590 gdk_pixbuf_saturate_and_pixelate (stated, stated,
1593 g_object_unref (scaled);
1594 } else if (state == GTK_STATE_PRELIGHT) {
1595 stated = gdk_pixbuf_copy (scaled);
1597 gdk_pixbuf_saturate_and_pixelate (scaled, stated,
1600 g_object_unref (scaled);
1612 clearlooks_style_init (ClearlooksStyle * style)
1618 clearlooks_style_class_init (ClearlooksStyleClass * klass)
1620 GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
1622 clearlooks_style_class = CLEARLOOKS_STYLE_CLASS (klass);
1623 clearlooks_parent_class = g_type_class_peek_parent (klass);
1625 style_class->copy = clearlooks_style_copy;
1626 style_class->realize = clearlooks_style_realize;
1627 style_class->unrealize = clearlooks_style_unrealize;
1628 style_class->init_from_rc = clearlooks_style_init_from_rc;
1629 style_class->draw_handle = clearlooks_style_draw_handle;
1630 style_class->draw_slider = clearlooks_style_draw_slider;
1631 style_class->draw_shadow_gap = clearlooks_style_draw_shadow_gap;
1632 style_class->draw_focus = clearlooks_style_draw_focus;
1633 style_class->draw_box = clearlooks_style_draw_box;
1634 style_class->draw_shadow = clearlooks_style_draw_shadow;
1635 style_class->draw_box_gap = clearlooks_style_draw_box_gap;
1636 style_class->draw_extension = clearlooks_style_draw_extension;
1637 style_class->draw_option = clearlooks_style_draw_option;
1638 style_class->draw_check = clearlooks_style_draw_check;
1639 style_class->draw_flat_box = clearlooks_style_draw_flat_box;
1640 style_class->draw_vline = clearlooks_style_draw_vline;
1641 style_class->draw_hline = clearlooks_style_draw_hline;
1642 style_class->draw_resize_grip = clearlooks_style_draw_resize_grip;
1643 style_class->draw_tab = clearlooks_style_draw_tab;
1644 style_class->draw_arrow = clearlooks_style_draw_arrow;
1645 style_class->draw_layout = clearlooks_style_draw_layout;
1646 style_class->render_icon = clearlooks_style_draw_render_icon;
1648 clearlooks_register_style_classic (&clearlooks_style_class->style_functions[CL_STYLE_CLASSIC]);
1649 clearlooks_style_class->style_functions[CL_STYLE_GLOSSY] = clearlooks_style_class->style_functions[CL_STYLE_CLASSIC];
1650 clearlooks_register_style_glossy (&clearlooks_style_class->style_functions[CL_STYLE_GLOSSY]);
1651 clearlooks_style_class->style_functions[CL_STYLE_INVERTED] = clearlooks_style_class->style_functions[CL_STYLE_CLASSIC];
1652 clearlooks_register_style_inverted (&clearlooks_style_class->style_functions[CL_STYLE_INVERTED]);
1653 clearlooks_style_class->style_functions[CL_STYLE_GUMMY] = clearlooks_style_class->style_functions[CL_STYLE_CLASSIC];
1654 clearlooks_register_style_gummy (&clearlooks_style_class->style_functions[CL_STYLE_GUMMY]);
1657 GType clearlooks_type_style = 0;
1660 clearlooks_style_register_type (GTypeModule * module)
1662 static const GTypeInfo object_info =
1664 sizeof (ClearlooksStyleClass),
1665 (GBaseInitFunc) NULL,
1666 (GBaseFinalizeFunc) NULL,
1667 (GClassInitFunc) clearlooks_style_class_init,
1668 NULL, /* class_finalize */
1669 NULL, /* class_data */
1670 sizeof (ClearlooksStyle),
1671 0, /* n_preallocs */
1672 (GInstanceInitFunc) clearlooks_style_init,
1676 clearlooks_type_style = g_type_module_register_type (module,