1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
32 #include "gtkwidget.h"
33 #include "gtkthemes.h"
36 #define LIGHTNESS_MULT 1.3
37 #define DARKNESS_MULT 0.7
39 /* actually glib should do that for us */
41 #define M_PI 3.14159265358979323846
44 #define M_PI_4 0.78539816339744830962
47 static void gtk_style_realize (GtkStyle *style,
48 GdkColormap *colormap,
51 static void gtk_default_draw_hline (GtkStyle *style,
53 GtkStateType state_type,
60 static void gtk_default_draw_vline (GtkStyle *style,
62 GtkStateType state_type,
69 static void gtk_default_draw_shadow (GtkStyle *style,
71 GtkStateType state_type,
72 GtkShadowType shadow_type,
80 static void gtk_default_draw_shadow (GtkStyle *style,
82 GtkStateType state_type,
83 GtkShadowType shadow_type,
91 static void gtk_default_draw_polygon (GtkStyle *style,
93 GtkStateType state_type,
94 GtkShadowType shadow_type,
101 static void gtk_default_draw_arrow (GtkStyle *style,
103 GtkStateType state_type,
104 GtkShadowType shadow_type,
108 GtkArrowType arrow_type,
114 static void gtk_default_draw_diamond (GtkStyle *style,
116 GtkStateType state_type,
117 GtkShadowType shadow_type,
125 static void gtk_default_draw_oval (GtkStyle *style,
127 GtkStateType state_type,
128 GtkShadowType shadow_type,
136 static void gtk_default_draw_string (GtkStyle *style,
138 GtkStateType state_type,
144 const gchar *string);
145 static void gtk_default_draw_box (GtkStyle *style,
147 GtkStateType state_type,
148 GtkShadowType shadow_type,
156 static void gtk_default_draw_flat_box (GtkStyle *style,
158 GtkStateType state_type,
159 GtkShadowType shadow_type,
167 static void gtk_default_draw_check (GtkStyle *style,
169 GtkStateType state_type,
170 GtkShadowType shadow_type,
178 static void gtk_default_draw_option (GtkStyle *style,
180 GtkStateType state_type,
181 GtkShadowType shadow_type,
189 static void gtk_default_draw_cross (GtkStyle *style,
191 GtkStateType state_type,
192 GtkShadowType shadow_type,
200 static void gtk_default_draw_ramp (GtkStyle *style,
202 GtkStateType state_type,
203 GtkShadowType shadow_type,
207 GtkArrowType arrow_type,
212 static void gtk_default_draw_tab (GtkStyle *style,
214 GtkStateType state_type,
215 GtkShadowType shadow_type,
223 static void gtk_default_draw_shadow_gap (GtkStyle *style,
225 GtkStateType state_type,
226 GtkShadowType shadow_type,
234 GtkPositionType gap_side,
237 static void gtk_default_draw_box_gap (GtkStyle *style,
239 GtkStateType state_type,
240 GtkShadowType shadow_type,
248 GtkPositionType gap_side,
251 static void gtk_default_draw_extension (GtkStyle *style,
253 GtkStateType state_type,
254 GtkShadowType shadow_type,
262 GtkPositionType gap_side);
263 static void gtk_default_draw_focus (GtkStyle *style,
272 static void gtk_default_draw_slider (GtkStyle *style,
274 GtkStateType state_type,
275 GtkShadowType shadow_type,
283 GtkOrientation orientation);
284 static void gtk_default_draw_handle (GtkStyle *style,
286 GtkStateType state_type,
287 GtkShadowType shadow_type,
295 GtkOrientation orientation);
297 static void gtk_style_shade (GdkColor *a, GdkColor *b, gdouble k);
298 static void rgb_to_hls (gdouble *r, gdouble *g, gdouble *b);
299 static void hls_to_rgb (gdouble *h, gdouble *l, gdouble *s);
301 GdkFont *default_font = NULL;
303 static GdkColor gtk_default_normal_fg = { 0, 0, 0, 0 };
304 static GdkColor gtk_default_active_fg = { 0, 0, 0, 0 };
305 static GdkColor gtk_default_prelight_fg = { 0, 0, 0, 0 };
306 static GdkColor gtk_default_selected_fg = { 0, 0xffff, 0xffff, 0xffff };
307 static GdkColor gtk_default_insensitive_fg = { 0, 0x7530, 0x7530, 0x7530 };
309 static GdkColor gtk_default_normal_bg = { 0, 0xd6d6, 0xd6d6, 0xd6d6 };
310 static GdkColor gtk_default_active_bg = { 0, 0xc350, 0xc350, 0xc350 };
311 static GdkColor gtk_default_prelight_bg = { 0, 0xea60, 0xea60, 0xea60 };
312 static GdkColor gtk_default_selected_bg = { 0, 0, 0, 0x9c40 };
313 static GdkColor gtk_default_insensitive_bg = { 0, 0xd6d6, 0xd6d6, 0xd6d6 };
315 static gpointer parent_class = NULL;
317 static void gtk_style_init (GtkStyle *style);
318 static void gtk_style_class_init (GtkStyleClass *klass);
319 static void gtk_style_finalize (GObject *object);
322 gtk_style_get_type (void)
324 static GType object_type = 0;
328 static const GTypeInfo object_info =
330 sizeof (GtkStyleClass),
331 (GBaseInitFunc) NULL,
332 (GBaseFinalizeFunc) NULL,
333 (GClassInitFunc) gtk_style_class_init,
334 NULL, /* class_finalize */
335 NULL, /* class_data */
338 (GInstanceInitFunc) gtk_style_init,
341 object_type = g_type_register_static (G_TYPE_OBJECT,
350 gtk_style_init (GtkStyle *style)
354 style->font_desc = pango_font_description_from_string ("Sans 10");
358 default_font = gdk_font_from_description (style->font_desc);
361 g_error ("Unable to load default font.");
364 style->font = default_font;
365 gdk_font_ref (style->font);
367 style->attach_count = 0;
368 style->colormap = NULL;
371 style->black.red = 0;
372 style->black.green = 0;
373 style->black.blue = 0;
375 style->white.red = 65535;
376 style->white.green = 65535;
377 style->white.blue = 65535;
379 style->black_gc = NULL;
380 style->white_gc = NULL;
382 style->fg[GTK_STATE_NORMAL] = gtk_default_normal_fg;
383 style->fg[GTK_STATE_ACTIVE] = gtk_default_active_fg;
384 style->fg[GTK_STATE_PRELIGHT] = gtk_default_prelight_fg;
385 style->fg[GTK_STATE_SELECTED] = gtk_default_selected_fg;
386 style->fg[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_fg;
388 style->bg[GTK_STATE_NORMAL] = gtk_default_normal_bg;
389 style->bg[GTK_STATE_ACTIVE] = gtk_default_active_bg;
390 style->bg[GTK_STATE_PRELIGHT] = gtk_default_prelight_bg;
391 style->bg[GTK_STATE_SELECTED] = gtk_default_selected_bg;
392 style->bg[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_bg;
394 for (i = 0; i < 4; i++)
396 style->text[i] = style->fg[i];
397 style->base[i] = style->white;
400 style->base[GTK_STATE_INSENSITIVE] = gtk_default_prelight_bg;
401 style->text[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_fg;
403 for (i = 0; i < 5; i++)
404 style->bg_pixmap[i] = NULL;
406 style->engine = NULL;
407 style->engine_data = NULL;
409 style->rc_style = NULL;
411 for (i = 0; i < 5; i++)
413 style->fg_gc[i] = NULL;
414 style->bg_gc[i] = NULL;
415 style->light_gc[i] = NULL;
416 style->dark_gc[i] = NULL;
417 style->mid_gc[i] = NULL;
418 style->text_gc[i] = NULL;
419 style->base_gc[i] = NULL;
422 style->xthickness = 2;
423 style->ythickness = 2;
427 gtk_style_class_init (GtkStyleClass *klass)
429 GObjectClass *object_class = G_OBJECT_CLASS (klass);
431 parent_class = g_type_class_peek_parent (klass);
433 object_class->finalize = gtk_style_finalize;
435 klass->draw_hline = gtk_default_draw_hline;
436 klass->draw_vline = gtk_default_draw_vline;
437 klass->draw_shadow = gtk_default_draw_shadow;
438 klass->draw_polygon = gtk_default_draw_polygon;
439 klass->draw_arrow = gtk_default_draw_arrow;
440 klass->draw_diamond = gtk_default_draw_diamond;
441 klass->draw_oval = gtk_default_draw_oval;
442 klass->draw_string = gtk_default_draw_string;
443 klass->draw_box = gtk_default_draw_box;
444 klass->draw_flat_box = gtk_default_draw_flat_box;
445 klass->draw_check = gtk_default_draw_check;
446 klass->draw_option = gtk_default_draw_option;
447 klass->draw_cross = gtk_default_draw_cross;
448 klass->draw_ramp = gtk_default_draw_ramp;
449 klass->draw_tab = gtk_default_draw_tab;
450 klass->draw_shadow_gap = gtk_default_draw_shadow_gap;
451 klass->draw_box_gap = gtk_default_draw_box_gap;
452 klass->draw_extension = gtk_default_draw_extension;
453 klass->draw_focus = gtk_default_draw_focus;
454 klass->draw_slider = gtk_default_draw_slider;
455 klass->draw_handle = gtk_default_draw_handle;
459 gtk_style_finalize (GObject *object)
461 GtkStyle *style = GTK_STYLE (object);
463 g_return_if_fail (style->attach_count == 0);
467 if (style->styles->data != style)
468 g_slist_remove (style->styles, style);
471 GSList *tmp_list = style->styles->next;
475 ((GtkStyle*) tmp_list->data)->styles = style->styles->next;
476 tmp_list = tmp_list->next;
478 g_slist_free_1 (style->styles);
484 style->engine->destroy_style (style);
485 gtk_theme_engine_unref (style->engine);
488 gdk_font_unref (style->font);
489 pango_font_description_free (style->font_desc);
492 gtk_rc_style_unref (style->rc_style);
494 G_OBJECT_CLASS (parent_class)->finalize (object);
499 gtk_style_copy (GtkStyle *style)
504 g_return_val_if_fail (style != NULL, NULL);
506 new_style = gtk_style_new ();
508 for (i = 0; i < 5; i++)
510 new_style->fg[i] = style->fg[i];
511 new_style->bg[i] = style->bg[i];
512 new_style->text[i] = style->text[i];
513 new_style->base[i] = style->base[i];
515 new_style->bg_pixmap[i] = style->bg_pixmap[i];
518 gdk_font_unref (new_style->font);
519 new_style->font = style->font;
520 gdk_font_ref (new_style->font);
522 pango_font_description_free (new_style->font_desc);
523 new_style->font_desc = pango_font_description_copy (style->font_desc);
527 new_style->rc_style = style->rc_style;
528 gtk_rc_style_ref (style->rc_style);
533 new_style->engine = style->engine;
534 gtk_theme_engine_ref (new_style->engine);
535 new_style->engine->duplicate_style (new_style, style);
542 gtk_style_duplicate (GtkStyle *style)
546 g_return_val_if_fail (style != NULL, NULL);
548 new_style = gtk_style_copy (style);
550 style->styles = g_slist_append (style->styles, new_style);
551 new_style->styles = style->styles;
561 style = GTK_STYLE (g_type_create_instance (gtk_style_get_type ()));
566 /*************************************************************
568 * Attach a style to a window; this process allocates the
569 * colors and creates the GC's for the style - it specializes
570 * it to a particular visual and colormap. The process
571 * may involve the creation of a new style if the style
572 * has already been attached to a window with a different
573 * style and colormap.
578 * Either the style parameter, or a newly created style.
579 * If the style is newly created, the style parameter
580 * will be dereferenced, and the new style will have
581 * a reference count belonging to the caller.
583 * FIXME: The sequence -
584 * create a style => s1
585 * attach s1 to v1, c1 => s1
586 * attach s1 to v2, c2 => s2
587 * detach s1 from v1, c1
588 * attach s1 to v2, c2 => s3
589 * results in two separate, unlinked styles s2 and s3 which
590 * are identical and could be shared. To fix this, we would
591 * want to never remove a style from the list of linked
592 * styles as long as as it has a reference count. However, the
593 * disadvantage of doing it this way means that we would need two
594 * passes through the linked list when attaching (one to check for
595 * matching styles, one to look for empty unattached styles - but
596 * it will almost never be longer than 2 elements.
597 *************************************************************/
600 gtk_style_attach (GtkStyle *style,
604 GtkStyle *new_style = NULL;
605 GdkColormap *colormap;
608 g_return_val_if_fail (style != NULL, NULL);
609 g_return_val_if_fail (window != NULL, NULL);
611 colormap = gdk_window_get_colormap (window);
612 depth = gdk_window_get_visual (window)->depth;
615 style->styles = g_slist_append (NULL, style);
617 styles = style->styles;
620 new_style = styles->data;
622 if (new_style->attach_count == 0)
624 gtk_style_realize (new_style, colormap, depth);
627 else if (new_style->colormap == colormap &&
628 new_style->depth == depth)
632 styles = styles->next;
637 new_style = gtk_style_duplicate (style);
638 gtk_style_realize (new_style, colormap, depth);
641 /* A style gets a refcount from being attached */
642 if (new_style->attach_count == 0)
643 gtk_style_ref (new_style);
645 /* Another refcount belongs to the parent */
646 if (style != new_style)
648 gtk_style_unref (style);
649 gtk_style_ref (new_style);
652 new_style->attach_count++;
658 gtk_style_detach (GtkStyle *style)
662 g_return_if_fail (style != NULL);
664 style->attach_count -= 1;
665 if (style->attach_count == 0)
668 style->engine->unrealize_style (style);
670 gtk_gc_release (style->black_gc);
671 gtk_gc_release (style->white_gc);
673 for (i = 0; i < 5; i++)
675 gtk_gc_release (style->fg_gc[i]);
676 gtk_gc_release (style->bg_gc[i]);
677 gtk_gc_release (style->light_gc[i]);
678 gtk_gc_release (style->dark_gc[i]);
679 gtk_gc_release (style->mid_gc[i]);
680 gtk_gc_release (style->text_gc[i]);
681 gtk_gc_release (style->base_gc[i]);
684 gtk_style_unref (style);
689 gtk_style_ref (GtkStyle *style)
691 return (GtkStyle *) g_object_ref (G_OBJECT (style));
695 gtk_style_unref (GtkStyle *style)
697 g_object_unref (G_OBJECT (style));
701 gtk_style_realize (GtkStyle *style,
702 GdkColormap *colormap,
705 GdkGCValues gc_values;
706 GdkGCValuesMask gc_values_mask;
709 g_return_if_fail (style != NULL);
711 style->colormap = colormap;
712 style->depth = depth;
714 for (i = 0; i < 5; i++)
716 gtk_style_shade (&style->bg[i], &style->light[i], LIGHTNESS_MULT);
717 gtk_style_shade (&style->bg[i], &style->dark[i], DARKNESS_MULT);
719 style->mid[i].red = (style->light[i].red + style->dark[i].red) / 2;
720 style->mid[i].green = (style->light[i].green + style->dark[i].green) / 2;
721 style->mid[i].blue = (style->light[i].blue + style->dark[i].blue) / 2;
724 gdk_color_black (colormap, &style->black);
725 gdk_color_white (colormap, &style->white);
727 gc_values_mask = GDK_GC_FOREGROUND | GDK_GC_FONT;
728 if (style->font->type == GDK_FONT_FONT)
730 gc_values.font = style->font;
732 else if (style->font->type == GDK_FONT_FONTSET)
734 gc_values.font = default_font;
737 gc_values.foreground = style->black;
738 style->black_gc = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
740 gc_values.foreground = style->white;
741 style->white_gc = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
743 for (i = 0; i < 5; i++)
745 if (style->rc_style && style->rc_style->bg_pixmap_name[i])
746 style->bg_pixmap[i] = gtk_rc_load_image (style->colormap,
748 style->rc_style->bg_pixmap_name[i]);
750 if (!gdk_color_alloc (colormap, &style->fg[i]))
751 g_warning ("unable to allocate color: ( %d %d %d )",
752 style->fg[i].red, style->fg[i].green, style->fg[i].blue);
753 if (!gdk_color_alloc (colormap, &style->bg[i]))
754 g_warning ("unable to allocate color: ( %d %d %d )",
755 style->bg[i].red, style->bg[i].green, style->bg[i].blue);
756 if (!gdk_color_alloc (colormap, &style->light[i]))
757 g_warning ("unable to allocate color: ( %d %d %d )",
758 style->light[i].red, style->light[i].green, style->light[i].blue);
759 if (!gdk_color_alloc (colormap, &style->dark[i]))
760 g_warning ("unable to allocate color: ( %d %d %d )",
761 style->dark[i].red, style->dark[i].green, style->dark[i].blue);
762 if (!gdk_color_alloc (colormap, &style->mid[i]))
763 g_warning ("unable to allocate color: ( %d %d %d )",
764 style->mid[i].red, style->mid[i].green, style->mid[i].blue);
765 if (!gdk_color_alloc (colormap, &style->text[i]))
766 g_warning ("unable to allocate color: ( %d %d %d )",
767 style->text[i].red, style->text[i].green, style->text[i].blue);
768 if (!gdk_color_alloc (colormap, &style->base[i]))
769 g_warning ("unable to allocate color: ( %d %d %d )",
770 style->base[i].red, style->base[i].green, style->base[i].blue);
772 gc_values.foreground = style->fg[i];
773 style->fg_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
775 gc_values.foreground = style->bg[i];
776 style->bg_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
778 gc_values.foreground = style->light[i];
779 style->light_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
781 gc_values.foreground = style->dark[i];
782 style->dark_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
784 gc_values.foreground = style->mid[i];
785 style->mid_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
787 gc_values.foreground = style->text[i];
788 style->text_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
790 gc_values.foreground = style->base[i];
791 style->base_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
795 style->engine->realize_style (style);
799 gtk_draw_hline (GtkStyle *style,
801 GtkStateType state_type,
806 g_return_if_fail (style != NULL);
807 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL);
809 GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type, NULL, NULL, NULL, x1, x2, y);
814 gtk_draw_vline (GtkStyle *style,
816 GtkStateType state_type,
821 g_return_if_fail (style != NULL);
822 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL);
824 GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type, NULL, NULL, NULL, y1, y2, x);
829 gtk_draw_shadow (GtkStyle *style,
831 GtkStateType state_type,
832 GtkShadowType shadow_type,
838 g_return_if_fail (style != NULL);
839 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
841 GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
845 gtk_draw_polygon (GtkStyle *style,
847 GtkStateType state_type,
848 GtkShadowType shadow_type,
853 g_return_if_fail (style != NULL);
854 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_polygon != NULL);
856 GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type, NULL, NULL, NULL, points, npoints, fill);
860 gtk_draw_arrow (GtkStyle *style,
862 GtkStateType state_type,
863 GtkShadowType shadow_type,
864 GtkArrowType arrow_type,
871 g_return_if_fail (style != NULL);
872 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL);
874 GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, fill, x, y, width, height);
879 gtk_draw_diamond (GtkStyle *style,
881 GtkStateType state_type,
882 GtkShadowType shadow_type,
888 g_return_if_fail (style != NULL);
889 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL);
891 GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
896 gtk_draw_oval (GtkStyle *style,
898 GtkStateType state_type,
899 GtkShadowType shadow_type,
905 g_return_if_fail (style != NULL);
906 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_oval != NULL);
908 GTK_STYLE_GET_CLASS (style)->draw_oval (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
912 gtk_draw_string (GtkStyle *style,
914 GtkStateType state_type,
919 g_return_if_fail (style != NULL);
920 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_string != NULL);
922 GTK_STYLE_GET_CLASS (style)->draw_string (style, window, state_type, NULL, NULL, NULL, x, y, string);
926 gtk_draw_box (GtkStyle *style,
928 GtkStateType state_type,
929 GtkShadowType shadow_type,
935 g_return_if_fail (style != NULL);
936 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL);
938 GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
942 gtk_draw_flat_box (GtkStyle *style,
944 GtkStateType state_type,
945 GtkShadowType shadow_type,
951 g_return_if_fail (style != NULL);
952 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL);
954 GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
958 gtk_draw_check (GtkStyle *style,
960 GtkStateType state_type,
961 GtkShadowType shadow_type,
967 g_return_if_fail (style != NULL);
968 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL);
970 GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
974 gtk_draw_option (GtkStyle *style,
976 GtkStateType state_type,
977 GtkShadowType shadow_type,
983 g_return_if_fail (style != NULL);
984 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL);
986 GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
990 gtk_draw_cross (GtkStyle *style,
992 GtkStateType state_type,
993 GtkShadowType shadow_type,
999 g_return_if_fail (style != NULL);
1000 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_cross != NULL);
1002 GTK_STYLE_GET_CLASS (style)->draw_cross (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
1006 gtk_draw_ramp (GtkStyle *style,
1008 GtkStateType state_type,
1009 GtkShadowType shadow_type,
1010 GtkArrowType arrow_type,
1016 g_return_if_fail (style != NULL);
1017 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_ramp != NULL);
1019 GTK_STYLE_GET_CLASS (style)->draw_ramp (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, x, y, width, height);
1023 gtk_draw_tab (GtkStyle *style,
1025 GtkStateType state_type,
1026 GtkShadowType shadow_type,
1032 g_return_if_fail (style != NULL);
1033 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL);
1035 GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
1039 gtk_draw_shadow_gap (GtkStyle *style,
1041 GtkStateType state_type,
1042 GtkShadowType shadow_type,
1047 GtkPositionType gap_side,
1051 g_return_if_fail (style != NULL);
1052 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL);
1054 GTK_STYLE_GET_CLASS (style)->draw_shadow_gap (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width);
1058 gtk_draw_box_gap (GtkStyle *style,
1060 GtkStateType state_type,
1061 GtkShadowType shadow_type,
1066 GtkPositionType gap_side,
1070 g_return_if_fail (style != NULL);
1071 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL);
1073 GTK_STYLE_GET_CLASS (style)->draw_box_gap (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width);
1077 gtk_draw_extension (GtkStyle *style,
1079 GtkStateType state_type,
1080 GtkShadowType shadow_type,
1085 GtkPositionType gap_side)
1087 g_return_if_fail (style != NULL);
1088 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL);
1090 GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side);
1094 gtk_draw_focus (GtkStyle *style,
1101 g_return_if_fail (style != NULL);
1102 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL);
1104 GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, NULL, NULL, NULL, x, y, width, height);
1108 gtk_draw_slider (GtkStyle *style,
1110 GtkStateType state_type,
1111 GtkShadowType shadow_type,
1116 GtkOrientation orientation)
1118 g_return_if_fail (style != NULL);
1119 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_slider != NULL);
1121 GTK_STYLE_GET_CLASS (style)->draw_slider (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
1125 gtk_draw_handle (GtkStyle *style,
1127 GtkStateType state_type,
1128 GtkShadowType shadow_type,
1133 GtkOrientation orientation)
1135 g_return_if_fail (style != NULL);
1136 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL);
1138 GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
1142 gtk_style_set_background (GtkStyle *style,
1144 GtkStateType state_type)
1147 gint parent_relative;
1149 g_return_if_fail (style != NULL);
1150 g_return_if_fail (window != NULL);
1152 if (style->engine && style->engine->set_background)
1154 style->engine->set_background (style, window, state_type);
1159 if (style->bg_pixmap[state_type])
1161 if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
1164 parent_relative = TRUE;
1168 pixmap = style->bg_pixmap[state_type];
1169 parent_relative = FALSE;
1172 gdk_window_set_back_pixmap (window, pixmap, parent_relative);
1175 gdk_window_set_background (window, &style->bg[state_type]);
1179 /* Default functions */
1181 gtk_style_apply_default_background (GtkStyle *style,
1184 GtkStateType state_type,
1191 GdkRectangle new_rect, old_rect;
1197 old_rect.width = width;
1198 old_rect.height = height;
1200 if (!gdk_rectangle_intersect (area, &old_rect, &new_rect))
1207 new_rect.width = width;
1208 new_rect.height = height;
1211 if (!style->bg_pixmap[state_type] ||
1212 GDK_IS_PIXMAP (window) ||
1213 (!set_bg && style->bg_pixmap[state_type] != (GdkPixmap*) GDK_PARENT_RELATIVE))
1215 GdkGC *gc = style->bg_gc[state_type];
1217 if (style->bg_pixmap[state_type])
1219 gdk_gc_set_fill (gc, GDK_TILED);
1220 gdk_gc_set_tile (gc, style->bg_pixmap[state_type]);
1223 gdk_draw_rectangle (window, gc, TRUE,
1224 new_rect.x, new_rect.y, new_rect.width, new_rect.height);
1225 if (style->bg_pixmap[state_type])
1226 gdk_gc_set_fill (gc, GDK_SOLID);
1232 if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
1233 gdk_window_set_back_pixmap (window, NULL, TRUE);
1235 gdk_window_set_back_pixmap (window, style->bg_pixmap[state_type], FALSE);
1238 gdk_window_clear_area (window,
1239 new_rect.x, new_rect.y,
1240 new_rect.width, new_rect.height);
1245 gtk_default_draw_hline (GtkStyle *style,
1247 GtkStateType state_type,
1250 const gchar *detail,
1255 gint thickness_light;
1256 gint thickness_dark;
1259 g_return_if_fail (style != NULL);
1260 g_return_if_fail (window != NULL);
1262 thickness_light = style->ythickness / 2;
1263 thickness_dark = style->ythickness - thickness_light;
1267 gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
1268 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
1271 if (detail && !strcmp (detail, "label"))
1273 if (state_type == GTK_STATE_INSENSITIVE)
1274 gdk_draw_line (window, style->white_gc, x1 + 1, y + 1, x2 + 1, y + 1);
1275 gdk_draw_line (window, style->fg_gc[state_type], x1, y, x2, y);
1279 for (i = 0; i < thickness_dark; i++)
1281 gdk_draw_line (window, style->light_gc[state_type], x2 - i - 1, y + i, x2, y + i);
1282 gdk_draw_line (window, style->dark_gc[state_type], x1, y + i, x2 - i - 1, y + i);
1285 y += thickness_dark;
1286 for (i = 0; i < thickness_light; i++)
1288 gdk_draw_line (window, style->dark_gc[state_type], x1, y + i, x1 + thickness_light - i - 1, y + i);
1289 gdk_draw_line (window, style->light_gc[state_type], x1 + thickness_light - i - 1, y + i, x2, y + i);
1295 gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
1296 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
1302 gtk_default_draw_vline (GtkStyle *style,
1304 GtkStateType state_type,
1307 const gchar *detail,
1312 gint thickness_light;
1313 gint thickness_dark;
1316 g_return_if_fail (style != NULL);
1317 g_return_if_fail (window != NULL);
1319 thickness_light = style->xthickness / 2;
1320 thickness_dark = style->xthickness - thickness_light;
1324 gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
1325 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
1327 for (i = 0; i < thickness_dark; i++)
1329 gdk_draw_line (window, style->light_gc[state_type], x + i, y2 - i - 1, x + i, y2);
1330 gdk_draw_line (window, style->dark_gc[state_type], x + i, y1, x + i, y2 - i - 1);
1333 x += thickness_dark;
1334 for (i = 0; i < thickness_light; i++)
1336 gdk_draw_line (window, style->dark_gc[state_type], x + i, y1, x + i, y1 + thickness_light - i);
1337 gdk_draw_line (window, style->light_gc[state_type], x + i, y1 + thickness_light - i, x + i, y2);
1341 gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
1342 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
1348 gtk_default_draw_shadow (GtkStyle *style,
1350 GtkStateType state_type,
1351 GtkShadowType shadow_type,
1354 const gchar *detail,
1362 gint thickness_light;
1363 gint thickness_dark;
1366 g_return_if_fail (style != NULL);
1367 g_return_if_fail (window != NULL);
1369 if ((width == -1) && (height == -1))
1370 gdk_window_get_size (window, &width, &height);
1371 else if (width == -1)
1372 gdk_window_get_size (window, &width, NULL);
1373 else if (height == -1)
1374 gdk_window_get_size (window, NULL, &height);
1376 switch (shadow_type)
1378 case GTK_SHADOW_NONE:
1381 case GTK_SHADOW_ETCHED_IN:
1382 gc1 = style->light_gc[state_type];
1383 gc2 = style->dark_gc[state_type];
1385 case GTK_SHADOW_OUT:
1386 case GTK_SHADOW_ETCHED_OUT:
1387 gc1 = style->dark_gc[state_type];
1388 gc2 = style->light_gc[state_type];
1394 gdk_gc_set_clip_rectangle (gc1, area);
1395 gdk_gc_set_clip_rectangle (gc2, area);
1396 if (shadow_type == GTK_SHADOW_IN ||
1397 shadow_type == GTK_SHADOW_OUT)
1399 gdk_gc_set_clip_rectangle (style->black_gc, area);
1400 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
1404 switch (shadow_type)
1406 case GTK_SHADOW_NONE:
1410 gdk_draw_line (window, gc1,
1411 x, y + height - 1, x + width - 1, y + height - 1);
1412 gdk_draw_line (window, gc1,
1413 x + width - 1, y, x + width - 1, y + height - 1);
1415 gdk_draw_line (window, style->bg_gc[state_type],
1416 x + 1, y + height - 2, x + width - 2, y + height - 2);
1417 gdk_draw_line (window, style->bg_gc[state_type],
1418 x + width - 2, y + 1, x + width - 2, y + height - 2);
1420 gdk_draw_line (window, style->black_gc,
1421 x + 1, y + 1, x + width - 2, y + 1);
1422 gdk_draw_line (window, style->black_gc,
1423 x + 1, y + 1, x + 1, y + height - 2);
1425 gdk_draw_line (window, gc2,
1426 x, y, x + width - 1, y);
1427 gdk_draw_line (window, gc2,
1428 x, y, x, y + height - 1);
1431 case GTK_SHADOW_OUT:
1432 gdk_draw_line (window, gc1,
1433 x + 1, y + height - 2, x + width - 2, y + height - 2);
1434 gdk_draw_line (window, gc1,
1435 x + width - 2, y + 1, x + width - 2, y + height - 2);
1437 gdk_draw_line (window, gc2,
1438 x, y, x + width - 1, y);
1439 gdk_draw_line (window, gc2,
1440 x, y, x, y + height - 1);
1442 gdk_draw_line (window, style->bg_gc[state_type],
1443 x + 1, y + 1, x + width - 2, y + 1);
1444 gdk_draw_line (window, style->bg_gc[state_type],
1445 x + 1, y + 1, x + 1, y + height - 2);
1447 gdk_draw_line (window, style->black_gc,
1448 x, y + height - 1, x + width - 1, y + height - 1);
1449 gdk_draw_line (window, style->black_gc,
1450 x + width - 1, y, x + width - 1, y + height - 1);
1453 case GTK_SHADOW_ETCHED_IN:
1454 case GTK_SHADOW_ETCHED_OUT:
1455 thickness_light = 1;
1458 for (i = 0; i < thickness_dark; i++)
1460 gdk_draw_line (window, gc1,
1464 y + height - i - 1);
1465 gdk_draw_line (window, gc1,
1469 y + height - i - 1);
1471 gdk_draw_line (window, gc2,
1476 gdk_draw_line (window, gc2,
1480 y + height - i - 2);
1483 for (i = 0; i < thickness_light; i++)
1485 gdk_draw_line (window, gc1,
1486 x + thickness_dark + i,
1487 y + thickness_dark + i,
1488 x + width - thickness_dark - i - 1,
1489 y + thickness_dark + i);
1490 gdk_draw_line (window, gc1,
1491 x + thickness_dark + i,
1492 y + thickness_dark + i,
1493 x + thickness_dark + i,
1494 y + height - thickness_dark - i - 1);
1496 gdk_draw_line (window, gc2,
1497 x + thickness_dark + i,
1498 y + height - thickness_light - i - 1,
1499 x + width - thickness_light - 1,
1500 y + height - thickness_light - i - 1);
1501 gdk_draw_line (window, gc2,
1502 x + width - thickness_light - i - 1,
1503 y + thickness_dark + i,
1504 x + width - thickness_light - i - 1,
1505 y + height - thickness_light - 1);
1511 gdk_gc_set_clip_rectangle (gc1, NULL);
1512 gdk_gc_set_clip_rectangle (gc2, NULL);
1513 if (shadow_type == GTK_SHADOW_IN ||
1514 shadow_type == GTK_SHADOW_OUT)
1516 gdk_gc_set_clip_rectangle (style->black_gc, NULL);
1517 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
1523 gtk_default_draw_polygon (GtkStyle *style,
1525 GtkStateType state_type,
1526 GtkShadowType shadow_type,
1529 const gchar *detail,
1534 static const gdouble pi_over_4 = M_PI_4;
1535 static const gdouble pi_3_over_4 = M_PI_4 * 3;
1545 g_return_if_fail (style != NULL);
1546 g_return_if_fail (window != NULL);
1547 g_return_if_fail (points != NULL);
1549 switch (shadow_type)
1552 gc1 = style->bg_gc[state_type];
1553 gc2 = style->dark_gc[state_type];
1554 gc3 = style->light_gc[state_type];
1555 gc4 = style->black_gc;
1557 case GTK_SHADOW_ETCHED_IN:
1558 gc1 = style->light_gc[state_type];
1559 gc2 = style->dark_gc[state_type];
1560 gc3 = style->dark_gc[state_type];
1561 gc4 = style->light_gc[state_type];
1563 case GTK_SHADOW_OUT:
1564 gc1 = style->dark_gc[state_type];
1565 gc2 = style->light_gc[state_type];
1566 gc3 = style->black_gc;
1567 gc4 = style->bg_gc[state_type];
1569 case GTK_SHADOW_ETCHED_OUT:
1570 gc1 = style->dark_gc[state_type];
1571 gc2 = style->light_gc[state_type];
1572 gc3 = style->light_gc[state_type];
1573 gc4 = style->dark_gc[state_type];
1581 gdk_gc_set_clip_rectangle (gc1, area);
1582 gdk_gc_set_clip_rectangle (gc2, area);
1583 gdk_gc_set_clip_rectangle (gc3, area);
1584 gdk_gc_set_clip_rectangle (gc4, area);
1588 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, npoints);
1592 for (i = 0; i < npoints; i++)
1594 if ((points[i].x == points[i+1].x) &&
1595 (points[i].y == points[i+1].y))
1601 angle = atan2 (points[i+1].y - points[i].y,
1602 points[i+1].x - points[i].x);
1605 if ((angle > -pi_3_over_4) && (angle < pi_over_4))
1607 if (angle > -pi_over_4)
1618 gdk_draw_line (window, gc1,
1619 points[i].x-xadjust, points[i].y-yadjust,
1620 points[i+1].x-xadjust, points[i+1].y-yadjust);
1621 gdk_draw_line (window, gc3,
1622 points[i].x, points[i].y,
1623 points[i+1].x, points[i+1].y);
1627 if ((angle < -pi_3_over_4) || (angle > pi_3_over_4))
1638 gdk_draw_line (window, gc4,
1639 points[i].x+xadjust, points[i].y+yadjust,
1640 points[i+1].x+xadjust, points[i+1].y+yadjust);
1641 gdk_draw_line (window, gc2,
1642 points[i].x, points[i].y,
1643 points[i+1].x, points[i+1].y);
1649 gdk_gc_set_clip_rectangle (gc1, NULL);
1650 gdk_gc_set_clip_rectangle (gc2, NULL);
1651 gdk_gc_set_clip_rectangle (gc3, NULL);
1652 gdk_gc_set_clip_rectangle (gc4, NULL);
1657 gtk_default_draw_arrow (GtkStyle *style,
1659 GtkStateType state_type,
1660 GtkShadowType shadow_type,
1663 const gchar *detail,
1664 GtkArrowType arrow_type,
1679 g_return_if_fail (style != NULL);
1680 g_return_if_fail (window != NULL);
1682 switch (shadow_type)
1685 gc1 = style->bg_gc[state_type];
1686 gc2 = style->dark_gc[state_type];
1687 gc3 = style->light_gc[state_type];
1688 gc4 = style->black_gc;
1690 case GTK_SHADOW_OUT:
1691 gc1 = style->dark_gc[state_type];
1692 gc2 = style->light_gc[state_type];
1693 gc3 = style->black_gc;
1694 gc4 = style->bg_gc[state_type];
1696 case GTK_SHADOW_ETCHED_IN:
1697 gc1 = style->light_gc[state_type];
1698 gc2 = style->dark_gc[state_type];
1702 case GTK_SHADOW_ETCHED_OUT:
1703 gc1 = style->dark_gc[state_type];
1704 gc2 = style->light_gc[state_type];
1712 if ((width == -1) && (height == -1))
1713 gdk_window_get_size (window, &width, &height);
1714 else if (width == -1)
1715 gdk_window_get_size (window, &width, NULL);
1716 else if (height == -1)
1717 gdk_window_get_size (window, NULL, &height);
1719 half_width = width / 2;
1720 half_height = height / 2;
1724 gdk_gc_set_clip_rectangle (gc1, area);
1725 gdk_gc_set_clip_rectangle (gc2, area);
1728 gdk_gc_set_clip_rectangle (gc3, area);
1729 gdk_gc_set_clip_rectangle (gc4, area);
1738 points[0].x = x + half_width;
1741 points[1].y = y + height - 1;
1742 points[2].x = x + width - 1;
1743 points[2].y = y + height - 1;
1745 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
1748 switch (shadow_type)
1751 case GTK_SHADOW_OUT:
1753 gdk_draw_line (window, gc1,
1754 x + 1, y + height - 2,
1755 x + width - 2, y + height - 2);
1756 gdk_draw_line (window, gc3,
1757 x + 0, y + height - 1,
1758 x + width - 1, y + height - 1);
1760 gdk_draw_line (window, gc1,
1761 x + width - 2, y + height - 1,
1762 x + half_width, y + 1);
1763 gdk_draw_line (window, gc3,
1764 x + width - 1, y + height - 1,
1767 gdk_draw_line (window, gc4,
1768 x + half_width, y + 1,
1769 x + 1, y + height - 1);
1770 gdk_draw_line (window, gc2,
1775 case GTK_SHADOW_ETCHED_IN:
1776 case GTK_SHADOW_ETCHED_OUT:
1777 gdk_draw_line (window, gc1,
1778 x + half_width, y + 1,
1779 x + 1, y + height - 1);
1780 gdk_draw_line (window, gc1,
1781 x + 1, y + height - 1,
1782 x + width - 1, y + height - 1);
1783 gdk_draw_line (window, gc1,
1784 x + width - 1, y + height - 1,
1785 x + half_width + 1, y + 1);
1787 points[0].x = x + half_width;
1790 points[1].y = y + height - 2;
1791 points[2].x = x + width - 2;
1792 points[2].y = y + height - 2;
1794 gdk_draw_polygon (window, gc2, FALSE, points, 3);
1802 case GTK_ARROW_DOWN:
1805 points[0].x = x + width - 1;
1809 points[2].x = x + half_width;
1810 points[2].y = y + height - 1;
1812 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
1814 switch (shadow_type)
1817 case GTK_SHADOW_OUT:
1818 gdk_draw_line (window, gc4,
1820 y + 1, x + 1, y + 1);
1821 gdk_draw_line (window, gc2,
1825 gdk_draw_line (window, gc4,
1827 x + half_width, y + height - 2);
1828 gdk_draw_line (window, gc2,
1830 x + half_width, y + height - 1);
1832 gdk_draw_line (window, gc1,
1833 x + half_width, y + height - 2,
1835 gdk_draw_line (window, gc3,
1836 x + half_width, y + height - 1,
1840 case GTK_SHADOW_ETCHED_IN:
1841 case GTK_SHADOW_ETCHED_OUT:
1842 gdk_draw_line (window, gc1,
1843 x + width - 1, y + 1,
1845 gdk_draw_line (window, gc1,
1847 x + half_width + 1, y + height - 1);
1848 gdk_draw_line (window, gc1,
1849 x + half_width + 1, y + height - 2,
1852 points[0].x = x + width - 2;
1856 points[2].x = x + half_width;
1857 points[2].y = y + height - 2;
1859 gdk_draw_polygon (window, gc2, FALSE, points, 3);
1866 case GTK_ARROW_LEFT:
1870 points[0].y = y + half_height;
1871 points[1].x = x + width - 1;
1872 points[1].y = y + height - 1;
1873 points[2].x = x + width - 1;
1876 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
1879 switch (shadow_type)
1882 case GTK_SHADOW_OUT:
1883 gdk_draw_line (window, gc1,
1884 x + 1, y + half_height,
1885 x + width - 1, y + height - 1);
1886 gdk_draw_line (window, gc3,
1888 x + width - 1, y + height - 1);
1890 gdk_draw_line (window, gc1,
1891 x + width - 2, y + height - 1,
1892 x + width - 2, y + 1);
1893 gdk_draw_line (window, gc3,
1894 x + width - 1, y + height - 1,
1897 gdk_draw_line (window, gc4,
1898 x + width - 1, y + 1,
1899 x + 1, y + half_height);
1900 gdk_draw_line (window, gc2,
1902 x, y + half_height);
1905 case GTK_SHADOW_ETCHED_IN:
1906 case GTK_SHADOW_ETCHED_OUT:
1907 gdk_draw_line (window, gc1,
1908 x + width - 1, y + 1,
1909 x + 1, y + half_height);
1910 gdk_draw_line (window, gc1,
1911 x + 1, y + half_height + 1,
1912 x + width - 1, y + height - 1);
1913 gdk_draw_line (window, gc1,
1914 x + width - 1, y + height - 1,
1915 x + width - 1, y + 1);
1917 points[0].x = x + width - 2;
1920 points[1].y = y + half_height;
1921 points[2].x = x + width - 2;
1922 points[2].y = y + height - 2;
1924 gdk_draw_polygon (window, gc2, FALSE, points, 3);
1931 case GTK_ARROW_RIGHT:
1934 points[0].x = x + width - 1;
1935 points[0].y = y + half_height;
1939 points[2].y = y + height - 1;
1941 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
1944 switch (shadow_type)
1947 case GTK_SHADOW_OUT:
1948 gdk_draw_line (window, gc4,
1949 x + width - 1, y + half_height,
1951 gdk_draw_line (window, gc2,
1952 x + width - 1, y + half_height,
1954 gdk_draw_line (window, gc4,
1956 x + 1, y + height - 2);
1957 gdk_draw_line (window, gc2,
1961 gdk_draw_line (window, gc1,
1962 x + 1, y + height - 2,
1963 x + width - 1, y + half_height);
1964 gdk_draw_line (window, gc3,
1966 x + width - 1, y + half_height);
1969 case GTK_SHADOW_ETCHED_IN:
1970 case GTK_SHADOW_ETCHED_OUT:
1971 gdk_draw_line (window, gc1,
1972 x + width - 1, y + half_height + 1,
1974 gdk_draw_line (window, gc1,
1976 x + 1, y + height - 1);
1977 gdk_draw_line (window, gc1,
1978 x + 1, y + height - 1,
1979 x + width - 1, y + half_height + 1);
1981 points[0].x = x + width - 2;
1982 points[0].y = y + half_height;
1986 points[2].y = y + height - 1;
1988 gdk_draw_polygon (window, gc2, FALSE, points, 3);
1999 gdk_gc_set_clip_rectangle (gc1, NULL);
2000 gdk_gc_set_clip_rectangle (gc2, NULL);
2003 gdk_gc_set_clip_rectangle (gc3, NULL);
2004 gdk_gc_set_clip_rectangle (gc4, NULL);
2010 gtk_default_draw_diamond (GtkStyle *style,
2012 GtkStateType state_type,
2013 GtkShadowType shadow_type,
2016 const gchar *detail,
2025 g_return_if_fail (style != NULL);
2026 g_return_if_fail (window != NULL);
2028 if ((width == -1) && (height == -1))
2029 gdk_window_get_size (window, &width, &height);
2030 else if (width == -1)
2031 gdk_window_get_size (window, &width, NULL);
2032 else if (height == -1)
2033 gdk_window_get_size (window, NULL, &height);
2035 half_width = width / 2;
2036 half_height = height / 2;
2040 gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
2041 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
2042 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
2043 gdk_gc_set_clip_rectangle (style->black_gc, area);
2045 switch (shadow_type)
2048 gdk_draw_line (window, style->bg_gc[state_type],
2049 x + 2, y + half_height,
2050 x + half_width, y + height - 2);
2051 gdk_draw_line (window, style->bg_gc[state_type],
2052 x + half_width, y + height - 2,
2053 x + width - 2, y + half_height);
2054 gdk_draw_line (window, style->light_gc[state_type],
2055 x + 1, y + half_height,
2056 x + half_width, y + height - 1);
2057 gdk_draw_line (window, style->light_gc[state_type],
2058 x + half_width, y + height - 1,
2059 x + width - 1, y + half_height);
2060 gdk_draw_line (window, style->light_gc[state_type],
2062 x + half_width, y + height);
2063 gdk_draw_line (window, style->light_gc[state_type],
2064 x + half_width, y + height,
2065 x + width, y + half_height);
2067 gdk_draw_line (window, style->black_gc,
2068 x + 2, y + half_height,
2069 x + half_width, y + 2);
2070 gdk_draw_line (window, style->black_gc,
2071 x + half_width, y + 2,
2072 x + width - 2, y + half_height);
2073 gdk_draw_line (window, style->dark_gc[state_type],
2074 x + 1, y + half_height,
2075 x + half_width, y + 1);
2076 gdk_draw_line (window, style->dark_gc[state_type],
2077 x + half_width, y + 1,
2078 x + width - 1, y + half_height);
2079 gdk_draw_line (window, style->dark_gc[state_type],
2082 gdk_draw_line (window, style->dark_gc[state_type],
2084 x + width, y + half_height);
2086 case GTK_SHADOW_OUT:
2087 gdk_draw_line (window, style->dark_gc[state_type],
2088 x + 2, y + half_height,
2089 x + half_width, y + height - 2);
2090 gdk_draw_line (window, style->dark_gc[state_type],
2091 x + half_width, y + height - 2,
2092 x + width - 2, y + half_height);
2093 gdk_draw_line (window, style->dark_gc[state_type],
2094 x + 1, y + half_height,
2095 x + half_width, y + height - 1);
2096 gdk_draw_line (window, style->dark_gc[state_type],
2097 x + half_width, y + height - 1,
2098 x + width - 1, y + half_height);
2099 gdk_draw_line (window, style->black_gc,
2101 x + half_width, y + height);
2102 gdk_draw_line (window, style->black_gc,
2103 x + half_width, y + height,
2104 x + width, y + half_height);
2106 gdk_draw_line (window, style->bg_gc[state_type],
2107 x + 2, y + half_height,
2108 x + half_width, y + 2);
2109 gdk_draw_line (window, style->bg_gc[state_type],
2110 x + half_width, y + 2,
2111 x + width - 2, y + half_height);
2112 gdk_draw_line (window, style->light_gc[state_type],
2113 x + 1, y + half_height,
2114 x + half_width, y + 1);
2115 gdk_draw_line (window, style->light_gc[state_type],
2116 x + half_width, y + 1,
2117 x + width - 1, y + half_height);
2118 gdk_draw_line (window, style->light_gc[state_type],
2121 gdk_draw_line (window, style->light_gc[state_type],
2123 x + width, y + half_height);
2130 gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
2131 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
2132 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
2133 gdk_gc_set_clip_rectangle (style->black_gc, NULL);
2138 gtk_default_draw_oval (GtkStyle *style,
2140 GtkStateType state_type,
2141 GtkShadowType shadow_type,
2144 const gchar *detail,
2150 g_return_if_fail (style != NULL);
2151 g_return_if_fail (window != NULL);
2153 g_warning ("gtk_default_draw_oval(): FIXME, this function is currently unimplemented");
2157 gtk_default_draw_string (GtkStyle *style,
2159 GtkStateType state_type,
2162 const gchar *detail,
2165 const gchar *string)
2167 g_return_if_fail (style != NULL);
2168 g_return_if_fail (window != NULL);
2172 gdk_gc_set_clip_rectangle (style->white_gc, area);
2173 gdk_gc_set_clip_rectangle (style->fg_gc[state_type], area);
2176 if (state_type == GTK_STATE_INSENSITIVE)
2177 gdk_draw_string (window, style->font, style->white_gc, x + 1, y + 1, string);
2179 gdk_draw_string (window, style->font, style->fg_gc[state_type], x, y, string);
2183 gdk_gc_set_clip_rectangle (style->white_gc, NULL);
2184 gdk_gc_set_clip_rectangle (style->fg_gc[state_type], NULL);
2189 gtk_default_draw_box (GtkStyle *style,
2191 GtkStateType state_type,
2192 GtkShadowType shadow_type,
2195 const gchar *detail,
2201 g_return_if_fail (style != NULL);
2202 g_return_if_fail (window != NULL);
2204 if (width == -1 && height == -1)
2205 gdk_window_get_size (window, &width, &height);
2206 else if (width == -1)
2207 gdk_window_get_size (window, &width, NULL);
2208 else if (height == -1)
2209 gdk_window_get_size (window, NULL, &height);
2211 if (!style->bg_pixmap[state_type] ||
2212 GDK_IS_PIXMAP (window))
2215 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
2217 gdk_draw_rectangle (window, style->bg_gc[state_type], TRUE,
2218 x, y, width, height);
2220 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
2223 gtk_style_apply_default_background (style, window,
2224 widget && !GTK_WIDGET_NO_WINDOW (widget),
2225 state_type, area, x, y, width, height);
2227 gtk_paint_shadow (style, window, state_type, shadow_type, area, widget, detail,
2228 x, y, width, height);
2232 gtk_default_draw_flat_box (GtkStyle *style,
2234 GtkStateType state_type,
2235 GtkShadowType shadow_type,
2238 const gchar *detail,
2246 g_return_if_fail (style != NULL);
2247 g_return_if_fail (window != NULL);
2249 if (width == -1 && height == -1)
2250 gdk_window_get_size (window, &width, &height);
2251 else if (width == -1)
2252 gdk_window_get_size (window, &width, NULL);
2253 else if (height == -1)
2254 gdk_window_get_size (window, NULL, &height);
2258 if (!strcmp ("text", detail) && state_type == GTK_STATE_SELECTED)
2259 gc1 = style->bg_gc[GTK_STATE_SELECTED];
2260 else if (!strcmp ("viewportbin", detail))
2261 gc1 = style->bg_gc[GTK_STATE_NORMAL];
2262 else if (!strcmp ("entry_bg", detail))
2263 gc1 = style->base_gc[state_type];
2265 gc1 = style->bg_gc[state_type];
2268 gc1 = style->bg_gc[state_type];
2270 if (!style->bg_pixmap[state_type] || gc1 != style->bg_gc[state_type] ||
2271 GDK_IS_PIXMAP (window))
2274 gdk_gc_set_clip_rectangle (gc1, area);
2276 gdk_draw_rectangle (window, gc1, TRUE,
2277 x, y, width, height);
2279 if (detail && !strcmp ("tooltip", detail))
2280 gdk_draw_rectangle (window, style->black_gc, FALSE,
2281 x, y, width - 1, height - 1);
2284 gdk_gc_set_clip_rectangle (gc1, NULL);
2287 gtk_style_apply_default_background (style, window,
2288 widget && !GTK_WIDGET_NO_WINDOW (widget),
2289 state_type, area, x, y, width, height);
2293 gtk_default_draw_check (GtkStyle *style,
2295 GtkStateType state_type,
2296 GtkShadowType shadow_type,
2299 const gchar *detail,
2305 gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail,
2306 x, y, width, height);
2310 gtk_default_draw_option (GtkStyle *style,
2312 GtkStateType state_type,
2313 GtkShadowType shadow_type,
2316 const gchar *detail,
2322 gtk_paint_diamond (style, window, state_type, shadow_type, area, widget,
2323 detail, x, y, width, height);
2327 gtk_default_draw_cross (GtkStyle *style,
2329 GtkStateType state_type,
2330 GtkShadowType shadow_type,
2333 const gchar *detail,
2339 g_return_if_fail (style != NULL);
2340 g_return_if_fail (window != NULL);
2342 g_warning ("gtk_default_draw_cross(): FIXME, this function is currently unimplemented");
2346 gtk_default_draw_ramp (GtkStyle *style,
2348 GtkStateType state_type,
2349 GtkShadowType shadow_type,
2352 const gchar *detail,
2353 GtkArrowType arrow_type,
2359 g_return_if_fail (style != NULL);
2360 g_return_if_fail (window != NULL);
2362 g_warning ("gtk_default_draw_ramp(): FIXME, this function is currently unimplemented");
2366 gtk_default_draw_tab (GtkStyle *style,
2368 GtkStateType state_type,
2369 GtkShadowType shadow_type,
2372 const gchar *detail,
2378 g_return_if_fail (style != NULL);
2379 g_return_if_fail (window != NULL);
2381 gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail,
2382 x, y, width, height);
2386 gtk_default_draw_shadow_gap (GtkStyle *style,
2388 GtkStateType state_type,
2389 GtkShadowType shadow_type,
2392 const gchar *detail,
2397 GtkPositionType gap_side,
2406 g_return_if_fail (style != NULL);
2407 g_return_if_fail (window != NULL);
2409 if (width == -1 && height == -1)
2410 gdk_window_get_size (window, &width, &height);
2411 else if (width == -1)
2412 gdk_window_get_size (window, &width, NULL);
2413 else if (height == -1)
2414 gdk_window_get_size (window, NULL, &height);
2416 switch (shadow_type)
2418 case GTK_SHADOW_NONE:
2421 gc1 = style->dark_gc[state_type];
2422 gc2 = style->black_gc;
2423 gc3 = style->bg_gc[state_type];
2424 gc4 = style->light_gc[state_type];
2426 case GTK_SHADOW_ETCHED_IN:
2427 gc1 = style->dark_gc[state_type];
2428 gc2 = style->light_gc[state_type];
2429 gc3 = style->dark_gc[state_type];
2430 gc4 = style->light_gc[state_type];
2432 case GTK_SHADOW_OUT:
2433 gc1 = style->light_gc[state_type];
2434 gc2 = style->bg_gc[state_type];
2435 gc3 = style->dark_gc[state_type];
2436 gc4 = style->black_gc;
2438 case GTK_SHADOW_ETCHED_OUT:
2439 gc1 = style->light_gc[state_type];
2440 gc2 = style->dark_gc[state_type];
2441 gc3 = style->light_gc[state_type];
2442 gc4 = style->dark_gc[state_type];
2447 gdk_gc_set_clip_rectangle (gc1, area);
2448 gdk_gc_set_clip_rectangle (gc2, area);
2449 gdk_gc_set_clip_rectangle (gc3, area);
2450 gdk_gc_set_clip_rectangle (gc4, area);
2453 switch (shadow_type)
2455 case GTK_SHADOW_NONE:
2457 case GTK_SHADOW_OUT:
2458 case GTK_SHADOW_ETCHED_IN:
2459 case GTK_SHADOW_ETCHED_OUT:
2463 gdk_draw_line (window, gc1,
2464 x, y, x, y + height - 1);
2465 gdk_draw_line (window, gc2,
2466 x + 1, y, x + 1, y + height - 2);
2468 gdk_draw_line (window, gc3,
2469 x + 1, y + height - 2, x + width - 2, y + height - 2);
2470 gdk_draw_line (window, gc3,
2471 x + width - 2, y, x + width - 2, y + height - 2);
2472 gdk_draw_line (window, gc4,
2473 x, y + height - 1, x + width - 1, y + height - 1);
2474 gdk_draw_line (window, gc4,
2475 x + width - 1, y, x + width - 1, y + height - 1);
2478 gdk_draw_line (window, gc1,
2479 x, y, x + gap_x - 1, y);
2480 gdk_draw_line (window, gc2,
2481 x + 1, y + 1, x + gap_x - 1, y + 1);
2482 gdk_draw_line (window, gc2,
2483 x + gap_x, y, x + gap_x, y);
2485 if ((width - (gap_x + gap_width)) > 0)
2487 gdk_draw_line (window, gc1,
2488 x + gap_x + gap_width, y, x + width - 2, y);
2489 gdk_draw_line (window, gc2,
2490 x + gap_x + gap_width, y + 1, x + width - 2, y + 1);
2491 gdk_draw_line (window, gc2,
2492 x + gap_x + gap_width - 1, y, x + gap_x + gap_width - 1, y);
2495 case GTK_POS_BOTTOM:
2496 gdk_draw_line (window, gc1,
2497 x, y, x + width - 1, y);
2498 gdk_draw_line (window, gc1,
2499 x, y, x, y + height - 1);
2500 gdk_draw_line (window, gc2,
2501 x + 1, y + 1, x + width - 2, y + 1);
2502 gdk_draw_line (window, gc2,
2503 x + 1, y + 1, x + 1, y + height - 1);
2505 gdk_draw_line (window, gc3,
2506 x + width - 2, y + 1, x + width - 2, y + height - 1);
2507 gdk_draw_line (window, gc4,
2508 x + width - 1, y, x + width - 1, y + height - 1);
2511 gdk_draw_line (window, gc4,
2512 x, y + height - 1, x + gap_x - 1, y + height - 1);
2513 gdk_draw_line (window, gc3,
2514 x + 1, y + height - 2, x + gap_x - 1, y + height - 2);
2515 gdk_draw_line (window, gc3,
2516 x + gap_x, y + height - 1, x + gap_x, y + height - 1);
2518 if ((width - (gap_x + gap_width)) > 0)
2520 gdk_draw_line (window, gc4,
2521 x + gap_x + gap_width, y + height - 1, x + width - 2, y + height - 1);
2522 gdk_draw_line (window, gc3,
2523 x + gap_x + gap_width, y + height - 2, x + width - 2, y + height - 2);
2524 gdk_draw_line (window, gc3,
2525 x + gap_x + gap_width - 1, y + height - 1, x + gap_x + gap_width - 1, y + height - 1);
2529 gdk_draw_line (window, gc1,
2530 x, y, x + width - 1, y);
2531 gdk_draw_line (window, gc2,
2532 x, y + 1, x + width - 2, y + 1);
2534 gdk_draw_line (window, gc3,
2535 x, y + height - 2, x + width - 2, y + height - 2);
2536 gdk_draw_line (window, gc3,
2537 x + width - 2, y + 1, x + width - 2, y + height - 2);
2538 gdk_draw_line (window, gc4,
2539 x, y + height - 1, x + width - 1, y + height - 1);
2540 gdk_draw_line (window, gc4,
2541 x + width - 1, y, x + width - 1, y + height - 1);
2544 gdk_draw_line (window, gc1,
2545 x, y, x, y + gap_x - 1);
2546 gdk_draw_line (window, gc2,
2547 x + 1, y + 1, x + 1, y + gap_x - 1);
2548 gdk_draw_line (window, gc2,
2549 x, y + gap_x, x, y + gap_x);
2551 if ((width - (gap_x + gap_width)) > 0)
2553 gdk_draw_line (window, gc1,
2554 x, y + gap_x + gap_width, x, y + height - 2);
2555 gdk_draw_line (window, gc2,
2556 x + 1, y + gap_x + gap_width, x + 1, y + height - 2);
2557 gdk_draw_line (window, gc2,
2558 x, y + gap_x + gap_width - 1, x, y + gap_x + gap_width - 1);
2562 gdk_draw_line (window, gc1,
2563 x, y, x + width - 1, y);
2564 gdk_draw_line (window, gc1,
2565 x, y, x, y + height - 1);
2566 gdk_draw_line (window, gc2,
2567 x + 1, y + 1, x + width - 1, y + 1);
2568 gdk_draw_line (window, gc2,
2569 x + 1, y + 1, x + 1, y + height - 2);
2571 gdk_draw_line (window, gc3,
2572 x + 1, y + height - 2, x + width - 1, y + height - 2);
2573 gdk_draw_line (window, gc4,
2574 x, y + height - 1, x + width - 1, y + height - 1);
2577 gdk_draw_line (window, gc4,
2578 x + width - 1, y, x + width - 1, y + gap_x - 1);
2579 gdk_draw_line (window, gc3,
2580 x + width - 2, y + 1, x + width - 2, y + gap_x - 1);
2581 gdk_draw_line (window, gc3,
2582 x + width - 1, y + gap_x, x + width - 1, y + gap_x);
2584 if ((width - (gap_x + gap_width)) > 0)
2586 gdk_draw_line (window, gc4,
2587 x + width - 1, y + gap_x + gap_width, x + width - 1, y + height - 2);
2588 gdk_draw_line (window, gc3,
2589 x + width - 2, y + gap_x + gap_width, x + width - 2, y + height - 2);
2590 gdk_draw_line (window, gc3,
2591 x + width - 1, y + gap_x + gap_width - 1, x + width - 1, y + gap_x + gap_width - 1);
2599 gdk_gc_set_clip_rectangle (gc1, NULL);
2600 gdk_gc_set_clip_rectangle (gc2, NULL);
2601 gdk_gc_set_clip_rectangle (gc3, NULL);
2602 gdk_gc_set_clip_rectangle (gc4, NULL);
2607 gtk_default_draw_box_gap (GtkStyle *style,
2609 GtkStateType state_type,
2610 GtkShadowType shadow_type,
2613 const gchar *detail,
2618 GtkPositionType gap_side,
2627 g_return_if_fail (style != NULL);
2628 g_return_if_fail (window != NULL);
2630 gtk_style_apply_default_background (style, window,
2631 widget && !GTK_WIDGET_NO_WINDOW (widget),
2632 state_type, area, x, y, width, height);
2634 if (width == -1 && height == -1)
2635 gdk_window_get_size (window, &width, &height);
2636 else if (width == -1)
2637 gdk_window_get_size (window, &width, NULL);
2638 else if (height == -1)
2639 gdk_window_get_size (window, NULL, &height);
2641 switch (shadow_type)
2643 case GTK_SHADOW_NONE:
2646 gc1 = style->dark_gc[state_type];
2647 gc2 = style->black_gc;
2648 gc3 = style->bg_gc[state_type];
2649 gc4 = style->light_gc[state_type];
2651 case GTK_SHADOW_ETCHED_IN:
2652 gc1 = style->dark_gc[state_type];
2653 gc2 = style->light_gc[state_type];
2654 gc3 = style->dark_gc[state_type];
2655 gc4 = style->light_gc[state_type];
2657 case GTK_SHADOW_OUT:
2658 gc1 = style->light_gc[state_type];
2659 gc2 = style->bg_gc[state_type];
2660 gc3 = style->dark_gc[state_type];
2661 gc4 = style->black_gc;
2663 case GTK_SHADOW_ETCHED_OUT:
2664 gc1 = style->light_gc[state_type];
2665 gc2 = style->dark_gc[state_type];
2666 gc3 = style->light_gc[state_type];
2667 gc4 = style->dark_gc[state_type];
2673 gdk_gc_set_clip_rectangle (gc1, area);
2674 gdk_gc_set_clip_rectangle (gc2, area);
2675 gdk_gc_set_clip_rectangle (gc3, area);
2676 gdk_gc_set_clip_rectangle (gc4, area);
2679 switch (shadow_type)
2681 case GTK_SHADOW_NONE:
2683 case GTK_SHADOW_OUT:
2684 case GTK_SHADOW_ETCHED_IN:
2685 case GTK_SHADOW_ETCHED_OUT:
2689 gdk_draw_line (window, gc1,
2690 x, y, x, y + height - 1);
2691 gdk_draw_line (window, gc2,
2692 x + 1, y, x + 1, y + height - 2);
2694 gdk_draw_line (window, gc3,
2695 x + 1, y + height - 2, x + width - 2, y + height - 2);
2696 gdk_draw_line (window, gc3,
2697 x + width - 2, y, x + width - 2, y + height - 2);
2698 gdk_draw_line (window, gc4,
2699 x, y + height - 1, x + width - 1, y + height - 1);
2700 gdk_draw_line (window, gc4,
2701 x + width - 1, y, x + width - 1, y + height - 1);
2704 gdk_draw_line (window, gc1,
2705 x, y, x + gap_x - 1, y);
2706 gdk_draw_line (window, gc2,
2707 x + 1, y + 1, x + gap_x - 1, y + 1);
2708 gdk_draw_line (window, gc2,
2709 x + gap_x, y, x + gap_x, y);
2711 if ((width - (gap_x + gap_width)) > 0)
2713 gdk_draw_line (window, gc1,
2714 x + gap_x + gap_width, y, x + width - 2, y);
2715 gdk_draw_line (window, gc2,
2716 x + gap_x + gap_width, y + 1, x + width - 2, y + 1);
2717 gdk_draw_line (window, gc2,
2718 x + gap_x + gap_width - 1, y, x + gap_x + gap_width - 1, y);
2721 case GTK_POS_BOTTOM:
2722 gdk_draw_line (window, gc1,
2723 x, y, x + width - 1, y);
2724 gdk_draw_line (window, gc1,
2725 x, y, x, y + height - 1);
2726 gdk_draw_line (window, gc2,
2727 x + 1, y + 1, x + width - 2, y + 1);
2728 gdk_draw_line (window, gc2,
2729 x + 1, y + 1, x + 1, y + height - 1);
2731 gdk_draw_line (window, gc3,
2732 x + width - 2, y + 1, x + width - 2, y + height - 1);
2733 gdk_draw_line (window, gc4,
2734 x + width - 1, y, x + width - 1, y + height - 1);
2737 gdk_draw_line (window, gc4,
2738 x, y + height - 1, x + gap_x - 1, y + height - 1);
2739 gdk_draw_line (window, gc3,
2740 x + 1, y + height - 2, x + gap_x - 1, y + height - 2);
2741 gdk_draw_line (window, gc3,
2742 x + gap_x, y + height - 1, x + gap_x, y + height - 1);
2744 if ((width - (gap_x + gap_width)) > 0)
2746 gdk_draw_line (window, gc4,
2747 x + gap_x + gap_width, y + height - 1, x + width - 2, y + height - 1);
2748 gdk_draw_line (window, gc3,
2749 x + gap_x + gap_width, y + height - 2, x + width - 2, y + height - 2);
2750 gdk_draw_line (window, gc3,
2751 x + gap_x + gap_width - 1, y + height - 1, x + gap_x + gap_width - 1, y + height - 1);
2755 gdk_draw_line (window, gc1,
2756 x, y, x + width - 1, y);
2757 gdk_draw_line (window, gc2,
2758 x, y + 1, x + width - 2, y + 1);
2760 gdk_draw_line (window, gc3,
2761 x, y + height - 2, x + width - 2, y + height - 2);
2762 gdk_draw_line (window, gc3,
2763 x + width - 2, y + 1, x + width - 2, y + height - 2);
2764 gdk_draw_line (window, gc4,
2765 x, y + height - 1, x + width - 1, y + height - 1);
2766 gdk_draw_line (window, gc4,
2767 x + width - 1, y, x + width - 1, y + height - 1);
2770 gdk_draw_line (window, gc1,
2771 x, y, x, y + gap_x - 1);
2772 gdk_draw_line (window, gc2,
2773 x + 1, y + 1, x + 1, y + gap_x - 1);
2774 gdk_draw_line (window, gc2,
2775 x, y + gap_x, x, y + gap_x);
2777 if ((width - (gap_x + gap_width)) > 0)
2779 gdk_draw_line (window, gc1,
2780 x, y + gap_x + gap_width, x, y + height - 2);
2781 gdk_draw_line (window, gc2,
2782 x + 1, y + gap_x + gap_width, x + 1, y + height - 2);
2783 gdk_draw_line (window, gc2,
2784 x, y + gap_x + gap_width - 1, x, y + gap_x + gap_width - 1);
2788 gdk_draw_line (window, gc1,
2789 x, y, x + width - 1, y);
2790 gdk_draw_line (window, gc1,
2791 x, y, x, y + height - 1);
2792 gdk_draw_line (window, gc2,
2793 x + 1, y + 1, x + width - 1, y + 1);
2794 gdk_draw_line (window, gc2,
2795 x + 1, y + 1, x + 1, y + height - 2);
2797 gdk_draw_line (window, gc3,
2798 x + 1, y + height - 2, x + width - 1, y + height - 2);
2799 gdk_draw_line (window, gc4,
2800 x, y + height - 1, x + width - 1, y + height - 1);
2803 gdk_draw_line (window, gc4,
2804 x + width - 1, y, x + width - 1, y + gap_x - 1);
2805 gdk_draw_line (window, gc3,
2806 x + width - 2, y + 1, x + width - 2, y + gap_x - 1);
2807 gdk_draw_line (window, gc3,
2808 x + width - 1, y + gap_x, x + width - 1, y + gap_x);
2810 if ((width - (gap_x + gap_width)) > 0)
2812 gdk_draw_line (window, gc4,
2813 x + width - 1, y + gap_x + gap_width, x + width - 1, y + height - 2);
2814 gdk_draw_line (window, gc3,
2815 x + width - 2, y + gap_x + gap_width, x + width - 2, y + height - 2);
2816 gdk_draw_line (window, gc3,
2817 x + width - 1, y + gap_x + gap_width - 1, x + width - 1, y + gap_x + gap_width - 1);
2825 gdk_gc_set_clip_rectangle (gc1, NULL);
2826 gdk_gc_set_clip_rectangle (gc2, NULL);
2827 gdk_gc_set_clip_rectangle (gc3, NULL);
2828 gdk_gc_set_clip_rectangle (gc4, NULL);
2833 gtk_default_draw_extension (GtkStyle *style,
2835 GtkStateType state_type,
2836 GtkShadowType shadow_type,
2839 const gchar *detail,
2844 GtkPositionType gap_side)
2851 g_return_if_fail (style != NULL);
2852 g_return_if_fail (window != NULL);
2854 gtk_style_apply_default_background (style, window,
2855 widget && !GTK_WIDGET_NO_WINDOW (widget),
2856 GTK_STATE_NORMAL, area, x, y, width, height);
2858 if (width == -1 && height == -1)
2859 gdk_window_get_size (window, &width, &height);
2860 else if (width == -1)
2861 gdk_window_get_size (window, &width, NULL);
2862 else if (height == -1)
2863 gdk_window_get_size (window, NULL, &height);
2865 switch (shadow_type)
2867 case GTK_SHADOW_NONE:
2870 gc1 = style->dark_gc[state_type];
2871 gc2 = style->black_gc;
2872 gc3 = style->bg_gc[state_type];
2873 gc4 = style->light_gc[state_type];
2875 case GTK_SHADOW_ETCHED_IN:
2876 gc1 = style->dark_gc[state_type];
2877 gc2 = style->light_gc[state_type];
2878 gc3 = style->dark_gc[state_type];
2879 gc4 = style->light_gc[state_type];
2881 case GTK_SHADOW_OUT:
2882 gc1 = style->light_gc[state_type];
2883 gc2 = style->bg_gc[state_type];
2884 gc3 = style->dark_gc[state_type];
2885 gc4 = style->black_gc;
2887 case GTK_SHADOW_ETCHED_OUT:
2888 gc1 = style->light_gc[state_type];
2889 gc2 = style->dark_gc[state_type];
2890 gc3 = style->light_gc[state_type];
2891 gc4 = style->dark_gc[state_type];
2897 gdk_gc_set_clip_rectangle (gc1, area);
2898 gdk_gc_set_clip_rectangle (gc2, area);
2899 gdk_gc_set_clip_rectangle (gc3, area);
2900 gdk_gc_set_clip_rectangle (gc4, area);
2903 switch (shadow_type)
2905 case GTK_SHADOW_NONE:
2907 case GTK_SHADOW_OUT:
2908 case GTK_SHADOW_ETCHED_IN:
2909 case GTK_SHADOW_ETCHED_OUT:
2913 gtk_style_apply_default_background (style, window,
2914 widget && !GTK_WIDGET_NO_WINDOW (widget),
2916 x + style->xthickness,
2918 width - (2 * style->xthickness),
2919 height - (style->ythickness));
2920 gdk_draw_line (window, gc1,
2921 x, y, x, y + height - 2);
2922 gdk_draw_line (window, gc2,
2923 x + 1, y, x + 1, y + height - 2);
2925 gdk_draw_line (window, gc3,
2926 x + 2, y + height - 2, x + width - 2, y + height - 2);
2927 gdk_draw_line (window, gc3,
2928 x + width - 2, y, x + width - 2, y + height - 2);
2929 gdk_draw_line (window, gc4,
2930 x + 1, y + height - 1, x + width - 2, y + height - 1);
2931 gdk_draw_line (window, gc4,
2932 x + width - 1, y, x + width - 1, y + height - 2);
2934 case GTK_POS_BOTTOM:
2935 gtk_style_apply_default_background (style, window,
2936 widget && !GTK_WIDGET_NO_WINDOW (widget),
2938 x + style->xthickness,
2939 y + style->ythickness,
2940 width - (2 * style->xthickness),
2941 height - (style->ythickness));
2942 gdk_draw_line (window, gc1,
2943 x + 1, y, x + width - 2, y);
2944 gdk_draw_line (window, gc1,
2945 x, y + 1, x, y + height - 1);
2946 gdk_draw_line (window, gc2,
2947 x + 1, y + 1, x + width - 2, y + 1);
2948 gdk_draw_line (window, gc2,
2949 x + 1, y + 1, x + 1, y + height - 1);
2951 gdk_draw_line (window, gc3,
2952 x + width - 2, y + 2, x + width - 2, y + height - 1);
2953 gdk_draw_line (window, gc4,
2954 x + width - 1, y + 1, x + width - 1, y + height - 1);
2957 gtk_style_apply_default_background (style, window,
2958 widget && !GTK_WIDGET_NO_WINDOW (widget),
2961 y + style->ythickness,
2962 width - (style->xthickness),
2963 height - (2 * style->ythickness));
2964 gdk_draw_line (window, gc1,
2965 x, y, x + width - 2, y);
2966 gdk_draw_line (window, gc2,
2967 x + 1, y + 1, x + width - 2, y + 1);
2969 gdk_draw_line (window, gc3,
2970 x, y + height - 2, x + width - 2, y + height - 2);
2971 gdk_draw_line (window, gc3,
2972 x + width - 2, y + 2, x + width - 2, y + height - 2);
2973 gdk_draw_line (window, gc4,
2974 x, y + height - 1, x + width - 2, y + height - 1);
2975 gdk_draw_line (window, gc4,
2976 x + width - 1, y + 1, x + width - 1, y + height - 2);
2979 gtk_style_apply_default_background (style, window,
2980 widget && !GTK_WIDGET_NO_WINDOW (widget),
2982 x + style->xthickness,
2983 y + style->ythickness,
2984 width - (style->xthickness),
2985 height - (2 * style->ythickness));
2986 gdk_draw_line (window, gc1,
2987 x + 1, y, x + width - 1, y);
2988 gdk_draw_line (window, gc1,
2989 x, y + 1, x, y + height - 2);
2990 gdk_draw_line (window, gc2,
2991 x + 1, y + 1, x + width - 1, y + 1);
2992 gdk_draw_line (window, gc2,
2993 x + 1, y + 1, x + 1, y + height - 2);
2995 gdk_draw_line (window, gc3,
2996 x + 2, y + height - 2, x + width - 1, y + height - 2);
2997 gdk_draw_line (window, gc4,
2998 x + 1, y + height - 1, x + width - 1, y + height - 1);
3005 gdk_gc_set_clip_rectangle (gc1, NULL);
3006 gdk_gc_set_clip_rectangle (gc2, NULL);
3007 gdk_gc_set_clip_rectangle (gc3, NULL);
3008 gdk_gc_set_clip_rectangle (gc4, NULL);
3013 gtk_default_draw_focus (GtkStyle *style,
3017 const gchar *detail,
3023 g_return_if_fail (style != NULL);
3024 g_return_if_fail (window != NULL);
3026 if (width == -1 && height == -1)
3028 gdk_window_get_size (window, &width, &height);
3032 else if (width == -1)
3034 gdk_window_get_size (window, &width, NULL);
3037 else if (height == -1)
3039 gdk_window_get_size (window, NULL, &height);
3044 gdk_gc_set_clip_rectangle (style->black_gc, area);
3046 if (detail && !strcmp (detail, "add-mode"))
3048 gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_ON_OFF_DASH, 0, 0);
3049 gdk_gc_set_dashes (style->black_gc, 0, "\4\4", 2);
3051 gdk_draw_rectangle (window,
3052 style->black_gc, FALSE,
3053 x, y, width, height);
3055 gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_SOLID, 0, 0);
3059 gdk_draw_rectangle (window,
3060 style->black_gc, FALSE,
3061 x, y, width, height);
3065 gdk_gc_set_clip_rectangle (style->black_gc, NULL);
3069 gtk_default_draw_slider (GtkStyle *style,
3071 GtkStateType state_type,
3072 GtkShadowType shadow_type,
3075 const gchar *detail,
3080 GtkOrientation orientation)
3082 g_return_if_fail (style != NULL);
3083 g_return_if_fail (window != NULL);
3085 if (width == -1 && height == -1)
3086 gdk_window_get_size (window, &width, &height);
3087 else if (width == -1)
3088 gdk_window_get_size (window, &width, NULL);
3089 else if (height == -1)
3090 gdk_window_get_size (window, NULL, &height);
3092 gtk_paint_box (style, window, state_type, shadow_type,
3093 area, widget, detail, x, y, width, height);
3095 if (orientation == GTK_ORIENTATION_HORIZONTAL)
3096 gtk_paint_vline (style, window, state_type, area, widget, detail,
3098 height - style->ythickness - 1, width / 2);
3100 gtk_paint_hline (style, window, state_type, area, widget, detail,
3102 width - style->xthickness - 1, height / 2);
3106 draw_dot (GdkWindow *window,
3114 size = CLAMP (size, 2, 3);
3118 gdk_draw_point (window, light_gc, x, y);
3119 gdk_draw_point (window, light_gc, x+1, y+1);
3121 else if (size == 3);
3123 gdk_draw_point (window, light_gc, x, y);
3124 gdk_draw_point (window, light_gc, x+1, y);
3125 gdk_draw_point (window, light_gc, x, y+1);
3126 gdk_draw_point (window, dark_gc, x+1, y+2);
3127 gdk_draw_point (window, dark_gc, x+2, y+1);
3128 gdk_draw_point (window, dark_gc, x+2, y+2);
3133 gtk_default_draw_handle (GtkStyle *style,
3135 GtkStateType state_type,
3136 GtkShadowType shadow_type,
3139 const gchar *detail,
3144 GtkOrientation orientation)
3147 gint xthick, ythick;
3148 GdkGC *light_gc, *dark_gc;
3153 g_return_if_fail (style != NULL);
3154 g_return_if_fail (window != NULL);
3156 if (width == -1 && height == -1)
3157 gdk_window_get_size (window, &width, &height);
3158 else if (width == -1)
3159 gdk_window_get_size (window, &width, NULL);
3160 else if (height == -1)
3161 gdk_window_get_size (window, NULL, &height);
3163 gtk_paint_box (style, window, state_type, shadow_type, area, widget,
3164 detail, x, y, width, height);
3167 if (!strcmp (detail, "paned"))
3169 /* we want to ignore the shadow border in paned widgets */
3173 light_gc = style->light_gc[state_type];
3174 dark_gc = style->black_gc;
3178 xthick = style->xthickness;
3179 ythick = style->ythickness;
3181 light_gc = style->light_gc[state_type];
3182 dark_gc = style->dark_gc[state_type];
3185 rect.x = x + xthick;
3186 rect.y = y + ythick;
3187 rect.width = width - (xthick * 2);
3188 rect.height = height - (ythick * 2);
3191 intersect = gdk_rectangle_intersect (area, &rect, &dest);
3201 gdk_gc_set_clip_rectangle (light_gc, &dest);
3202 gdk_gc_set_clip_rectangle (dark_gc, &dest);
3204 if (!strcmp (detail, "paned"))
3209 gdk_window_get_size (window, &window_width, &window_height);
3211 if (orientation == GTK_ORIENTATION_HORIZONTAL)
3212 for (xx = window_width/2 - 15; xx <= window_width/2 + 15; xx += 5)
3213 draw_dot (window, light_gc, dark_gc, xx, window_height/2 - 1, 3);
3215 for (yy = window_height/2 - 15; yy <= window_height/2 + 15; yy += 5)
3216 draw_dot (window, light_gc, dark_gc, window_width/2 - 1, yy, 3);
3220 for (yy = y + ythick; yy < (y + height - ythick); yy += 3)
3221 for (xx = x + xthick; xx < (x + width - xthick); xx += 6)
3223 draw_dot (window, light_gc, dark_gc, xx, yy, 2);
3224 draw_dot (window, light_gc, dark_gc, xx + 3, yy + 1, 2);
3228 gdk_gc_set_clip_rectangle (light_gc, NULL);
3229 gdk_gc_set_clip_rectangle (dark_gc, NULL);
3233 gtk_style_shade (GdkColor *a,
3241 red = (gdouble) a->red / 65535.0;
3242 green = (gdouble) a->green / 65535.0;
3243 blue = (gdouble) a->blue / 65535.0;
3245 rgb_to_hls (&red, &green, &blue);
3250 else if (green < 0.0)
3256 else if (blue < 0.0)
3259 hls_to_rgb (&red, &green, &blue);
3261 b->red = red * 65535.0;
3262 b->green = green * 65535.0;
3263 b->blue = blue * 65535.0;
3267 rgb_to_hls (gdouble *r,
3308 l = (max + min) / 2;
3315 s = (max - min) / (max + min);
3317 s = (max - min) / (2 - max - min);
3321 h = (green - blue) / delta;
3322 else if (green == max)
3323 h = 2 + (blue - red) / delta;
3324 else if (blue == max)
3325 h = 4 + (red - green) / delta;
3338 hls_to_rgb (gdouble *h,
3351 if (lightness <= 0.5)
3352 m2 = lightness * (1 + saturation);
3354 m2 = lightness + saturation - lightness * saturation;
3355 m1 = 2 * lightness - m2;
3357 if (saturation == 0)
3372 r = m1 + (m2 - m1) * hue / 60;
3376 r = m1 + (m2 - m1) * (240 - hue) / 60;
3387 g = m1 + (m2 - m1) * hue / 60;
3391 g = m1 + (m2 - m1) * (240 - hue) / 60;
3402 b = m1 + (m2 - m1) * hue / 60;
3406 b = m1 + (m2 - m1) * (240 - hue) / 60;
3417 gtk_paint_hline (GtkStyle *style,
3419 GtkStateType state_type,
3422 const gchar *detail,
3427 g_return_if_fail (style != NULL);
3428 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL);
3430 GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type, area, widget, detail, x1, x2, y);
3434 gtk_paint_vline (GtkStyle *style,
3436 GtkStateType state_type,
3439 const gchar *detail,
3444 g_return_if_fail (style != NULL);
3445 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL);
3447 GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type, area, widget, detail, y1, y2, x);
3451 gtk_paint_shadow (GtkStyle *style,
3453 GtkStateType state_type,
3454 GtkShadowType shadow_type,
3457 const gchar *detail,
3463 g_return_if_fail (style != NULL);
3464 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
3466 GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3470 gtk_paint_polygon (GtkStyle *style,
3472 GtkStateType state_type,
3473 GtkShadowType shadow_type,
3476 const gchar *detail,
3481 g_return_if_fail (style != NULL);
3482 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
3484 GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type, area, widget, detail, points, npoints, fill);
3488 gtk_paint_arrow (GtkStyle *style,
3490 GtkStateType state_type,
3491 GtkShadowType shadow_type,
3494 const gchar *detail,
3495 GtkArrowType arrow_type,
3502 g_return_if_fail (style != NULL);
3503 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL);
3505 GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height);
3509 gtk_paint_diamond (GtkStyle *style,
3511 GtkStateType state_type,
3512 GtkShadowType shadow_type,
3515 const gchar *detail,
3521 g_return_if_fail (style != NULL);
3522 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL);
3524 GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3528 gtk_paint_oval (GtkStyle *style,
3530 GtkStateType state_type,
3531 GtkShadowType shadow_type,
3534 const gchar *detail,
3540 g_return_if_fail (style != NULL);
3541 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_oval != NULL);
3543 GTK_STYLE_GET_CLASS (style)->draw_oval (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3547 gtk_paint_string (GtkStyle *style,
3549 GtkStateType state_type,
3552 const gchar *detail,
3555 const gchar *string)
3557 g_return_if_fail (style != NULL);
3558 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_string != NULL);
3560 GTK_STYLE_GET_CLASS (style)->draw_string (style, window, state_type, area, widget, detail, x, y, string);
3564 gtk_paint_box (GtkStyle *style,
3566 GtkStateType state_type,
3567 GtkShadowType shadow_type,
3570 const gchar *detail,
3576 g_return_if_fail (style != NULL);
3577 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL);
3579 GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3583 gtk_paint_flat_box (GtkStyle *style,
3585 GtkStateType state_type,
3586 GtkShadowType shadow_type,
3589 const gchar *detail,
3595 g_return_if_fail (style != NULL);
3596 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL);
3598 GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3602 gtk_paint_check (GtkStyle *style,
3604 GtkStateType state_type,
3605 GtkShadowType shadow_type,
3608 const gchar *detail,
3614 g_return_if_fail (style != NULL);
3615 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL);
3617 GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3621 gtk_paint_option (GtkStyle *style,
3623 GtkStateType state_type,
3624 GtkShadowType shadow_type,
3627 const gchar *detail,
3633 g_return_if_fail (style != NULL);
3634 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL);
3636 GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3640 gtk_paint_cross (GtkStyle *style,
3642 GtkStateType state_type,
3643 GtkShadowType shadow_type,
3646 const gchar *detail,
3652 g_return_if_fail (style != NULL);
3653 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_cross != NULL);
3655 GTK_STYLE_GET_CLASS (style)->draw_cross (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3659 gtk_paint_ramp (GtkStyle *style,
3661 GtkStateType state_type,
3662 GtkShadowType shadow_type,
3665 const gchar *detail,
3666 GtkArrowType arrow_type,
3672 g_return_if_fail (style != NULL);
3673 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_ramp != NULL);
3675 GTK_STYLE_GET_CLASS (style)->draw_ramp (style, window, state_type, shadow_type, area, widget, detail, arrow_type, x, y, width, height);
3679 gtk_paint_tab (GtkStyle *style,
3681 GtkStateType state_type,
3682 GtkShadowType shadow_type,
3685 const gchar *detail,
3691 g_return_if_fail (style != NULL);
3692 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL);
3694 GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3698 gtk_paint_shadow_gap (GtkStyle *style,
3700 GtkStateType state_type,
3701 GtkShadowType shadow_type,
3709 GtkPositionType gap_side,
3713 g_return_if_fail (style != NULL);
3714 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL);
3716 GTK_STYLE_GET_CLASS (style)->draw_shadow_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width);
3721 gtk_paint_box_gap (GtkStyle *style,
3723 GtkStateType state_type,
3724 GtkShadowType shadow_type,
3732 GtkPositionType gap_side,
3736 g_return_if_fail (style != NULL);
3737 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL);
3739 GTK_STYLE_GET_CLASS (style)->draw_box_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width);
3743 gtk_paint_extension (GtkStyle *style,
3745 GtkStateType state_type,
3746 GtkShadowType shadow_type,
3754 GtkPositionType gap_side)
3756 g_return_if_fail (style != NULL);
3757 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL);
3759 GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side);
3763 gtk_paint_focus (GtkStyle *style,
3767 const gchar *detail,
3773 g_return_if_fail (style != NULL);
3774 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL);
3776 GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, area, widget, detail, x, y, width, height);
3780 gtk_paint_slider (GtkStyle *style,
3782 GtkStateType state_type,
3783 GtkShadowType shadow_type,
3786 const gchar *detail,
3791 GtkOrientation orientation)
3793 g_return_if_fail (style != NULL);
3794 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_slider != NULL);
3796 GTK_STYLE_GET_CLASS (style)->draw_slider (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);
3800 gtk_paint_handle (GtkStyle *style,
3802 GtkStateType state_type,
3803 GtkShadowType shadow_type,
3806 const gchar *detail,
3811 GtkOrientation orientation)
3813 g_return_if_fail (style != NULL);
3814 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL);
3816 GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);