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 Lesser 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 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser 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-2000. 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"
34 #include "gtkiconfactory.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);
50 static void gtk_style_real_realize (GtkStyle *style);
51 static void gtk_style_real_unrealize (GtkStyle *style);
52 static void gtk_style_real_copy (GtkStyle *style,
54 static void gtk_style_real_set_background (GtkStyle *style,
56 GtkStateType state_type);
57 static GtkStyle *gtk_style_real_clone (GtkStyle *style);
58 static void gtk_style_real_init_from_rc (GtkStyle *style,
59 GtkRcStyle *rc_style);
62 static GdkPixbuf *gtk_default_render_icon (GtkStyle *style,
63 const GtkIconSource *source,
64 GtkTextDirection direction,
70 static void gtk_default_draw_hline (GtkStyle *style,
72 GtkStateType state_type,
79 static void gtk_default_draw_vline (GtkStyle *style,
81 GtkStateType state_type,
88 static void gtk_default_draw_shadow (GtkStyle *style,
90 GtkStateType state_type,
91 GtkShadowType shadow_type,
99 static void gtk_default_draw_shadow (GtkStyle *style,
101 GtkStateType state_type,
102 GtkShadowType shadow_type,
110 static void gtk_default_draw_polygon (GtkStyle *style,
112 GtkStateType state_type,
113 GtkShadowType shadow_type,
120 static void gtk_default_draw_arrow (GtkStyle *style,
122 GtkStateType state_type,
123 GtkShadowType shadow_type,
127 GtkArrowType arrow_type,
133 static void gtk_default_draw_diamond (GtkStyle *style,
135 GtkStateType state_type,
136 GtkShadowType shadow_type,
144 static void gtk_default_draw_oval (GtkStyle *style,
146 GtkStateType state_type,
147 GtkShadowType shadow_type,
155 static void gtk_default_draw_string (GtkStyle *style,
157 GtkStateType state_type,
163 const gchar *string);
164 static void gtk_default_draw_box (GtkStyle *style,
166 GtkStateType state_type,
167 GtkShadowType shadow_type,
175 static void gtk_default_draw_flat_box (GtkStyle *style,
177 GtkStateType state_type,
178 GtkShadowType shadow_type,
186 static void gtk_default_draw_check (GtkStyle *style,
188 GtkStateType state_type,
189 GtkShadowType shadow_type,
197 static void gtk_default_draw_option (GtkStyle *style,
199 GtkStateType state_type,
200 GtkShadowType shadow_type,
208 static void gtk_default_draw_cross (GtkStyle *style,
210 GtkStateType state_type,
211 GtkShadowType shadow_type,
219 static void gtk_default_draw_ramp (GtkStyle *style,
221 GtkStateType state_type,
222 GtkShadowType shadow_type,
226 GtkArrowType arrow_type,
231 static void gtk_default_draw_tab (GtkStyle *style,
233 GtkStateType state_type,
234 GtkShadowType shadow_type,
242 static void gtk_default_draw_shadow_gap (GtkStyle *style,
244 GtkStateType state_type,
245 GtkShadowType shadow_type,
253 GtkPositionType gap_side,
256 static void gtk_default_draw_box_gap (GtkStyle *style,
258 GtkStateType state_type,
259 GtkShadowType shadow_type,
267 GtkPositionType gap_side,
270 static void gtk_default_draw_extension (GtkStyle *style,
272 GtkStateType state_type,
273 GtkShadowType shadow_type,
281 GtkPositionType gap_side);
282 static void gtk_default_draw_focus (GtkStyle *style,
291 static void gtk_default_draw_slider (GtkStyle *style,
293 GtkStateType state_type,
294 GtkShadowType shadow_type,
302 GtkOrientation orientation);
303 static void gtk_default_draw_handle (GtkStyle *style,
305 GtkStateType state_type,
306 GtkShadowType shadow_type,
314 GtkOrientation orientation);
316 static void gtk_style_shade (GdkColor *a, GdkColor *b, gdouble k);
317 static void rgb_to_hls (gdouble *r, gdouble *g, gdouble *b);
318 static void hls_to_rgb (gdouble *h, gdouble *l, gdouble *s);
320 GdkFont *default_font = NULL;
322 static GdkColor gtk_default_normal_fg = { 0, 0, 0, 0 };
323 static GdkColor gtk_default_active_fg = { 0, 0, 0, 0 };
324 static GdkColor gtk_default_prelight_fg = { 0, 0, 0, 0 };
325 static GdkColor gtk_default_selected_fg = { 0, 0xffff, 0xffff, 0xffff };
326 static GdkColor gtk_default_insensitive_fg = { 0, 0x7530, 0x7530, 0x7530 };
328 static GdkColor gtk_default_normal_bg = { 0, 0xd6d6, 0xd6d6, 0xd6d6 };
329 static GdkColor gtk_default_active_bg = { 0, 0xc350, 0xc350, 0xc350 };
330 static GdkColor gtk_default_prelight_bg = { 0, 0xea60, 0xea60, 0xea60 };
331 static GdkColor gtk_default_selected_bg = { 0, 0, 0, 0x9c40 };
332 static GdkColor gtk_default_insensitive_bg = { 0, 0xd6d6, 0xd6d6, 0xd6d6 };
334 static gpointer parent_class = NULL;
336 static void gtk_style_init (GtkStyle *style);
337 static void gtk_style_class_init (GtkStyleClass *klass);
338 static void gtk_style_finalize (GObject *object);
341 gtk_style_get_type (void)
343 static GType object_type = 0;
347 static const GTypeInfo object_info =
349 sizeof (GtkStyleClass),
350 (GBaseInitFunc) NULL,
351 (GBaseFinalizeFunc) NULL,
352 (GClassInitFunc) gtk_style_class_init,
353 NULL, /* class_finalize */
354 NULL, /* class_data */
357 (GInstanceInitFunc) gtk_style_init,
360 object_type = g_type_register_static (G_TYPE_OBJECT,
369 gtk_style_init (GtkStyle *style)
373 style->font_desc = pango_font_description_from_string ("Sans 10");
377 default_font = gdk_font_from_description (style->font_desc);
380 g_error ("Unable to load default font.");
383 style->font = default_font;
384 gdk_font_ref (style->font);
386 style->attach_count = 0;
387 style->colormap = NULL;
390 style->black.red = 0;
391 style->black.green = 0;
392 style->black.blue = 0;
394 style->white.red = 65535;
395 style->white.green = 65535;
396 style->white.blue = 65535;
398 style->black_gc = NULL;
399 style->white_gc = NULL;
401 style->fg[GTK_STATE_NORMAL] = gtk_default_normal_fg;
402 style->fg[GTK_STATE_ACTIVE] = gtk_default_active_fg;
403 style->fg[GTK_STATE_PRELIGHT] = gtk_default_prelight_fg;
404 style->fg[GTK_STATE_SELECTED] = gtk_default_selected_fg;
405 style->fg[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_fg;
407 style->bg[GTK_STATE_NORMAL] = gtk_default_normal_bg;
408 style->bg[GTK_STATE_ACTIVE] = gtk_default_active_bg;
409 style->bg[GTK_STATE_PRELIGHT] = gtk_default_prelight_bg;
410 style->bg[GTK_STATE_SELECTED] = gtk_default_selected_bg;
411 style->bg[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_bg;
413 for (i = 0; i < 4; i++)
415 style->text[i] = style->fg[i];
416 style->base[i] = style->white;
419 style->base[GTK_STATE_INSENSITIVE] = gtk_default_prelight_bg;
420 style->text[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_fg;
422 for (i = 0; i < 5; i++)
423 style->bg_pixmap[i] = NULL;
425 style->rc_style = NULL;
427 for (i = 0; i < 5; i++)
429 style->fg_gc[i] = NULL;
430 style->bg_gc[i] = NULL;
431 style->light_gc[i] = NULL;
432 style->dark_gc[i] = NULL;
433 style->mid_gc[i] = NULL;
434 style->text_gc[i] = NULL;
435 style->base_gc[i] = NULL;
438 style->xthickness = 2;
439 style->ythickness = 2;
443 gtk_style_class_init (GtkStyleClass *klass)
445 GObjectClass *object_class = G_OBJECT_CLASS (klass);
447 parent_class = g_type_class_peek_parent (klass);
449 object_class->finalize = gtk_style_finalize;
451 klass->clone = gtk_style_real_clone;
452 klass->copy = gtk_style_real_copy;
453 klass->init_from_rc = gtk_style_real_init_from_rc;
454 klass->realize = gtk_style_real_realize;
455 klass->unrealize = gtk_style_real_unrealize;
456 klass->set_background = gtk_style_real_set_background;
457 klass->render_icon = gtk_default_render_icon;
459 klass->draw_hline = gtk_default_draw_hline;
460 klass->draw_vline = gtk_default_draw_vline;
461 klass->draw_shadow = gtk_default_draw_shadow;
462 klass->draw_polygon = gtk_default_draw_polygon;
463 klass->draw_arrow = gtk_default_draw_arrow;
464 klass->draw_diamond = gtk_default_draw_diamond;
465 klass->draw_oval = gtk_default_draw_oval;
466 klass->draw_string = gtk_default_draw_string;
467 klass->draw_box = gtk_default_draw_box;
468 klass->draw_flat_box = gtk_default_draw_flat_box;
469 klass->draw_check = gtk_default_draw_check;
470 klass->draw_option = gtk_default_draw_option;
471 klass->draw_cross = gtk_default_draw_cross;
472 klass->draw_ramp = gtk_default_draw_ramp;
473 klass->draw_tab = gtk_default_draw_tab;
474 klass->draw_shadow_gap = gtk_default_draw_shadow_gap;
475 klass->draw_box_gap = gtk_default_draw_box_gap;
476 klass->draw_extension = gtk_default_draw_extension;
477 klass->draw_focus = gtk_default_draw_focus;
478 klass->draw_slider = gtk_default_draw_slider;
479 klass->draw_handle = gtk_default_draw_handle;
483 gtk_style_finalize (GObject *object)
485 GtkStyle *style = GTK_STYLE (object);
487 g_return_if_fail (style->attach_count == 0);
491 if (style->styles->data != style)
492 g_slist_remove (style->styles, style);
495 GSList *tmp_list = style->styles->next;
499 ((GtkStyle*) tmp_list->data)->styles = style->styles->next;
500 tmp_list = tmp_list->next;
502 g_slist_free_1 (style->styles);
506 gdk_font_unref (style->font);
507 pango_font_description_free (style->font_desc);
510 gtk_rc_style_unref (style->rc_style);
512 G_OBJECT_CLASS (parent_class)->finalize (object);
517 gtk_style_copy (GtkStyle *style)
521 g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
523 new_style = GTK_STYLE_GET_CLASS (style)->clone (style);
524 GTK_STYLE_GET_CLASS (style)->copy (new_style, style);
530 gtk_style_duplicate (GtkStyle *style)
534 g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
536 new_style = gtk_style_copy (style);
538 style->styles = g_slist_append (style->styles, new_style);
539 new_style->styles = style->styles;
549 style = g_object_new (GTK_TYPE_STYLE, NULL);
554 /*************************************************************
556 * Attach a style to a window; this process allocates the
557 * colors and creates the GC's for the style - it specializes
558 * it to a particular visual and colormap. The process
559 * may involve the creation of a new style if the style
560 * has already been attached to a window with a different
561 * style and colormap.
566 * Either the style parameter, or a newly created style.
567 * If the style is newly created, the style parameter
568 * will be dereferenced, and the new style will have
569 * a reference count belonging to the caller.
571 * FIXME: The sequence -
572 * create a style => s1
573 * attach s1 to v1, c1 => s1
574 * attach s1 to v2, c2 => s2
575 * detach s1 from v1, c1
576 * attach s1 to v2, c2 => s3
577 * results in two separate, unlinked styles s2 and s3 which
578 * are identical and could be shared. To fix this, we would
579 * want to never remove a style from the list of linked
580 * styles as long as as it has a reference count. However, the
581 * disadvantage of doing it this way means that we would need two
582 * passes through the linked list when attaching (one to check for
583 * matching styles, one to look for empty unattached styles - but
584 * it will almost never be longer than 2 elements.
585 *************************************************************/
588 gtk_style_attach (GtkStyle *style,
592 GtkStyle *new_style = NULL;
593 GdkColormap *colormap;
595 g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
596 g_return_val_if_fail (window != NULL, NULL);
598 colormap = gdk_window_get_colormap (window);
601 style->styles = g_slist_append (NULL, style);
603 styles = style->styles;
606 new_style = styles->data;
608 if (new_style->attach_count == 0)
610 gtk_style_realize (new_style, colormap);
613 else if (new_style->colormap == colormap)
617 styles = styles->next;
622 new_style = gtk_style_duplicate (style);
623 gtk_style_realize (new_style, colormap);
626 /* A style gets a refcount from being attached */
627 if (new_style->attach_count == 0)
628 gtk_style_ref (new_style);
630 /* Another refcount belongs to the parent */
631 if (style != new_style)
633 gtk_style_unref (style);
634 gtk_style_ref (new_style);
637 new_style->attach_count++;
643 gtk_style_detach (GtkStyle *style)
645 g_return_if_fail (GTK_IS_STYLE (style));
647 style->attach_count -= 1;
648 if (style->attach_count == 0)
650 GTK_STYLE_GET_CLASS (style)->unrealize (style);
652 gtk_style_unref (style);
657 gtk_style_ref (GtkStyle *style)
659 return (GtkStyle *) g_object_ref (G_OBJECT (style));
663 gtk_style_unref (GtkStyle *style)
665 g_object_unref (G_OBJECT (style));
669 gtk_style_realize (GtkStyle *style,
670 GdkColormap *colormap)
672 g_return_if_fail (GTK_IS_STYLE (style));
674 style->colormap = colormap;
675 style->depth = gdk_colormap_get_visual (colormap)->depth;
677 GTK_STYLE_GET_CLASS (style)->realize (style);
681 gtk_style_lookup_icon_set (GtkStyle *style,
682 const char *stock_id)
686 g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
687 g_return_val_if_fail (stock_id != NULL, NULL);
689 iter = style->icon_factories;
692 GtkIconSet *icon_set =
693 gtk_icon_factory_lookup (GTK_ICON_FACTORY (iter->data),
699 iter = g_slist_next (iter);
702 return gtk_icon_factory_lookup_default (stock_id);
706 gtk_draw_hline (GtkStyle *style,
708 GtkStateType state_type,
713 g_return_if_fail (GTK_IS_STYLE (style));
714 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL);
716 GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type, NULL, NULL, NULL, x1, x2, y);
721 gtk_draw_vline (GtkStyle *style,
723 GtkStateType state_type,
728 g_return_if_fail (GTK_IS_STYLE (style));
729 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL);
731 GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type, NULL, NULL, NULL, y1, y2, x);
736 gtk_draw_shadow (GtkStyle *style,
738 GtkStateType state_type,
739 GtkShadowType shadow_type,
745 g_return_if_fail (GTK_IS_STYLE (style));
746 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
748 GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
752 gtk_draw_polygon (GtkStyle *style,
754 GtkStateType state_type,
755 GtkShadowType shadow_type,
760 g_return_if_fail (GTK_IS_STYLE (style));
761 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_polygon != NULL);
763 GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type, NULL, NULL, NULL, points, npoints, fill);
767 gtk_draw_arrow (GtkStyle *style,
769 GtkStateType state_type,
770 GtkShadowType shadow_type,
771 GtkArrowType arrow_type,
778 g_return_if_fail (GTK_IS_STYLE (style));
779 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL);
781 GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, fill, x, y, width, height);
786 gtk_draw_diamond (GtkStyle *style,
788 GtkStateType state_type,
789 GtkShadowType shadow_type,
795 g_return_if_fail (GTK_IS_STYLE (style));
796 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL);
798 GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
803 gtk_draw_oval (GtkStyle *style,
805 GtkStateType state_type,
806 GtkShadowType shadow_type,
812 g_return_if_fail (GTK_IS_STYLE (style));
813 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_oval != NULL);
815 GTK_STYLE_GET_CLASS (style)->draw_oval (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
819 gtk_draw_string (GtkStyle *style,
821 GtkStateType state_type,
826 g_return_if_fail (GTK_IS_STYLE (style));
827 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_string != NULL);
829 GTK_STYLE_GET_CLASS (style)->draw_string (style, window, state_type, NULL, NULL, NULL, x, y, string);
833 gtk_draw_box (GtkStyle *style,
835 GtkStateType state_type,
836 GtkShadowType shadow_type,
842 g_return_if_fail (GTK_IS_STYLE (style));
843 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL);
845 GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
849 gtk_draw_flat_box (GtkStyle *style,
851 GtkStateType state_type,
852 GtkShadowType shadow_type,
858 g_return_if_fail (GTK_IS_STYLE (style));
859 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL);
861 GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
865 gtk_draw_check (GtkStyle *style,
867 GtkStateType state_type,
868 GtkShadowType shadow_type,
874 g_return_if_fail (GTK_IS_STYLE (style));
875 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL);
877 GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
881 gtk_draw_option (GtkStyle *style,
883 GtkStateType state_type,
884 GtkShadowType shadow_type,
890 g_return_if_fail (GTK_IS_STYLE (style));
891 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL);
893 GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
897 gtk_draw_cross (GtkStyle *style,
899 GtkStateType state_type,
900 GtkShadowType shadow_type,
906 g_return_if_fail (GTK_IS_STYLE (style));
907 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_cross != NULL);
909 GTK_STYLE_GET_CLASS (style)->draw_cross (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
913 gtk_draw_ramp (GtkStyle *style,
915 GtkStateType state_type,
916 GtkShadowType shadow_type,
917 GtkArrowType arrow_type,
923 g_return_if_fail (GTK_IS_STYLE (style));
924 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_ramp != NULL);
926 GTK_STYLE_GET_CLASS (style)->draw_ramp (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, x, y, width, height);
930 gtk_draw_tab (GtkStyle *style,
932 GtkStateType state_type,
933 GtkShadowType shadow_type,
939 g_return_if_fail (GTK_IS_STYLE (style));
940 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL);
942 GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
946 gtk_draw_shadow_gap (GtkStyle *style,
948 GtkStateType state_type,
949 GtkShadowType shadow_type,
954 GtkPositionType gap_side,
958 g_return_if_fail (GTK_IS_STYLE (style));
959 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL);
961 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);
965 gtk_draw_box_gap (GtkStyle *style,
967 GtkStateType state_type,
968 GtkShadowType shadow_type,
973 GtkPositionType gap_side,
977 g_return_if_fail (GTK_IS_STYLE (style));
978 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL);
980 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);
984 gtk_draw_extension (GtkStyle *style,
986 GtkStateType state_type,
987 GtkShadowType shadow_type,
992 GtkPositionType gap_side)
994 g_return_if_fail (GTK_IS_STYLE (style));
995 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL);
997 GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side);
1001 gtk_draw_focus (GtkStyle *style,
1008 g_return_if_fail (GTK_IS_STYLE (style));
1009 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL);
1011 GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, NULL, NULL, NULL, x, y, width, height);
1015 gtk_draw_slider (GtkStyle *style,
1017 GtkStateType state_type,
1018 GtkShadowType shadow_type,
1023 GtkOrientation orientation)
1025 g_return_if_fail (GTK_IS_STYLE (style));
1026 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_slider != NULL);
1028 GTK_STYLE_GET_CLASS (style)->draw_slider (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
1032 gtk_draw_handle (GtkStyle *style,
1034 GtkStateType state_type,
1035 GtkShadowType shadow_type,
1040 GtkOrientation orientation)
1042 g_return_if_fail (GTK_IS_STYLE (style));
1043 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL);
1045 GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
1049 gtk_style_set_background (GtkStyle *style,
1051 GtkStateType state_type)
1053 g_return_if_fail (GTK_IS_STYLE (style));
1054 g_return_if_fail (window != NULL);
1056 GTK_STYLE_GET_CLASS (style)->set_background (style, window, state_type);
1059 /* Default functions */
1061 gtk_style_real_clone (GtkStyle *style)
1063 return GTK_STYLE (g_object_new (G_OBJECT_TYPE (style), NULL));
1067 gtk_style_real_copy (GtkStyle *style,
1072 for (i = 0; i < 5; i++)
1074 style->fg[i] = src->fg[i];
1075 style->bg[i] = src->bg[i];
1076 style->text[i] = src->text[i];
1077 style->base[i] = src->base[i];
1079 style->bg_pixmap[i] = src->bg_pixmap[i];
1083 gdk_font_unref (style->font);
1084 style->font = src->font;
1086 gdk_font_ref (style->font);
1088 if (style->font_desc)
1089 pango_font_description_free (style->font_desc);
1091 style->font_desc = pango_font_description_copy (src->font_desc);
1093 style->font_desc = NULL;
1095 style->xthickness = src->xthickness;
1096 style->ythickness = src->ythickness;
1098 if (style->rc_style)
1099 gtk_rc_style_unref (style->rc_style);
1100 style->rc_style = src->rc_style;
1102 gtk_rc_style_ref (src->rc_style);
1106 gtk_style_real_init_from_rc (GtkStyle *style,
1107 GtkRcStyle *rc_style)
1112 if (rc_style->font_desc)
1114 pango_font_description_free (style->font_desc);
1115 style->font_desc = pango_font_description_copy (rc_style->font_desc);
1117 old_font = style->font;
1118 style->font = gdk_font_from_description (style->font_desc);
1120 gdk_font_unref (old_font);
1122 style->font = old_font;
1125 for (i = 0; i < 5; i++)
1127 if (rc_style->color_flags[i] & GTK_RC_FG)
1128 style->fg[i] = rc_style->fg[i];
1129 if (rc_style->color_flags[i] & GTK_RC_BG)
1130 style->bg[i] = rc_style->bg[i];
1131 if (rc_style->color_flags[i] & GTK_RC_TEXT)
1132 style->text[i] = rc_style->text[i];
1133 if (rc_style->color_flags[i] & GTK_RC_BASE)
1134 style->base[i] = rc_style->base[i];
1137 if (rc_style->xthickness >= 0)
1138 style->xthickness = rc_style->xthickness;
1139 if (rc_style->ythickness >= 0)
1140 style->ythickness = rc_style->ythickness;
1143 if (rc_style->icon_factories)
1147 style->icon_factories = g_slist_copy (rc_style->icon_factories);
1149 iter = style->icon_factories;
1150 while (iter != NULL)
1152 g_object_ref (G_OBJECT (iter->data));
1154 iter = g_slist_next (iter);
1160 gtk_style_real_realize (GtkStyle *style)
1162 GdkGCValues gc_values;
1163 GdkGCValuesMask gc_values_mask;
1167 for (i = 0; i < 5; i++)
1169 gtk_style_shade (&style->bg[i], &style->light[i], LIGHTNESS_MULT);
1170 gtk_style_shade (&style->bg[i], &style->dark[i], DARKNESS_MULT);
1172 style->mid[i].red = (style->light[i].red + style->dark[i].red) / 2;
1173 style->mid[i].green = (style->light[i].green + style->dark[i].green) / 2;
1174 style->mid[i].blue = (style->light[i].blue + style->dark[i].blue) / 2;
1177 gdk_color_black (style->colormap, &style->black);
1178 gdk_color_white (style->colormap, &style->white);
1180 gc_values_mask = GDK_GC_FOREGROUND | GDK_GC_FONT;
1181 if (style->font->type == GDK_FONT_FONT)
1183 gc_values.font = style->font;
1185 else if (style->font->type == GDK_FONT_FONTSET)
1187 gc_values.font = default_font;
1190 gc_values.foreground = style->black;
1191 style->black_gc = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1193 gc_values.foreground = style->white;
1194 style->white_gc = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1196 for (i = 0; i < 5; i++)
1198 if (style->rc_style && style->rc_style->bg_pixmap_name[i])
1199 style->bg_pixmap[i] = gtk_rc_load_image (style->colormap,
1201 style->rc_style->bg_pixmap_name[i]);
1203 if (!gdk_color_alloc (style->colormap, &style->fg[i]))
1204 g_warning ("unable to allocate color: ( %d %d %d )",
1205 style->fg[i].red, style->fg[i].green, style->fg[i].blue);
1206 if (!gdk_color_alloc (style->colormap, &style->bg[i]))
1207 g_warning ("unable to allocate color: ( %d %d %d )",
1208 style->bg[i].red, style->bg[i].green, style->bg[i].blue);
1209 if (!gdk_color_alloc (style->colormap, &style->light[i]))
1210 g_warning ("unable to allocate color: ( %d %d %d )",
1211 style->light[i].red, style->light[i].green, style->light[i].blue);
1212 if (!gdk_color_alloc (style->colormap, &style->dark[i]))
1213 g_warning ("unable to allocate color: ( %d %d %d )",
1214 style->dark[i].red, style->dark[i].green, style->dark[i].blue);
1215 if (!gdk_color_alloc (style->colormap, &style->mid[i]))
1216 g_warning ("unable to allocate color: ( %d %d %d )",
1217 style->mid[i].red, style->mid[i].green, style->mid[i].blue);
1218 if (!gdk_color_alloc (style->colormap, &style->text[i]))
1219 g_warning ("unable to allocate color: ( %d %d %d )",
1220 style->text[i].red, style->text[i].green, style->text[i].blue);
1221 if (!gdk_color_alloc (style->colormap, &style->base[i]))
1222 g_warning ("unable to allocate color: ( %d %d %d )",
1223 style->base[i].red, style->base[i].green, style->base[i].blue);
1225 gc_values.foreground = style->fg[i];
1226 style->fg_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1228 gc_values.foreground = style->bg[i];
1229 style->bg_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1231 gc_values.foreground = style->light[i];
1232 style->light_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1234 gc_values.foreground = style->dark[i];
1235 style->dark_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1237 gc_values.foreground = style->mid[i];
1238 style->mid_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1240 gc_values.foreground = style->text[i];
1241 style->text_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1243 gc_values.foreground = style->base[i];
1244 style->base_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1249 gtk_style_real_unrealize (GtkStyle *style)
1253 gtk_gc_release (style->black_gc);
1254 gtk_gc_release (style->white_gc);
1256 for (i = 0; i < 5; i++)
1258 gtk_gc_release (style->fg_gc[i]);
1259 gtk_gc_release (style->bg_gc[i]);
1260 gtk_gc_release (style->light_gc[i]);
1261 gtk_gc_release (style->dark_gc[i]);
1262 gtk_gc_release (style->mid_gc[i]);
1263 gtk_gc_release (style->text_gc[i]);
1264 gtk_gc_release (style->base_gc[i]);
1269 gtk_style_real_set_background (GtkStyle *style,
1271 GtkStateType state_type)
1274 gint parent_relative;
1276 if (style->bg_pixmap[state_type])
1278 if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
1281 parent_relative = TRUE;
1285 pixmap = style->bg_pixmap[state_type];
1286 parent_relative = FALSE;
1289 gdk_window_set_back_pixmap (window, pixmap, parent_relative);
1292 gdk_window_set_background (window, &style->bg[state_type]);
1296 gtk_style_render_icon (GtkStyle *style,
1297 const GtkIconSource *source,
1298 GtkTextDirection direction,
1302 const gchar *detail)
1306 g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
1307 g_return_val_if_fail (GTK_STYLE_GET_CLASS (style)->render_icon != NULL, NULL);
1309 pixbuf = GTK_STYLE_GET_CLASS (style)->render_icon (style, source, direction, state,
1310 size, widget, detail);
1312 g_return_val_if_fail (pixbuf != NULL, NULL);
1317 /* Default functions */
1319 gtk_style_apply_default_background (GtkStyle *style,
1322 GtkStateType state_type,
1329 GdkRectangle new_rect, old_rect;
1335 old_rect.width = width;
1336 old_rect.height = height;
1338 if (!gdk_rectangle_intersect (area, &old_rect, &new_rect))
1345 new_rect.width = width;
1346 new_rect.height = height;
1349 if (!style->bg_pixmap[state_type] ||
1350 GDK_IS_PIXMAP (window) ||
1351 (!set_bg && style->bg_pixmap[state_type] != (GdkPixmap*) GDK_PARENT_RELATIVE))
1353 GdkGC *gc = style->bg_gc[state_type];
1355 if (style->bg_pixmap[state_type])
1357 gdk_gc_set_fill (gc, GDK_TILED);
1358 gdk_gc_set_tile (gc, style->bg_pixmap[state_type]);
1361 gdk_draw_rectangle (window, gc, TRUE,
1362 new_rect.x, new_rect.y, new_rect.width, new_rect.height);
1363 if (style->bg_pixmap[state_type])
1364 gdk_gc_set_fill (gc, GDK_SOLID);
1370 if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
1371 gdk_window_set_back_pixmap (window, NULL, TRUE);
1373 gdk_window_set_back_pixmap (window, style->bg_pixmap[state_type], FALSE);
1376 gdk_window_clear_area (window,
1377 new_rect.x, new_rect.y,
1378 new_rect.width, new_rect.height);
1383 scale_or_ref (GdkPixbuf *src,
1387 if (width == gdk_pixbuf_get_width (src) &&
1388 height == gdk_pixbuf_get_height (src))
1390 gdk_pixbuf_ref (src);
1395 return gdk_pixbuf_scale_simple (src,
1397 GDK_INTERP_BILINEAR);
1402 gtk_default_render_icon (GtkStyle *style,
1403 const GtkIconSource *source,
1404 GtkTextDirection direction,
1408 const gchar *detail)
1415 /* Oddly, style can be NULL in this function, because
1416 * GtkIconSet can be used without a style and if so
1417 * it uses this function.
1420 g_return_val_if_fail (source->pixbuf != NULL, NULL);
1422 if (!gtk_icon_size_lookup (size, &width, &height))
1424 g_warning ("Bad icon size '%s' passed to render_icon", size);
1428 /* If the size was wildcarded, then scale; otherwise, leave it
1431 if (source->any_size)
1432 scaled = scale_or_ref (source->pixbuf, width, height);
1434 scaled = GDK_PIXBUF (g_object_ref (G_OBJECT (source->pixbuf)));
1436 /* If the state was wildcarded, then generate a state. */
1437 if (source->any_state)
1439 if (state == GTK_STATE_INSENSITIVE)
1441 stated = gdk_pixbuf_copy (scaled);
1443 gdk_pixbuf_saturate_and_pixelate (scaled, stated,
1446 gdk_pixbuf_unref (scaled);
1448 else if (state == GTK_STATE_PRELIGHT)
1450 stated = gdk_pixbuf_copy (scaled);
1452 gdk_pixbuf_saturate_and_pixelate (scaled, stated,
1455 gdk_pixbuf_unref (scaled);
1469 gtk_default_draw_hline (GtkStyle *style,
1471 GtkStateType state_type,
1474 const gchar *detail,
1479 gint thickness_light;
1480 gint thickness_dark;
1483 g_return_if_fail (GTK_IS_STYLE (style));
1484 g_return_if_fail (window != NULL);
1486 thickness_light = style->ythickness / 2;
1487 thickness_dark = style->ythickness - thickness_light;
1491 gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
1492 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
1495 if (detail && !strcmp (detail, "label"))
1497 if (state_type == GTK_STATE_INSENSITIVE)
1498 gdk_draw_line (window, style->white_gc, x1 + 1, y + 1, x2 + 1, y + 1);
1499 gdk_draw_line (window, style->fg_gc[state_type], x1, y, x2, y);
1503 for (i = 0; i < thickness_dark; i++)
1505 gdk_draw_line (window, style->light_gc[state_type], x2 - i - 1, y + i, x2, y + i);
1506 gdk_draw_line (window, style->dark_gc[state_type], x1, y + i, x2 - i - 1, y + i);
1509 y += thickness_dark;
1510 for (i = 0; i < thickness_light; i++)
1512 gdk_draw_line (window, style->dark_gc[state_type], x1, y + i, x1 + thickness_light - i - 1, y + i);
1513 gdk_draw_line (window, style->light_gc[state_type], x1 + thickness_light - i - 1, y + i, x2, y + i);
1519 gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
1520 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
1526 gtk_default_draw_vline (GtkStyle *style,
1528 GtkStateType state_type,
1531 const gchar *detail,
1536 gint thickness_light;
1537 gint thickness_dark;
1540 g_return_if_fail (GTK_IS_STYLE (style));
1541 g_return_if_fail (window != NULL);
1543 thickness_light = style->xthickness / 2;
1544 thickness_dark = style->xthickness - thickness_light;
1548 gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
1549 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
1551 for (i = 0; i < thickness_dark; i++)
1553 gdk_draw_line (window, style->light_gc[state_type], x + i, y2 - i - 1, x + i, y2);
1554 gdk_draw_line (window, style->dark_gc[state_type], x + i, y1, x + i, y2 - i - 1);
1557 x += thickness_dark;
1558 for (i = 0; i < thickness_light; i++)
1560 gdk_draw_line (window, style->dark_gc[state_type], x + i, y1, x + i, y1 + thickness_light - i);
1561 gdk_draw_line (window, style->light_gc[state_type], x + i, y1 + thickness_light - i, x + i, y2);
1565 gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
1566 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
1572 gtk_default_draw_shadow (GtkStyle *style,
1574 GtkStateType state_type,
1575 GtkShadowType shadow_type,
1578 const gchar *detail,
1586 gint thickness_light;
1587 gint thickness_dark;
1590 g_return_if_fail (GTK_IS_STYLE (style));
1591 g_return_if_fail (window != NULL);
1593 if ((width == -1) && (height == -1))
1594 gdk_window_get_size (window, &width, &height);
1595 else if (width == -1)
1596 gdk_window_get_size (window, &width, NULL);
1597 else if (height == -1)
1598 gdk_window_get_size (window, NULL, &height);
1600 switch (shadow_type)
1602 case GTK_SHADOW_NONE:
1605 case GTK_SHADOW_ETCHED_IN:
1606 gc1 = style->light_gc[state_type];
1607 gc2 = style->dark_gc[state_type];
1609 case GTK_SHADOW_OUT:
1610 case GTK_SHADOW_ETCHED_OUT:
1611 gc1 = style->dark_gc[state_type];
1612 gc2 = style->light_gc[state_type];
1618 gdk_gc_set_clip_rectangle (gc1, area);
1619 gdk_gc_set_clip_rectangle (gc2, area);
1620 if (shadow_type == GTK_SHADOW_IN ||
1621 shadow_type == GTK_SHADOW_OUT)
1623 gdk_gc_set_clip_rectangle (style->black_gc, area);
1624 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
1628 switch (shadow_type)
1630 case GTK_SHADOW_NONE:
1634 gdk_draw_line (window, gc1,
1635 x, y + height - 1, x + width - 1, y + height - 1);
1636 gdk_draw_line (window, gc1,
1637 x + width - 1, y, x + width - 1, y + height - 1);
1639 gdk_draw_line (window, style->bg_gc[state_type],
1640 x + 1, y + height - 2, x + width - 2, y + height - 2);
1641 gdk_draw_line (window, style->bg_gc[state_type],
1642 x + width - 2, y + 1, x + width - 2, y + height - 2);
1644 gdk_draw_line (window, style->black_gc,
1645 x + 1, y + 1, x + width - 2, y + 1);
1646 gdk_draw_line (window, style->black_gc,
1647 x + 1, y + 1, x + 1, y + height - 2);
1649 gdk_draw_line (window, gc2,
1650 x, y, x + width - 1, y);
1651 gdk_draw_line (window, gc2,
1652 x, y, x, y + height - 1);
1655 case GTK_SHADOW_OUT:
1656 gdk_draw_line (window, gc1,
1657 x + 1, y + height - 2, x + width - 2, y + height - 2);
1658 gdk_draw_line (window, gc1,
1659 x + width - 2, y + 1, x + width - 2, y + height - 2);
1661 gdk_draw_line (window, gc2,
1662 x, y, x + width - 1, y);
1663 gdk_draw_line (window, gc2,
1664 x, y, x, y + height - 1);
1666 gdk_draw_line (window, style->bg_gc[state_type],
1667 x + 1, y + 1, x + width - 2, y + 1);
1668 gdk_draw_line (window, style->bg_gc[state_type],
1669 x + 1, y + 1, x + 1, y + height - 2);
1671 gdk_draw_line (window, style->black_gc,
1672 x, y + height - 1, x + width - 1, y + height - 1);
1673 gdk_draw_line (window, style->black_gc,
1674 x + width - 1, y, x + width - 1, y + height - 1);
1677 case GTK_SHADOW_ETCHED_IN:
1678 case GTK_SHADOW_ETCHED_OUT:
1679 thickness_light = 1;
1682 for (i = 0; i < thickness_dark; i++)
1684 gdk_draw_line (window, gc1,
1688 y + height - i - 1);
1689 gdk_draw_line (window, gc1,
1693 y + height - i - 1);
1695 gdk_draw_line (window, gc2,
1700 gdk_draw_line (window, gc2,
1704 y + height - i - 2);
1707 for (i = 0; i < thickness_light; i++)
1709 gdk_draw_line (window, gc1,
1710 x + thickness_dark + i,
1711 y + thickness_dark + i,
1712 x + width - thickness_dark - i - 1,
1713 y + thickness_dark + i);
1714 gdk_draw_line (window, gc1,
1715 x + thickness_dark + i,
1716 y + thickness_dark + i,
1717 x + thickness_dark + i,
1718 y + height - thickness_dark - i - 1);
1720 gdk_draw_line (window, gc2,
1721 x + thickness_dark + i,
1722 y + height - thickness_light - i - 1,
1723 x + width - thickness_light - 1,
1724 y + height - thickness_light - i - 1);
1725 gdk_draw_line (window, gc2,
1726 x + width - thickness_light - i - 1,
1727 y + thickness_dark + i,
1728 x + width - thickness_light - i - 1,
1729 y + height - thickness_light - 1);
1735 gdk_gc_set_clip_rectangle (gc1, NULL);
1736 gdk_gc_set_clip_rectangle (gc2, NULL);
1737 if (shadow_type == GTK_SHADOW_IN ||
1738 shadow_type == GTK_SHADOW_OUT)
1740 gdk_gc_set_clip_rectangle (style->black_gc, NULL);
1741 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
1747 gtk_default_draw_polygon (GtkStyle *style,
1749 GtkStateType state_type,
1750 GtkShadowType shadow_type,
1753 const gchar *detail,
1758 static const gdouble pi_over_4 = M_PI_4;
1759 static const gdouble pi_3_over_4 = M_PI_4 * 3;
1769 g_return_if_fail (GTK_IS_STYLE (style));
1770 g_return_if_fail (window != NULL);
1771 g_return_if_fail (points != NULL);
1773 switch (shadow_type)
1776 gc1 = style->bg_gc[state_type];
1777 gc2 = style->dark_gc[state_type];
1778 gc3 = style->light_gc[state_type];
1779 gc4 = style->black_gc;
1781 case GTK_SHADOW_ETCHED_IN:
1782 gc1 = style->light_gc[state_type];
1783 gc2 = style->dark_gc[state_type];
1784 gc3 = style->dark_gc[state_type];
1785 gc4 = style->light_gc[state_type];
1787 case GTK_SHADOW_OUT:
1788 gc1 = style->dark_gc[state_type];
1789 gc2 = style->light_gc[state_type];
1790 gc3 = style->black_gc;
1791 gc4 = style->bg_gc[state_type];
1793 case GTK_SHADOW_ETCHED_OUT:
1794 gc1 = style->dark_gc[state_type];
1795 gc2 = style->light_gc[state_type];
1796 gc3 = style->light_gc[state_type];
1797 gc4 = style->dark_gc[state_type];
1805 gdk_gc_set_clip_rectangle (gc1, area);
1806 gdk_gc_set_clip_rectangle (gc2, area);
1807 gdk_gc_set_clip_rectangle (gc3, area);
1808 gdk_gc_set_clip_rectangle (gc4, area);
1812 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, npoints);
1816 for (i = 0; i < npoints; i++)
1818 if ((points[i].x == points[i+1].x) &&
1819 (points[i].y == points[i+1].y))
1825 angle = atan2 (points[i+1].y - points[i].y,
1826 points[i+1].x - points[i].x);
1829 if ((angle > -pi_3_over_4) && (angle < pi_over_4))
1831 if (angle > -pi_over_4)
1842 gdk_draw_line (window, gc1,
1843 points[i].x-xadjust, points[i].y-yadjust,
1844 points[i+1].x-xadjust, points[i+1].y-yadjust);
1845 gdk_draw_line (window, gc3,
1846 points[i].x, points[i].y,
1847 points[i+1].x, points[i+1].y);
1851 if ((angle < -pi_3_over_4) || (angle > pi_3_over_4))
1862 gdk_draw_line (window, gc4,
1863 points[i].x+xadjust, points[i].y+yadjust,
1864 points[i+1].x+xadjust, points[i+1].y+yadjust);
1865 gdk_draw_line (window, gc2,
1866 points[i].x, points[i].y,
1867 points[i+1].x, points[i+1].y);
1873 gdk_gc_set_clip_rectangle (gc1, NULL);
1874 gdk_gc_set_clip_rectangle (gc2, NULL);
1875 gdk_gc_set_clip_rectangle (gc3, NULL);
1876 gdk_gc_set_clip_rectangle (gc4, NULL);
1881 gtk_default_draw_arrow (GtkStyle *style,
1883 GtkStateType state_type,
1884 GtkShadowType shadow_type,
1887 const gchar *detail,
1888 GtkArrowType arrow_type,
1903 g_return_if_fail (GTK_IS_STYLE (style));
1904 g_return_if_fail (window != NULL);
1906 switch (shadow_type)
1909 gc1 = style->bg_gc[state_type];
1910 gc2 = style->dark_gc[state_type];
1911 gc3 = style->light_gc[state_type];
1912 gc4 = style->black_gc;
1914 case GTK_SHADOW_OUT:
1915 gc1 = style->dark_gc[state_type];
1916 gc2 = style->light_gc[state_type];
1917 gc3 = style->black_gc;
1918 gc4 = style->bg_gc[state_type];
1920 case GTK_SHADOW_ETCHED_IN:
1921 gc1 = style->light_gc[state_type];
1922 gc2 = style->dark_gc[state_type];
1926 case GTK_SHADOW_ETCHED_OUT:
1927 gc1 = style->dark_gc[state_type];
1928 gc2 = style->light_gc[state_type];
1936 if ((width == -1) && (height == -1))
1937 gdk_window_get_size (window, &width, &height);
1938 else if (width == -1)
1939 gdk_window_get_size (window, &width, NULL);
1940 else if (height == -1)
1941 gdk_window_get_size (window, NULL, &height);
1943 half_width = width / 2;
1944 half_height = height / 2;
1948 gdk_gc_set_clip_rectangle (gc1, area);
1949 gdk_gc_set_clip_rectangle (gc2, area);
1952 gdk_gc_set_clip_rectangle (gc3, area);
1953 gdk_gc_set_clip_rectangle (gc4, area);
1962 points[0].x = x + half_width;
1965 points[1].y = y + height - 1;
1966 points[2].x = x + width - 1;
1967 points[2].y = y + height - 1;
1969 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
1972 switch (shadow_type)
1975 case GTK_SHADOW_OUT:
1977 gdk_draw_line (window, gc1,
1978 x + 1, y + height - 2,
1979 x + width - 2, y + height - 2);
1980 gdk_draw_line (window, gc3,
1981 x + 0, y + height - 1,
1982 x + width - 1, y + height - 1);
1984 gdk_draw_line (window, gc1,
1985 x + width - 2, y + height - 1,
1986 x + half_width, y + 1);
1987 gdk_draw_line (window, gc3,
1988 x + width - 1, y + height - 1,
1991 gdk_draw_line (window, gc4,
1992 x + half_width, y + 1,
1993 x + 1, y + height - 1);
1994 gdk_draw_line (window, gc2,
1999 case GTK_SHADOW_ETCHED_IN:
2000 case GTK_SHADOW_ETCHED_OUT:
2001 gdk_draw_line (window, gc1,
2002 x + half_width, y + 1,
2003 x + 1, y + height - 1);
2004 gdk_draw_line (window, gc1,
2005 x + 1, y + height - 1,
2006 x + width - 1, y + height - 1);
2007 gdk_draw_line (window, gc1,
2008 x + width - 1, y + height - 1,
2009 x + half_width + 1, y + 1);
2011 points[0].x = x + half_width;
2014 points[1].y = y + height - 2;
2015 points[2].x = x + width - 2;
2016 points[2].y = y + height - 2;
2018 gdk_draw_polygon (window, gc2, FALSE, points, 3);
2026 case GTK_ARROW_DOWN:
2029 points[0].x = x + width - 1;
2033 points[2].x = x + half_width;
2034 points[2].y = y + height - 1;
2036 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
2038 switch (shadow_type)
2041 case GTK_SHADOW_OUT:
2042 gdk_draw_line (window, gc4,
2044 y + 1, x + 1, y + 1);
2045 gdk_draw_line (window, gc2,
2049 gdk_draw_line (window, gc4,
2051 x + half_width, y + height - 2);
2052 gdk_draw_line (window, gc2,
2054 x + half_width, y + height - 1);
2056 gdk_draw_line (window, gc1,
2057 x + half_width, y + height - 2,
2059 gdk_draw_line (window, gc3,
2060 x + half_width, y + height - 1,
2064 case GTK_SHADOW_ETCHED_IN:
2065 case GTK_SHADOW_ETCHED_OUT:
2066 gdk_draw_line (window, gc1,
2067 x + width - 1, y + 1,
2069 gdk_draw_line (window, gc1,
2071 x + half_width + 1, y + height - 1);
2072 gdk_draw_line (window, gc1,
2073 x + half_width + 1, y + height - 2,
2076 points[0].x = x + width - 2;
2080 points[2].x = x + half_width;
2081 points[2].y = y + height - 2;
2083 gdk_draw_polygon (window, gc2, FALSE, points, 3);
2090 case GTK_ARROW_LEFT:
2094 points[0].y = y + half_height;
2095 points[1].x = x + width - 1;
2096 points[1].y = y + height - 1;
2097 points[2].x = x + width - 1;
2100 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
2103 switch (shadow_type)
2106 case GTK_SHADOW_OUT:
2107 gdk_draw_line (window, gc1,
2108 x + 1, y + half_height,
2109 x + width - 1, y + height - 1);
2110 gdk_draw_line (window, gc3,
2112 x + width - 1, y + height - 1);
2114 gdk_draw_line (window, gc1,
2115 x + width - 2, y + height - 1,
2116 x + width - 2, y + 1);
2117 gdk_draw_line (window, gc3,
2118 x + width - 1, y + height - 1,
2121 gdk_draw_line (window, gc4,
2122 x + width - 1, y + 1,
2123 x + 1, y + half_height);
2124 gdk_draw_line (window, gc2,
2126 x, y + half_height);
2129 case GTK_SHADOW_ETCHED_IN:
2130 case GTK_SHADOW_ETCHED_OUT:
2131 gdk_draw_line (window, gc1,
2132 x + width - 1, y + 1,
2133 x + 1, y + half_height);
2134 gdk_draw_line (window, gc1,
2135 x + 1, y + half_height + 1,
2136 x + width - 1, y + height - 1);
2137 gdk_draw_line (window, gc1,
2138 x + width - 1, y + height - 1,
2139 x + width - 1, y + 1);
2141 points[0].x = x + width - 2;
2144 points[1].y = y + half_height;
2145 points[2].x = x + width - 2;
2146 points[2].y = y + height - 2;
2148 gdk_draw_polygon (window, gc2, FALSE, points, 3);
2155 case GTK_ARROW_RIGHT:
2158 points[0].x = x + width - 1;
2159 points[0].y = y + half_height;
2163 points[2].y = y + height - 1;
2165 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
2168 switch (shadow_type)
2171 case GTK_SHADOW_OUT:
2172 gdk_draw_line (window, gc4,
2173 x + width - 1, y + half_height,
2175 gdk_draw_line (window, gc2,
2176 x + width - 1, y + half_height,
2178 gdk_draw_line (window, gc4,
2180 x + 1, y + height - 2);
2181 gdk_draw_line (window, gc2,
2185 gdk_draw_line (window, gc1,
2186 x + 1, y + height - 2,
2187 x + width - 1, y + half_height);
2188 gdk_draw_line (window, gc3,
2190 x + width - 1, y + half_height);
2193 case GTK_SHADOW_ETCHED_IN:
2194 case GTK_SHADOW_ETCHED_OUT:
2195 gdk_draw_line (window, gc1,
2196 x + width - 1, y + half_height + 1,
2198 gdk_draw_line (window, gc1,
2200 x + 1, y + height - 1);
2201 gdk_draw_line (window, gc1,
2202 x + 1, y + height - 1,
2203 x + width - 1, y + half_height + 1);
2205 points[0].x = x + width - 2;
2206 points[0].y = y + half_height;
2210 points[2].y = y + height - 1;
2212 gdk_draw_polygon (window, gc2, FALSE, points, 3);
2223 gdk_gc_set_clip_rectangle (gc1, NULL);
2224 gdk_gc_set_clip_rectangle (gc2, NULL);
2227 gdk_gc_set_clip_rectangle (gc3, NULL);
2228 gdk_gc_set_clip_rectangle (gc4, NULL);
2234 gtk_default_draw_diamond (GtkStyle *style,
2236 GtkStateType state_type,
2237 GtkShadowType shadow_type,
2240 const gchar *detail,
2249 g_return_if_fail (GTK_IS_STYLE (style));
2250 g_return_if_fail (window != NULL);
2252 if ((width == -1) && (height == -1))
2253 gdk_window_get_size (window, &width, &height);
2254 else if (width == -1)
2255 gdk_window_get_size (window, &width, NULL);
2256 else if (height == -1)
2257 gdk_window_get_size (window, NULL, &height);
2259 half_width = width / 2;
2260 half_height = height / 2;
2264 gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
2265 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
2266 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
2267 gdk_gc_set_clip_rectangle (style->black_gc, area);
2269 switch (shadow_type)
2272 gdk_draw_line (window, style->bg_gc[state_type],
2273 x + 2, y + half_height,
2274 x + half_width, y + height - 2);
2275 gdk_draw_line (window, style->bg_gc[state_type],
2276 x + half_width, y + height - 2,
2277 x + width - 2, y + half_height);
2278 gdk_draw_line (window, style->light_gc[state_type],
2279 x + 1, y + half_height,
2280 x + half_width, y + height - 1);
2281 gdk_draw_line (window, style->light_gc[state_type],
2282 x + half_width, y + height - 1,
2283 x + width - 1, y + half_height);
2284 gdk_draw_line (window, style->light_gc[state_type],
2286 x + half_width, y + height);
2287 gdk_draw_line (window, style->light_gc[state_type],
2288 x + half_width, y + height,
2289 x + width, y + half_height);
2291 gdk_draw_line (window, style->black_gc,
2292 x + 2, y + half_height,
2293 x + half_width, y + 2);
2294 gdk_draw_line (window, style->black_gc,
2295 x + half_width, y + 2,
2296 x + width - 2, y + half_height);
2297 gdk_draw_line (window, style->dark_gc[state_type],
2298 x + 1, y + half_height,
2299 x + half_width, y + 1);
2300 gdk_draw_line (window, style->dark_gc[state_type],
2301 x + half_width, y + 1,
2302 x + width - 1, y + half_height);
2303 gdk_draw_line (window, style->dark_gc[state_type],
2306 gdk_draw_line (window, style->dark_gc[state_type],
2308 x + width, y + half_height);
2310 case GTK_SHADOW_OUT:
2311 gdk_draw_line (window, style->dark_gc[state_type],
2312 x + 2, y + half_height,
2313 x + half_width, y + height - 2);
2314 gdk_draw_line (window, style->dark_gc[state_type],
2315 x + half_width, y + height - 2,
2316 x + width - 2, y + half_height);
2317 gdk_draw_line (window, style->dark_gc[state_type],
2318 x + 1, y + half_height,
2319 x + half_width, y + height - 1);
2320 gdk_draw_line (window, style->dark_gc[state_type],
2321 x + half_width, y + height - 1,
2322 x + width - 1, y + half_height);
2323 gdk_draw_line (window, style->black_gc,
2325 x + half_width, y + height);
2326 gdk_draw_line (window, style->black_gc,
2327 x + half_width, y + height,
2328 x + width, y + half_height);
2330 gdk_draw_line (window, style->bg_gc[state_type],
2331 x + 2, y + half_height,
2332 x + half_width, y + 2);
2333 gdk_draw_line (window, style->bg_gc[state_type],
2334 x + half_width, y + 2,
2335 x + width - 2, y + half_height);
2336 gdk_draw_line (window, style->light_gc[state_type],
2337 x + 1, y + half_height,
2338 x + half_width, y + 1);
2339 gdk_draw_line (window, style->light_gc[state_type],
2340 x + half_width, y + 1,
2341 x + width - 1, y + half_height);
2342 gdk_draw_line (window, style->light_gc[state_type],
2345 gdk_draw_line (window, style->light_gc[state_type],
2347 x + width, y + half_height);
2354 gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
2355 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
2356 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
2357 gdk_gc_set_clip_rectangle (style->black_gc, NULL);
2362 gtk_default_draw_oval (GtkStyle *style,
2364 GtkStateType state_type,
2365 GtkShadowType shadow_type,
2368 const gchar *detail,
2374 g_return_if_fail (GTK_IS_STYLE (style));
2375 g_return_if_fail (window != NULL);
2377 g_warning ("gtk_default_draw_oval(): FIXME, this function is currently unimplemented");
2381 gtk_default_draw_string (GtkStyle *style,
2383 GtkStateType state_type,
2386 const gchar *detail,
2389 const gchar *string)
2391 g_return_if_fail (GTK_IS_STYLE (style));
2392 g_return_if_fail (window != NULL);
2396 gdk_gc_set_clip_rectangle (style->white_gc, area);
2397 gdk_gc_set_clip_rectangle (style->fg_gc[state_type], area);
2400 if (state_type == GTK_STATE_INSENSITIVE)
2401 gdk_draw_string (window, style->font, style->white_gc, x + 1, y + 1, string);
2403 gdk_draw_string (window, style->font, style->fg_gc[state_type], x, y, string);
2407 gdk_gc_set_clip_rectangle (style->white_gc, NULL);
2408 gdk_gc_set_clip_rectangle (style->fg_gc[state_type], NULL);
2413 gtk_default_draw_box (GtkStyle *style,
2415 GtkStateType state_type,
2416 GtkShadowType shadow_type,
2419 const gchar *detail,
2425 g_return_if_fail (GTK_IS_STYLE (style));
2426 g_return_if_fail (window != NULL);
2428 if (width == -1 && height == -1)
2429 gdk_window_get_size (window, &width, &height);
2430 else if (width == -1)
2431 gdk_window_get_size (window, &width, NULL);
2432 else if (height == -1)
2433 gdk_window_get_size (window, NULL, &height);
2435 if (!style->bg_pixmap[state_type] ||
2436 GDK_IS_PIXMAP (window))
2439 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
2441 gdk_draw_rectangle (window, style->bg_gc[state_type], TRUE,
2442 x, y, width, height);
2444 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
2447 gtk_style_apply_default_background (style, window,
2448 widget && !GTK_WIDGET_NO_WINDOW (widget),
2449 state_type, area, x, y, width, height);
2451 gtk_paint_shadow (style, window, state_type, shadow_type, area, widget, detail,
2452 x, y, width, height);
2456 gtk_default_draw_flat_box (GtkStyle *style,
2458 GtkStateType state_type,
2459 GtkShadowType shadow_type,
2462 const gchar *detail,
2470 g_return_if_fail (GTK_IS_STYLE (style));
2471 g_return_if_fail (window != NULL);
2473 if (width == -1 && height == -1)
2474 gdk_window_get_size (window, &width, &height);
2475 else if (width == -1)
2476 gdk_window_get_size (window, &width, NULL);
2477 else if (height == -1)
2478 gdk_window_get_size (window, NULL, &height);
2482 if (!strcmp ("text", detail) && state_type == GTK_STATE_SELECTED)
2483 gc1 = style->bg_gc[GTK_STATE_SELECTED];
2484 else if (!strcmp ("viewportbin", detail))
2485 gc1 = style->bg_gc[GTK_STATE_NORMAL];
2486 else if (!strcmp ("entry_bg", detail))
2487 gc1 = style->base_gc[state_type];
2489 gc1 = style->bg_gc[state_type];
2492 gc1 = style->bg_gc[state_type];
2494 if (!style->bg_pixmap[state_type] || gc1 != style->bg_gc[state_type] ||
2495 GDK_IS_PIXMAP (window))
2498 gdk_gc_set_clip_rectangle (gc1, area);
2500 gdk_draw_rectangle (window, gc1, TRUE,
2501 x, y, width, height);
2503 if (detail && !strcmp ("tooltip", detail))
2504 gdk_draw_rectangle (window, style->black_gc, FALSE,
2505 x, y, width - 1, height - 1);
2508 gdk_gc_set_clip_rectangle (gc1, NULL);
2511 gtk_style_apply_default_background (style, window,
2512 widget && !GTK_WIDGET_NO_WINDOW (widget),
2513 state_type, area, x, y, width, height);
2517 gtk_default_draw_check (GtkStyle *style,
2519 GtkStateType state_type,
2520 GtkShadowType shadow_type,
2523 const gchar *detail,
2529 gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail,
2530 x, y, width, height);
2534 gtk_default_draw_option (GtkStyle *style,
2536 GtkStateType state_type,
2537 GtkShadowType shadow_type,
2540 const gchar *detail,
2546 gtk_paint_diamond (style, window, state_type, shadow_type, area, widget,
2547 detail, x, y, width, height);
2551 gtk_default_draw_cross (GtkStyle *style,
2553 GtkStateType state_type,
2554 GtkShadowType shadow_type,
2557 const gchar *detail,
2563 g_return_if_fail (GTK_IS_STYLE (style));
2564 g_return_if_fail (window != NULL);
2566 g_warning ("gtk_default_draw_cross(): FIXME, this function is currently unimplemented");
2570 gtk_default_draw_ramp (GtkStyle *style,
2572 GtkStateType state_type,
2573 GtkShadowType shadow_type,
2576 const gchar *detail,
2577 GtkArrowType arrow_type,
2583 g_return_if_fail (GTK_IS_STYLE (style));
2584 g_return_if_fail (window != NULL);
2586 g_warning ("gtk_default_draw_ramp(): FIXME, this function is currently unimplemented");
2590 gtk_default_draw_tab (GtkStyle *style,
2592 GtkStateType state_type,
2593 GtkShadowType shadow_type,
2596 const gchar *detail,
2602 g_return_if_fail (GTK_IS_STYLE (style));
2603 g_return_if_fail (window != NULL);
2605 gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail,
2606 x, y, width, height);
2610 gtk_default_draw_shadow_gap (GtkStyle *style,
2612 GtkStateType state_type,
2613 GtkShadowType shadow_type,
2616 const gchar *detail,
2621 GtkPositionType gap_side,
2630 g_return_if_fail (GTK_IS_STYLE (style));
2631 g_return_if_fail (window != NULL);
2633 if (width == -1 && height == -1)
2634 gdk_window_get_size (window, &width, &height);
2635 else if (width == -1)
2636 gdk_window_get_size (window, &width, NULL);
2637 else if (height == -1)
2638 gdk_window_get_size (window, NULL, &height);
2640 switch (shadow_type)
2642 case GTK_SHADOW_NONE:
2645 gc1 = style->dark_gc[state_type];
2646 gc2 = style->black_gc;
2647 gc3 = style->bg_gc[state_type];
2648 gc4 = style->light_gc[state_type];
2650 case GTK_SHADOW_ETCHED_IN:
2651 gc1 = style->dark_gc[state_type];
2652 gc2 = style->light_gc[state_type];
2653 gc3 = style->dark_gc[state_type];
2654 gc4 = style->light_gc[state_type];
2656 case GTK_SHADOW_OUT:
2657 gc1 = style->light_gc[state_type];
2658 gc2 = style->bg_gc[state_type];
2659 gc3 = style->dark_gc[state_type];
2660 gc4 = style->black_gc;
2662 case GTK_SHADOW_ETCHED_OUT:
2663 gc1 = style->light_gc[state_type];
2664 gc2 = style->dark_gc[state_type];
2665 gc3 = style->light_gc[state_type];
2666 gc4 = style->dark_gc[state_type];
2671 gdk_gc_set_clip_rectangle (gc1, area);
2672 gdk_gc_set_clip_rectangle (gc2, area);
2673 gdk_gc_set_clip_rectangle (gc3, area);
2674 gdk_gc_set_clip_rectangle (gc4, area);
2677 switch (shadow_type)
2679 case GTK_SHADOW_NONE:
2681 case GTK_SHADOW_OUT:
2682 case GTK_SHADOW_ETCHED_IN:
2683 case GTK_SHADOW_ETCHED_OUT:
2687 gdk_draw_line (window, gc1,
2688 x, y, x, y + height - 1);
2689 gdk_draw_line (window, gc2,
2690 x + 1, y, x + 1, y + height - 2);
2692 gdk_draw_line (window, gc3,
2693 x + 1, y + height - 2, x + width - 2, y + height - 2);
2694 gdk_draw_line (window, gc3,
2695 x + width - 2, y, x + width - 2, y + height - 2);
2696 gdk_draw_line (window, gc4,
2697 x, y + height - 1, x + width - 1, y + height - 1);
2698 gdk_draw_line (window, gc4,
2699 x + width - 1, y, x + width - 1, y + height - 1);
2702 gdk_draw_line (window, gc1,
2703 x, y, x + gap_x - 1, y);
2704 gdk_draw_line (window, gc2,
2705 x + 1, y + 1, x + gap_x - 1, y + 1);
2706 gdk_draw_line (window, gc2,
2707 x + gap_x, y, x + gap_x, y);
2709 if ((width - (gap_x + gap_width)) > 0)
2711 gdk_draw_line (window, gc1,
2712 x + gap_x + gap_width, y, x + width - 2, y);
2713 gdk_draw_line (window, gc2,
2714 x + gap_x + gap_width, y + 1, x + width - 2, y + 1);
2715 gdk_draw_line (window, gc2,
2716 x + gap_x + gap_width - 1, y, x + gap_x + gap_width - 1, y);
2719 case GTK_POS_BOTTOM:
2720 gdk_draw_line (window, gc1,
2721 x, y, x + width - 1, y);
2722 gdk_draw_line (window, gc1,
2723 x, y, x, y + height - 1);
2724 gdk_draw_line (window, gc2,
2725 x + 1, y + 1, x + width - 2, y + 1);
2726 gdk_draw_line (window, gc2,
2727 x + 1, y + 1, x + 1, y + height - 1);
2729 gdk_draw_line (window, gc3,
2730 x + width - 2, y + 1, x + width - 2, y + height - 1);
2731 gdk_draw_line (window, gc4,
2732 x + width - 1, y, x + width - 1, y + height - 1);
2735 gdk_draw_line (window, gc4,
2736 x, y + height - 1, x + gap_x - 1, y + height - 1);
2737 gdk_draw_line (window, gc3,
2738 x + 1, y + height - 2, x + gap_x - 1, y + height - 2);
2739 gdk_draw_line (window, gc3,
2740 x + gap_x, y + height - 1, x + gap_x, y + height - 1);
2742 if ((width - (gap_x + gap_width)) > 0)
2744 gdk_draw_line (window, gc4,
2745 x + gap_x + gap_width, y + height - 1, x + width - 2, y + height - 1);
2746 gdk_draw_line (window, gc3,
2747 x + gap_x + gap_width, y + height - 2, x + width - 2, y + height - 2);
2748 gdk_draw_line (window, gc3,
2749 x + gap_x + gap_width - 1, y + height - 1, x + gap_x + gap_width - 1, y + height - 1);
2753 gdk_draw_line (window, gc1,
2754 x, y, x + width - 1, y);
2755 gdk_draw_line (window, gc2,
2756 x, y + 1, x + width - 2, y + 1);
2758 gdk_draw_line (window, gc3,
2759 x, y + height - 2, x + width - 2, y + height - 2);
2760 gdk_draw_line (window, gc3,
2761 x + width - 2, y + 1, x + width - 2, y + height - 2);
2762 gdk_draw_line (window, gc4,
2763 x, y + height - 1, x + width - 1, y + height - 1);
2764 gdk_draw_line (window, gc4,
2765 x + width - 1, y, x + width - 1, y + height - 1);
2768 gdk_draw_line (window, gc1,
2769 x, y, x, y + gap_x - 1);
2770 gdk_draw_line (window, gc2,
2771 x + 1, y + 1, x + 1, y + gap_x - 1);
2772 gdk_draw_line (window, gc2,
2773 x, y + gap_x, x, y + gap_x);
2775 if ((width - (gap_x + gap_width)) > 0)
2777 gdk_draw_line (window, gc1,
2778 x, y + gap_x + gap_width, x, y + height - 2);
2779 gdk_draw_line (window, gc2,
2780 x + 1, y + gap_x + gap_width, x + 1, y + height - 2);
2781 gdk_draw_line (window, gc2,
2782 x, y + gap_x + gap_width - 1, x, y + gap_x + gap_width - 1);
2786 gdk_draw_line (window, gc1,
2787 x, y, x + width - 1, y);
2788 gdk_draw_line (window, gc1,
2789 x, y, x, y + height - 1);
2790 gdk_draw_line (window, gc2,
2791 x + 1, y + 1, x + width - 1, y + 1);
2792 gdk_draw_line (window, gc2,
2793 x + 1, y + 1, x + 1, y + height - 2);
2795 gdk_draw_line (window, gc3,
2796 x + 1, y + height - 2, x + width - 1, y + height - 2);
2797 gdk_draw_line (window, gc4,
2798 x, y + height - 1, x + width - 1, y + height - 1);
2801 gdk_draw_line (window, gc4,
2802 x + width - 1, y, x + width - 1, y + gap_x - 1);
2803 gdk_draw_line (window, gc3,
2804 x + width - 2, y + 1, x + width - 2, y + gap_x - 1);
2805 gdk_draw_line (window, gc3,
2806 x + width - 1, y + gap_x, x + width - 1, y + gap_x);
2808 if ((width - (gap_x + gap_width)) > 0)
2810 gdk_draw_line (window, gc4,
2811 x + width - 1, y + gap_x + gap_width, x + width - 1, y + height - 2);
2812 gdk_draw_line (window, gc3,
2813 x + width - 2, y + gap_x + gap_width, x + width - 2, y + height - 2);
2814 gdk_draw_line (window, gc3,
2815 x + width - 1, y + gap_x + gap_width - 1, x + width - 1, y + gap_x + gap_width - 1);
2823 gdk_gc_set_clip_rectangle (gc1, NULL);
2824 gdk_gc_set_clip_rectangle (gc2, NULL);
2825 gdk_gc_set_clip_rectangle (gc3, NULL);
2826 gdk_gc_set_clip_rectangle (gc4, NULL);
2831 gtk_default_draw_box_gap (GtkStyle *style,
2833 GtkStateType state_type,
2834 GtkShadowType shadow_type,
2837 const gchar *detail,
2842 GtkPositionType gap_side,
2851 g_return_if_fail (GTK_IS_STYLE (style));
2852 g_return_if_fail (window != NULL);
2854 gtk_style_apply_default_background (style, window,
2855 widget && !GTK_WIDGET_NO_WINDOW (widget),
2856 state_type, 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 gdk_draw_line (window, gc1,
2914 x, y, x, y + height - 1);
2915 gdk_draw_line (window, gc2,
2916 x + 1, y, x + 1, y + height - 2);
2918 gdk_draw_line (window, gc3,
2919 x + 1, y + height - 2, x + width - 2, y + height - 2);
2920 gdk_draw_line (window, gc3,
2921 x + width - 2, y, x + width - 2, y + height - 2);
2922 gdk_draw_line (window, gc4,
2923 x, y + height - 1, x + width - 1, y + height - 1);
2924 gdk_draw_line (window, gc4,
2925 x + width - 1, y, x + width - 1, y + height - 1);
2928 gdk_draw_line (window, gc1,
2929 x, y, x + gap_x - 1, y);
2930 gdk_draw_line (window, gc2,
2931 x + 1, y + 1, x + gap_x - 1, y + 1);
2932 gdk_draw_line (window, gc2,
2933 x + gap_x, y, x + gap_x, y);
2935 if ((width - (gap_x + gap_width)) > 0)
2937 gdk_draw_line (window, gc1,
2938 x + gap_x + gap_width, y, x + width - 2, y);
2939 gdk_draw_line (window, gc2,
2940 x + gap_x + gap_width, y + 1, x + width - 2, y + 1);
2941 gdk_draw_line (window, gc2,
2942 x + gap_x + gap_width - 1, y, x + gap_x + gap_width - 1, y);
2945 case GTK_POS_BOTTOM:
2946 gdk_draw_line (window, gc1,
2947 x, y, x + width - 1, y);
2948 gdk_draw_line (window, gc1,
2949 x, y, x, y + height - 1);
2950 gdk_draw_line (window, gc2,
2951 x + 1, y + 1, x + width - 2, y + 1);
2952 gdk_draw_line (window, gc2,
2953 x + 1, y + 1, x + 1, y + height - 1);
2955 gdk_draw_line (window, gc3,
2956 x + width - 2, y + 1, x + width - 2, y + height - 1);
2957 gdk_draw_line (window, gc4,
2958 x + width - 1, y, x + width - 1, y + height - 1);
2961 gdk_draw_line (window, gc4,
2962 x, y + height - 1, x + gap_x - 1, y + height - 1);
2963 gdk_draw_line (window, gc3,
2964 x + 1, y + height - 2, x + gap_x - 1, y + height - 2);
2965 gdk_draw_line (window, gc3,
2966 x + gap_x, y + height - 1, x + gap_x, y + height - 1);
2968 if ((width - (gap_x + gap_width)) > 0)
2970 gdk_draw_line (window, gc4,
2971 x + gap_x + gap_width, y + height - 1, x + width - 2, y + height - 1);
2972 gdk_draw_line (window, gc3,
2973 x + gap_x + gap_width, y + height - 2, x + width - 2, y + height - 2);
2974 gdk_draw_line (window, gc3,
2975 x + gap_x + gap_width - 1, y + height - 1, x + gap_x + gap_width - 1, y + height - 1);
2979 gdk_draw_line (window, gc1,
2980 x, y, x + width - 1, y);
2981 gdk_draw_line (window, gc2,
2982 x, y + 1, x + width - 2, y + 1);
2984 gdk_draw_line (window, gc3,
2985 x, y + height - 2, x + width - 2, y + height - 2);
2986 gdk_draw_line (window, gc3,
2987 x + width - 2, y + 1, x + width - 2, y + height - 2);
2988 gdk_draw_line (window, gc4,
2989 x, y + height - 1, x + width - 1, y + height - 1);
2990 gdk_draw_line (window, gc4,
2991 x + width - 1, y, x + width - 1, y + height - 1);
2994 gdk_draw_line (window, gc1,
2995 x, y, x, y + gap_x - 1);
2996 gdk_draw_line (window, gc2,
2997 x + 1, y + 1, x + 1, y + gap_x - 1);
2998 gdk_draw_line (window, gc2,
2999 x, y + gap_x, x, y + gap_x);
3001 if ((width - (gap_x + gap_width)) > 0)
3003 gdk_draw_line (window, gc1,
3004 x, y + gap_x + gap_width, x, y + height - 2);
3005 gdk_draw_line (window, gc2,
3006 x + 1, y + gap_x + gap_width, x + 1, y + height - 2);
3007 gdk_draw_line (window, gc2,
3008 x, y + gap_x + gap_width - 1, x, y + gap_x + gap_width - 1);
3012 gdk_draw_line (window, gc1,
3013 x, y, x + width - 1, y);
3014 gdk_draw_line (window, gc1,
3015 x, y, x, y + height - 1);
3016 gdk_draw_line (window, gc2,
3017 x + 1, y + 1, x + width - 1, y + 1);
3018 gdk_draw_line (window, gc2,
3019 x + 1, y + 1, x + 1, y + height - 2);
3021 gdk_draw_line (window, gc3,
3022 x + 1, y + height - 2, x + width - 1, y + height - 2);
3023 gdk_draw_line (window, gc4,
3024 x, y + height - 1, x + width - 1, y + height - 1);
3027 gdk_draw_line (window, gc4,
3028 x + width - 1, y, x + width - 1, y + gap_x - 1);
3029 gdk_draw_line (window, gc3,
3030 x + width - 2, y + 1, x + width - 2, y + gap_x - 1);
3031 gdk_draw_line (window, gc3,
3032 x + width - 1, y + gap_x, x + width - 1, y + gap_x);
3034 if ((width - (gap_x + gap_width)) > 0)
3036 gdk_draw_line (window, gc4,
3037 x + width - 1, y + gap_x + gap_width, x + width - 1, y + height - 2);
3038 gdk_draw_line (window, gc3,
3039 x + width - 2, y + gap_x + gap_width, x + width - 2, y + height - 2);
3040 gdk_draw_line (window, gc3,
3041 x + width - 1, y + gap_x + gap_width - 1, x + width - 1, y + gap_x + gap_width - 1);
3049 gdk_gc_set_clip_rectangle (gc1, NULL);
3050 gdk_gc_set_clip_rectangle (gc2, NULL);
3051 gdk_gc_set_clip_rectangle (gc3, NULL);
3052 gdk_gc_set_clip_rectangle (gc4, NULL);
3057 gtk_default_draw_extension (GtkStyle *style,
3059 GtkStateType state_type,
3060 GtkShadowType shadow_type,
3063 const gchar *detail,
3068 GtkPositionType gap_side)
3075 g_return_if_fail (GTK_IS_STYLE (style));
3076 g_return_if_fail (window != NULL);
3078 gtk_style_apply_default_background (style, window,
3079 widget && !GTK_WIDGET_NO_WINDOW (widget),
3080 GTK_STATE_NORMAL, area, x, y, width, height);
3082 if (width == -1 && height == -1)
3083 gdk_window_get_size (window, &width, &height);
3084 else if (width == -1)
3085 gdk_window_get_size (window, &width, NULL);
3086 else if (height == -1)
3087 gdk_window_get_size (window, NULL, &height);
3089 switch (shadow_type)
3091 case GTK_SHADOW_NONE:
3094 gc1 = style->dark_gc[state_type];
3095 gc2 = style->black_gc;
3096 gc3 = style->bg_gc[state_type];
3097 gc4 = style->light_gc[state_type];
3099 case GTK_SHADOW_ETCHED_IN:
3100 gc1 = style->dark_gc[state_type];
3101 gc2 = style->light_gc[state_type];
3102 gc3 = style->dark_gc[state_type];
3103 gc4 = style->light_gc[state_type];
3105 case GTK_SHADOW_OUT:
3106 gc1 = style->light_gc[state_type];
3107 gc2 = style->bg_gc[state_type];
3108 gc3 = style->dark_gc[state_type];
3109 gc4 = style->black_gc;
3111 case GTK_SHADOW_ETCHED_OUT:
3112 gc1 = style->light_gc[state_type];
3113 gc2 = style->dark_gc[state_type];
3114 gc3 = style->light_gc[state_type];
3115 gc4 = style->dark_gc[state_type];
3121 gdk_gc_set_clip_rectangle (gc1, area);
3122 gdk_gc_set_clip_rectangle (gc2, area);
3123 gdk_gc_set_clip_rectangle (gc3, area);
3124 gdk_gc_set_clip_rectangle (gc4, area);
3127 switch (shadow_type)
3129 case GTK_SHADOW_NONE:
3131 case GTK_SHADOW_OUT:
3132 case GTK_SHADOW_ETCHED_IN:
3133 case GTK_SHADOW_ETCHED_OUT:
3137 gtk_style_apply_default_background (style, window,
3138 widget && !GTK_WIDGET_NO_WINDOW (widget),
3140 x + style->xthickness,
3142 width - (2 * style->xthickness),
3143 height - (style->ythickness));
3144 gdk_draw_line (window, gc1,
3145 x, y, x, y + height - 2);
3146 gdk_draw_line (window, gc2,
3147 x + 1, y, x + 1, y + height - 2);
3149 gdk_draw_line (window, gc3,
3150 x + 2, y + height - 2, x + width - 2, y + height - 2);
3151 gdk_draw_line (window, gc3,
3152 x + width - 2, y, x + width - 2, y + height - 2);
3153 gdk_draw_line (window, gc4,
3154 x + 1, y + height - 1, x + width - 2, y + height - 1);
3155 gdk_draw_line (window, gc4,
3156 x + width - 1, y, x + width - 1, y + height - 2);
3158 case GTK_POS_BOTTOM:
3159 gtk_style_apply_default_background (style, window,
3160 widget && !GTK_WIDGET_NO_WINDOW (widget),
3162 x + style->xthickness,
3163 y + style->ythickness,
3164 width - (2 * style->xthickness),
3165 height - (style->ythickness));
3166 gdk_draw_line (window, gc1,
3167 x + 1, y, x + width - 2, y);
3168 gdk_draw_line (window, gc1,
3169 x, y + 1, x, y + height - 1);
3170 gdk_draw_line (window, gc2,
3171 x + 1, y + 1, x + width - 2, y + 1);
3172 gdk_draw_line (window, gc2,
3173 x + 1, y + 1, x + 1, y + height - 1);
3175 gdk_draw_line (window, gc3,
3176 x + width - 2, y + 2, x + width - 2, y + height - 1);
3177 gdk_draw_line (window, gc4,
3178 x + width - 1, y + 1, x + width - 1, y + height - 1);
3181 gtk_style_apply_default_background (style, window,
3182 widget && !GTK_WIDGET_NO_WINDOW (widget),
3185 y + style->ythickness,
3186 width - (style->xthickness),
3187 height - (2 * style->ythickness));
3188 gdk_draw_line (window, gc1,
3189 x, y, x + width - 2, y);
3190 gdk_draw_line (window, gc2,
3191 x + 1, y + 1, x + width - 2, y + 1);
3193 gdk_draw_line (window, gc3,
3194 x, y + height - 2, x + width - 2, y + height - 2);
3195 gdk_draw_line (window, gc3,
3196 x + width - 2, y + 2, x + width - 2, y + height - 2);
3197 gdk_draw_line (window, gc4,
3198 x, y + height - 1, x + width - 2, y + height - 1);
3199 gdk_draw_line (window, gc4,
3200 x + width - 1, y + 1, x + width - 1, y + height - 2);
3203 gtk_style_apply_default_background (style, window,
3204 widget && !GTK_WIDGET_NO_WINDOW (widget),
3206 x + style->xthickness,
3207 y + style->ythickness,
3208 width - (style->xthickness),
3209 height - (2 * style->ythickness));
3210 gdk_draw_line (window, gc1,
3211 x + 1, y, x + width - 1, y);
3212 gdk_draw_line (window, gc1,
3213 x, y + 1, x, y + height - 2);
3214 gdk_draw_line (window, gc2,
3215 x + 1, y + 1, x + width - 1, y + 1);
3216 gdk_draw_line (window, gc2,
3217 x + 1, y + 1, x + 1, y + height - 2);
3219 gdk_draw_line (window, gc3,
3220 x + 2, y + height - 2, x + width - 1, y + height - 2);
3221 gdk_draw_line (window, gc4,
3222 x + 1, y + height - 1, x + width - 1, y + height - 1);
3229 gdk_gc_set_clip_rectangle (gc1, NULL);
3230 gdk_gc_set_clip_rectangle (gc2, NULL);
3231 gdk_gc_set_clip_rectangle (gc3, NULL);
3232 gdk_gc_set_clip_rectangle (gc4, NULL);
3237 gtk_default_draw_focus (GtkStyle *style,
3241 const gchar *detail,
3247 g_return_if_fail (GTK_IS_STYLE (style));
3248 g_return_if_fail (window != NULL);
3250 if (width == -1 && height == -1)
3252 gdk_window_get_size (window, &width, &height);
3256 else if (width == -1)
3258 gdk_window_get_size (window, &width, NULL);
3261 else if (height == -1)
3263 gdk_window_get_size (window, NULL, &height);
3268 gdk_gc_set_clip_rectangle (style->black_gc, area);
3270 if (detail && !strcmp (detail, "add-mode"))
3272 gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_ON_OFF_DASH, 0, 0);
3273 gdk_gc_set_dashes (style->black_gc, 0, "\4\4", 2);
3275 gdk_draw_rectangle (window,
3276 style->black_gc, FALSE,
3277 x, y, width, height);
3279 gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_SOLID, 0, 0);
3283 gdk_draw_rectangle (window,
3284 style->black_gc, FALSE,
3285 x, y, width, height);
3289 gdk_gc_set_clip_rectangle (style->black_gc, NULL);
3293 gtk_default_draw_slider (GtkStyle *style,
3295 GtkStateType state_type,
3296 GtkShadowType shadow_type,
3299 const gchar *detail,
3304 GtkOrientation orientation)
3306 g_return_if_fail (GTK_IS_STYLE (style));
3307 g_return_if_fail (window != NULL);
3309 if (width == -1 && height == -1)
3310 gdk_window_get_size (window, &width, &height);
3311 else if (width == -1)
3312 gdk_window_get_size (window, &width, NULL);
3313 else if (height == -1)
3314 gdk_window_get_size (window, NULL, &height);
3316 gtk_paint_box (style, window, state_type, shadow_type,
3317 area, widget, detail, x, y, width, height);
3319 if (orientation == GTK_ORIENTATION_HORIZONTAL)
3320 gtk_paint_vline (style, window, state_type, area, widget, detail,
3322 height - style->ythickness - 1, width / 2);
3324 gtk_paint_hline (style, window, state_type, area, widget, detail,
3326 width - style->xthickness - 1, height / 2);
3330 draw_dot (GdkWindow *window,
3338 size = CLAMP (size, 2, 3);
3342 gdk_draw_point (window, light_gc, x, y);
3343 gdk_draw_point (window, light_gc, x+1, y+1);
3345 else if (size == 3);
3347 gdk_draw_point (window, light_gc, x, y);
3348 gdk_draw_point (window, light_gc, x+1, y);
3349 gdk_draw_point (window, light_gc, x, y+1);
3350 gdk_draw_point (window, dark_gc, x+1, y+2);
3351 gdk_draw_point (window, dark_gc, x+2, y+1);
3352 gdk_draw_point (window, dark_gc, x+2, y+2);
3357 gtk_default_draw_handle (GtkStyle *style,
3359 GtkStateType state_type,
3360 GtkShadowType shadow_type,
3363 const gchar *detail,
3368 GtkOrientation orientation)
3371 gint xthick, ythick;
3372 GdkGC *light_gc, *dark_gc;
3377 g_return_if_fail (GTK_IS_STYLE (style));
3378 g_return_if_fail (window != NULL);
3380 if (width == -1 && height == -1)
3381 gdk_window_get_size (window, &width, &height);
3382 else if (width == -1)
3383 gdk_window_get_size (window, &width, NULL);
3384 else if (height == -1)
3385 gdk_window_get_size (window, NULL, &height);
3387 gtk_paint_box (style, window, state_type, shadow_type, area, widget,
3388 detail, x, y, width, height);
3391 if (!strcmp (detail, "paned"))
3393 /* we want to ignore the shadow border in paned widgets */
3397 light_gc = style->light_gc[state_type];
3398 dark_gc = style->black_gc;
3402 xthick = style->xthickness;
3403 ythick = style->ythickness;
3405 light_gc = style->light_gc[state_type];
3406 dark_gc = style->dark_gc[state_type];
3409 rect.x = x + xthick;
3410 rect.y = y + ythick;
3411 rect.width = width - (xthick * 2);
3412 rect.height = height - (ythick * 2);
3415 intersect = gdk_rectangle_intersect (area, &rect, &dest);
3425 gdk_gc_set_clip_rectangle (light_gc, &dest);
3426 gdk_gc_set_clip_rectangle (dark_gc, &dest);
3428 if (!strcmp (detail, "paned"))
3433 gdk_window_get_size (window, &window_width, &window_height);
3435 if (orientation == GTK_ORIENTATION_HORIZONTAL)
3436 for (xx = window_width/2 - 15; xx <= window_width/2 + 15; xx += 5)
3437 draw_dot (window, light_gc, dark_gc, xx, window_height/2 - 1, 3);
3439 for (yy = window_height/2 - 15; yy <= window_height/2 + 15; yy += 5)
3440 draw_dot (window, light_gc, dark_gc, window_width/2 - 1, yy, 3);
3444 for (yy = y + ythick; yy < (y + height - ythick); yy += 3)
3445 for (xx = x + xthick; xx < (x + width - xthick); xx += 6)
3447 draw_dot (window, light_gc, dark_gc, xx, yy, 2);
3448 draw_dot (window, light_gc, dark_gc, xx + 3, yy + 1, 2);
3452 gdk_gc_set_clip_rectangle (light_gc, NULL);
3453 gdk_gc_set_clip_rectangle (dark_gc, NULL);
3457 gtk_style_shade (GdkColor *a,
3465 red = (gdouble) a->red / 65535.0;
3466 green = (gdouble) a->green / 65535.0;
3467 blue = (gdouble) a->blue / 65535.0;
3469 rgb_to_hls (&red, &green, &blue);
3474 else if (green < 0.0)
3480 else if (blue < 0.0)
3483 hls_to_rgb (&red, &green, &blue);
3485 b->red = red * 65535.0;
3486 b->green = green * 65535.0;
3487 b->blue = blue * 65535.0;
3491 rgb_to_hls (gdouble *r,
3532 l = (max + min) / 2;
3539 s = (max - min) / (max + min);
3541 s = (max - min) / (2 - max - min);
3545 h = (green - blue) / delta;
3546 else if (green == max)
3547 h = 2 + (blue - red) / delta;
3548 else if (blue == max)
3549 h = 4 + (red - green) / delta;
3562 hls_to_rgb (gdouble *h,
3575 if (lightness <= 0.5)
3576 m2 = lightness * (1 + saturation);
3578 m2 = lightness + saturation - lightness * saturation;
3579 m1 = 2 * lightness - m2;
3581 if (saturation == 0)
3596 r = m1 + (m2 - m1) * hue / 60;
3600 r = m1 + (m2 - m1) * (240 - hue) / 60;
3611 g = m1 + (m2 - m1) * hue / 60;
3615 g = m1 + (m2 - m1) * (240 - hue) / 60;
3626 b = m1 + (m2 - m1) * hue / 60;
3630 b = m1 + (m2 - m1) * (240 - hue) / 60;
3641 gtk_paint_hline (GtkStyle *style,
3643 GtkStateType state_type,
3646 const gchar *detail,
3651 g_return_if_fail (GTK_IS_STYLE (style));
3652 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL);
3654 GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type, area, widget, detail, x1, x2, y);
3658 gtk_paint_vline (GtkStyle *style,
3660 GtkStateType state_type,
3663 const gchar *detail,
3668 g_return_if_fail (GTK_IS_STYLE (style));
3669 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL);
3671 GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type, area, widget, detail, y1, y2, x);
3675 gtk_paint_shadow (GtkStyle *style,
3677 GtkStateType state_type,
3678 GtkShadowType shadow_type,
3681 const gchar *detail,
3687 g_return_if_fail (GTK_IS_STYLE (style));
3688 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
3690 GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3694 gtk_paint_polygon (GtkStyle *style,
3696 GtkStateType state_type,
3697 GtkShadowType shadow_type,
3700 const gchar *detail,
3705 g_return_if_fail (GTK_IS_STYLE (style));
3706 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
3708 GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type, area, widget, detail, points, npoints, fill);
3712 gtk_paint_arrow (GtkStyle *style,
3714 GtkStateType state_type,
3715 GtkShadowType shadow_type,
3718 const gchar *detail,
3719 GtkArrowType arrow_type,
3726 g_return_if_fail (GTK_IS_STYLE (style));
3727 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL);
3729 GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height);
3733 gtk_paint_diamond (GtkStyle *style,
3735 GtkStateType state_type,
3736 GtkShadowType shadow_type,
3739 const gchar *detail,
3745 g_return_if_fail (GTK_IS_STYLE (style));
3746 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL);
3748 GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3752 gtk_paint_oval (GtkStyle *style,
3754 GtkStateType state_type,
3755 GtkShadowType shadow_type,
3758 const gchar *detail,
3764 g_return_if_fail (GTK_IS_STYLE (style));
3765 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_oval != NULL);
3767 GTK_STYLE_GET_CLASS (style)->draw_oval (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3771 gtk_paint_string (GtkStyle *style,
3773 GtkStateType state_type,
3776 const gchar *detail,
3779 const gchar *string)
3781 g_return_if_fail (GTK_IS_STYLE (style));
3782 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_string != NULL);
3784 GTK_STYLE_GET_CLASS (style)->draw_string (style, window, state_type, area, widget, detail, x, y, string);
3788 gtk_paint_box (GtkStyle *style,
3790 GtkStateType state_type,
3791 GtkShadowType shadow_type,
3794 const gchar *detail,
3800 g_return_if_fail (GTK_IS_STYLE (style));
3801 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL);
3803 GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3807 gtk_paint_flat_box (GtkStyle *style,
3809 GtkStateType state_type,
3810 GtkShadowType shadow_type,
3813 const gchar *detail,
3819 g_return_if_fail (GTK_IS_STYLE (style));
3820 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL);
3822 GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3826 gtk_paint_check (GtkStyle *style,
3828 GtkStateType state_type,
3829 GtkShadowType shadow_type,
3832 const gchar *detail,
3838 g_return_if_fail (GTK_IS_STYLE (style));
3839 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL);
3841 GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3845 gtk_paint_option (GtkStyle *style,
3847 GtkStateType state_type,
3848 GtkShadowType shadow_type,
3851 const gchar *detail,
3857 g_return_if_fail (GTK_IS_STYLE (style));
3858 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL);
3860 GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3864 gtk_paint_cross (GtkStyle *style,
3866 GtkStateType state_type,
3867 GtkShadowType shadow_type,
3870 const gchar *detail,
3876 g_return_if_fail (GTK_IS_STYLE (style));
3877 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_cross != NULL);
3879 GTK_STYLE_GET_CLASS (style)->draw_cross (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3883 gtk_paint_ramp (GtkStyle *style,
3885 GtkStateType state_type,
3886 GtkShadowType shadow_type,
3889 const gchar *detail,
3890 GtkArrowType arrow_type,
3896 g_return_if_fail (GTK_IS_STYLE (style));
3897 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_ramp != NULL);
3899 GTK_STYLE_GET_CLASS (style)->draw_ramp (style, window, state_type, shadow_type, area, widget, detail, arrow_type, x, y, width, height);
3903 gtk_paint_tab (GtkStyle *style,
3905 GtkStateType state_type,
3906 GtkShadowType shadow_type,
3909 const gchar *detail,
3915 g_return_if_fail (GTK_IS_STYLE (style));
3916 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL);
3918 GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3922 gtk_paint_shadow_gap (GtkStyle *style,
3924 GtkStateType state_type,
3925 GtkShadowType shadow_type,
3933 GtkPositionType gap_side,
3937 g_return_if_fail (GTK_IS_STYLE (style));
3938 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL);
3940 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);
3945 gtk_paint_box_gap (GtkStyle *style,
3947 GtkStateType state_type,
3948 GtkShadowType shadow_type,
3956 GtkPositionType gap_side,
3960 g_return_if_fail (GTK_IS_STYLE (style));
3961 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL);
3963 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);
3967 gtk_paint_extension (GtkStyle *style,
3969 GtkStateType state_type,
3970 GtkShadowType shadow_type,
3978 GtkPositionType gap_side)
3980 g_return_if_fail (GTK_IS_STYLE (style));
3981 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL);
3983 GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side);
3987 gtk_paint_focus (GtkStyle *style,
3991 const gchar *detail,
3997 g_return_if_fail (GTK_IS_STYLE (style));
3998 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL);
4000 GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, area, widget, detail, x, y, width, height);
4004 gtk_paint_slider (GtkStyle *style,
4006 GtkStateType state_type,
4007 GtkShadowType shadow_type,
4010 const gchar *detail,
4015 GtkOrientation orientation)
4017 g_return_if_fail (GTK_IS_STYLE (style));
4018 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_slider != NULL);
4020 GTK_STYLE_GET_CLASS (style)->draw_slider (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);
4024 gtk_paint_handle (GtkStyle *style,
4026 GtkStateType state_type,
4027 GtkShadowType shadow_type,
4030 const gchar *detail,
4035 GtkOrientation orientation)
4037 g_return_if_fail (GTK_IS_STYLE (style));
4038 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL);
4040 GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);