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"
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);
61 static void gtk_default_draw_hline (GtkStyle *style,
63 GtkStateType state_type,
70 static void gtk_default_draw_vline (GtkStyle *style,
72 GtkStateType state_type,
79 static void gtk_default_draw_shadow (GtkStyle *style,
81 GtkStateType state_type,
82 GtkShadowType shadow_type,
90 static void gtk_default_draw_shadow (GtkStyle *style,
92 GtkStateType state_type,
93 GtkShadowType shadow_type,
101 static void gtk_default_draw_polygon (GtkStyle *style,
103 GtkStateType state_type,
104 GtkShadowType shadow_type,
111 static void gtk_default_draw_arrow (GtkStyle *style,
113 GtkStateType state_type,
114 GtkShadowType shadow_type,
118 GtkArrowType arrow_type,
124 static void gtk_default_draw_diamond (GtkStyle *style,
126 GtkStateType state_type,
127 GtkShadowType shadow_type,
135 static void gtk_default_draw_oval (GtkStyle *style,
137 GtkStateType state_type,
138 GtkShadowType shadow_type,
146 static void gtk_default_draw_string (GtkStyle *style,
148 GtkStateType state_type,
154 const gchar *string);
155 static void gtk_default_draw_box (GtkStyle *style,
157 GtkStateType state_type,
158 GtkShadowType shadow_type,
166 static void gtk_default_draw_flat_box (GtkStyle *style,
168 GtkStateType state_type,
169 GtkShadowType shadow_type,
177 static void gtk_default_draw_check (GtkStyle *style,
179 GtkStateType state_type,
180 GtkShadowType shadow_type,
188 static void gtk_default_draw_option (GtkStyle *style,
190 GtkStateType state_type,
191 GtkShadowType shadow_type,
199 static void gtk_default_draw_cross (GtkStyle *style,
201 GtkStateType state_type,
202 GtkShadowType shadow_type,
210 static void gtk_default_draw_ramp (GtkStyle *style,
212 GtkStateType state_type,
213 GtkShadowType shadow_type,
217 GtkArrowType arrow_type,
222 static void gtk_default_draw_tab (GtkStyle *style,
224 GtkStateType state_type,
225 GtkShadowType shadow_type,
233 static void gtk_default_draw_shadow_gap (GtkStyle *style,
235 GtkStateType state_type,
236 GtkShadowType shadow_type,
244 GtkPositionType gap_side,
247 static void gtk_default_draw_box_gap (GtkStyle *style,
249 GtkStateType state_type,
250 GtkShadowType shadow_type,
258 GtkPositionType gap_side,
261 static void gtk_default_draw_extension (GtkStyle *style,
263 GtkStateType state_type,
264 GtkShadowType shadow_type,
272 GtkPositionType gap_side);
273 static void gtk_default_draw_focus (GtkStyle *style,
282 static void gtk_default_draw_slider (GtkStyle *style,
284 GtkStateType state_type,
285 GtkShadowType shadow_type,
293 GtkOrientation orientation);
294 static void gtk_default_draw_handle (GtkStyle *style,
296 GtkStateType state_type,
297 GtkShadowType shadow_type,
305 GtkOrientation orientation);
307 static void gtk_style_shade (GdkColor *a, GdkColor *b, gdouble k);
308 static void rgb_to_hls (gdouble *r, gdouble *g, gdouble *b);
309 static void hls_to_rgb (gdouble *h, gdouble *l, gdouble *s);
311 GdkFont *default_font = NULL;
313 static GdkColor gtk_default_normal_fg = { 0, 0, 0, 0 };
314 static GdkColor gtk_default_active_fg = { 0, 0, 0, 0 };
315 static GdkColor gtk_default_prelight_fg = { 0, 0, 0, 0 };
316 static GdkColor gtk_default_selected_fg = { 0, 0xffff, 0xffff, 0xffff };
317 static GdkColor gtk_default_insensitive_fg = { 0, 0x7530, 0x7530, 0x7530 };
319 static GdkColor gtk_default_normal_bg = { 0, 0xd6d6, 0xd6d6, 0xd6d6 };
320 static GdkColor gtk_default_active_bg = { 0, 0xc350, 0xc350, 0xc350 };
321 static GdkColor gtk_default_prelight_bg = { 0, 0xea60, 0xea60, 0xea60 };
322 static GdkColor gtk_default_selected_bg = { 0, 0, 0, 0x9c40 };
323 static GdkColor gtk_default_insensitive_bg = { 0, 0xd6d6, 0xd6d6, 0xd6d6 };
325 static gpointer parent_class = NULL;
327 static void gtk_style_init (GtkStyle *style);
328 static void gtk_style_class_init (GtkStyleClass *klass);
329 static void gtk_style_finalize (GObject *object);
332 gtk_style_get_type (void)
334 static GType object_type = 0;
338 static const GTypeInfo object_info =
340 sizeof (GtkStyleClass),
341 (GBaseInitFunc) NULL,
342 (GBaseFinalizeFunc) NULL,
343 (GClassInitFunc) gtk_style_class_init,
344 NULL, /* class_finalize */
345 NULL, /* class_data */
348 (GInstanceInitFunc) gtk_style_init,
351 object_type = g_type_register_static (G_TYPE_OBJECT,
360 gtk_style_init (GtkStyle *style)
364 style->font_desc = pango_font_description_from_string ("Sans 10");
368 default_font = gdk_font_from_description (style->font_desc);
371 g_error ("Unable to load default font.");
374 style->font = default_font;
375 gdk_font_ref (style->font);
377 style->attach_count = 0;
378 style->colormap = NULL;
381 style->black.red = 0;
382 style->black.green = 0;
383 style->black.blue = 0;
385 style->white.red = 65535;
386 style->white.green = 65535;
387 style->white.blue = 65535;
389 style->black_gc = NULL;
390 style->white_gc = NULL;
392 style->fg[GTK_STATE_NORMAL] = gtk_default_normal_fg;
393 style->fg[GTK_STATE_ACTIVE] = gtk_default_active_fg;
394 style->fg[GTK_STATE_PRELIGHT] = gtk_default_prelight_fg;
395 style->fg[GTK_STATE_SELECTED] = gtk_default_selected_fg;
396 style->fg[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_fg;
398 style->bg[GTK_STATE_NORMAL] = gtk_default_normal_bg;
399 style->bg[GTK_STATE_ACTIVE] = gtk_default_active_bg;
400 style->bg[GTK_STATE_PRELIGHT] = gtk_default_prelight_bg;
401 style->bg[GTK_STATE_SELECTED] = gtk_default_selected_bg;
402 style->bg[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_bg;
404 for (i = 0; i < 4; i++)
406 style->text[i] = style->fg[i];
407 style->base[i] = style->white;
410 style->base[GTK_STATE_INSENSITIVE] = gtk_default_prelight_bg;
411 style->text[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_fg;
413 for (i = 0; i < 5; i++)
414 style->bg_pixmap[i] = NULL;
416 style->rc_style = NULL;
418 for (i = 0; i < 5; i++)
420 style->fg_gc[i] = NULL;
421 style->bg_gc[i] = NULL;
422 style->light_gc[i] = NULL;
423 style->dark_gc[i] = NULL;
424 style->mid_gc[i] = NULL;
425 style->text_gc[i] = NULL;
426 style->base_gc[i] = NULL;
429 style->xthickness = 2;
430 style->ythickness = 2;
434 gtk_style_class_init (GtkStyleClass *klass)
436 GObjectClass *object_class = G_OBJECT_CLASS (klass);
438 parent_class = g_type_class_peek_parent (klass);
440 object_class->finalize = gtk_style_finalize;
442 klass->clone = gtk_style_real_clone;
443 klass->copy = gtk_style_real_copy;
444 klass->init_from_rc = gtk_style_real_init_from_rc;
445 klass->realize = gtk_style_real_realize;
446 klass->unrealize = gtk_style_real_unrealize;
447 klass->set_background = gtk_style_real_set_background;
449 klass->draw_hline = gtk_default_draw_hline;
450 klass->draw_vline = gtk_default_draw_vline;
451 klass->draw_shadow = gtk_default_draw_shadow;
452 klass->draw_polygon = gtk_default_draw_polygon;
453 klass->draw_arrow = gtk_default_draw_arrow;
454 klass->draw_diamond = gtk_default_draw_diamond;
455 klass->draw_oval = gtk_default_draw_oval;
456 klass->draw_string = gtk_default_draw_string;
457 klass->draw_box = gtk_default_draw_box;
458 klass->draw_flat_box = gtk_default_draw_flat_box;
459 klass->draw_check = gtk_default_draw_check;
460 klass->draw_option = gtk_default_draw_option;
461 klass->draw_cross = gtk_default_draw_cross;
462 klass->draw_ramp = gtk_default_draw_ramp;
463 klass->draw_tab = gtk_default_draw_tab;
464 klass->draw_shadow_gap = gtk_default_draw_shadow_gap;
465 klass->draw_box_gap = gtk_default_draw_box_gap;
466 klass->draw_extension = gtk_default_draw_extension;
467 klass->draw_focus = gtk_default_draw_focus;
468 klass->draw_slider = gtk_default_draw_slider;
469 klass->draw_handle = gtk_default_draw_handle;
473 gtk_style_finalize (GObject *object)
475 GtkStyle *style = GTK_STYLE (object);
477 g_return_if_fail (style->attach_count == 0);
481 if (style->styles->data != style)
482 g_slist_remove (style->styles, style);
485 GSList *tmp_list = style->styles->next;
489 ((GtkStyle*) tmp_list->data)->styles = style->styles->next;
490 tmp_list = tmp_list->next;
492 g_slist_free_1 (style->styles);
496 gdk_font_unref (style->font);
497 pango_font_description_free (style->font_desc);
500 gtk_rc_style_unref (style->rc_style);
502 G_OBJECT_CLASS (parent_class)->finalize (object);
507 gtk_style_copy (GtkStyle *style)
511 g_return_val_if_fail (GTK_IS_STYLE (style), NULL);
513 new_style = GTK_STYLE_GET_CLASS (style)->clone (style);
514 GTK_STYLE_GET_CLASS (style)->copy (new_style, style);
520 gtk_style_duplicate (GtkStyle *style)
524 g_return_val_if_fail (style != NULL, NULL);
526 new_style = gtk_style_copy (style);
528 style->styles = g_slist_append (style->styles, new_style);
529 new_style->styles = style->styles;
539 style = g_object_new (GTK_TYPE_STYLE, NULL);
544 /*************************************************************
546 * Attach a style to a window; this process allocates the
547 * colors and creates the GC's for the style - it specializes
548 * it to a particular visual and colormap. The process
549 * may involve the creation of a new style if the style
550 * has already been attached to a window with a different
551 * style and colormap.
556 * Either the style parameter, or a newly created style.
557 * If the style is newly created, the style parameter
558 * will be dereferenced, and the new style will have
559 * a reference count belonging to the caller.
561 * FIXME: The sequence -
562 * create a style => s1
563 * attach s1 to v1, c1 => s1
564 * attach s1 to v2, c2 => s2
565 * detach s1 from v1, c1
566 * attach s1 to v2, c2 => s3
567 * results in two separate, unlinked styles s2 and s3 which
568 * are identical and could be shared. To fix this, we would
569 * want to never remove a style from the list of linked
570 * styles as long as as it has a reference count. However, the
571 * disadvantage of doing it this way means that we would need two
572 * passes through the linked list when attaching (one to check for
573 * matching styles, one to look for empty unattached styles - but
574 * it will almost never be longer than 2 elements.
575 *************************************************************/
578 gtk_style_attach (GtkStyle *style,
582 GtkStyle *new_style = NULL;
583 GdkColormap *colormap;
585 g_return_val_if_fail (style != NULL, NULL);
586 g_return_val_if_fail (window != NULL, NULL);
588 colormap = gdk_window_get_colormap (window);
591 style->styles = g_slist_append (NULL, style);
593 styles = style->styles;
596 new_style = styles->data;
598 if (new_style->attach_count == 0)
600 gtk_style_realize (new_style, colormap);
603 else if (new_style->colormap == colormap)
607 styles = styles->next;
612 new_style = gtk_style_duplicate (style);
613 gtk_style_realize (new_style, colormap);
616 /* A style gets a refcount from being attached */
617 if (new_style->attach_count == 0)
618 gtk_style_ref (new_style);
620 /* Another refcount belongs to the parent */
621 if (style != new_style)
623 gtk_style_unref (style);
624 gtk_style_ref (new_style);
627 new_style->attach_count++;
633 gtk_style_detach (GtkStyle *style)
635 g_return_if_fail (style != NULL);
637 style->attach_count -= 1;
638 if (style->attach_count == 0)
640 GTK_STYLE_GET_CLASS (style)->unrealize (style);
642 gtk_style_unref (style);
647 gtk_style_ref (GtkStyle *style)
649 return (GtkStyle *) g_object_ref (G_OBJECT (style));
653 gtk_style_unref (GtkStyle *style)
655 g_object_unref (G_OBJECT (style));
659 gtk_style_realize (GtkStyle *style,
660 GdkColormap *colormap)
662 g_return_if_fail (style != NULL);
664 style->colormap = colormap;
665 style->depth = gdk_colormap_get_visual (colormap)->depth;
667 GTK_STYLE_GET_CLASS (style)->realize (style);
671 gtk_draw_hline (GtkStyle *style,
673 GtkStateType state_type,
678 g_return_if_fail (style != NULL);
679 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL);
681 GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type, NULL, NULL, NULL, x1, x2, y);
686 gtk_draw_vline (GtkStyle *style,
688 GtkStateType state_type,
693 g_return_if_fail (style != NULL);
694 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL);
696 GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type, NULL, NULL, NULL, y1, y2, x);
701 gtk_draw_shadow (GtkStyle *style,
703 GtkStateType state_type,
704 GtkShadowType shadow_type,
710 g_return_if_fail (style != NULL);
711 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
713 GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
717 gtk_draw_polygon (GtkStyle *style,
719 GtkStateType state_type,
720 GtkShadowType shadow_type,
725 g_return_if_fail (style != NULL);
726 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_polygon != NULL);
728 GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type, NULL, NULL, NULL, points, npoints, fill);
732 gtk_draw_arrow (GtkStyle *style,
734 GtkStateType state_type,
735 GtkShadowType shadow_type,
736 GtkArrowType arrow_type,
743 g_return_if_fail (style != NULL);
744 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL);
746 GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, fill, x, y, width, height);
751 gtk_draw_diamond (GtkStyle *style,
753 GtkStateType state_type,
754 GtkShadowType shadow_type,
760 g_return_if_fail (style != NULL);
761 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL);
763 GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
768 gtk_draw_oval (GtkStyle *style,
770 GtkStateType state_type,
771 GtkShadowType shadow_type,
777 g_return_if_fail (style != NULL);
778 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_oval != NULL);
780 GTK_STYLE_GET_CLASS (style)->draw_oval (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
784 gtk_draw_string (GtkStyle *style,
786 GtkStateType state_type,
791 g_return_if_fail (style != NULL);
792 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_string != NULL);
794 GTK_STYLE_GET_CLASS (style)->draw_string (style, window, state_type, NULL, NULL, NULL, x, y, string);
798 gtk_draw_box (GtkStyle *style,
800 GtkStateType state_type,
801 GtkShadowType shadow_type,
807 g_return_if_fail (style != NULL);
808 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL);
810 GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
814 gtk_draw_flat_box (GtkStyle *style,
816 GtkStateType state_type,
817 GtkShadowType shadow_type,
823 g_return_if_fail (style != NULL);
824 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL);
826 GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
830 gtk_draw_check (GtkStyle *style,
832 GtkStateType state_type,
833 GtkShadowType shadow_type,
839 g_return_if_fail (style != NULL);
840 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL);
842 GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
846 gtk_draw_option (GtkStyle *style,
848 GtkStateType state_type,
849 GtkShadowType shadow_type,
855 g_return_if_fail (style != NULL);
856 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL);
858 GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
862 gtk_draw_cross (GtkStyle *style,
864 GtkStateType state_type,
865 GtkShadowType shadow_type,
871 g_return_if_fail (style != NULL);
872 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_cross != NULL);
874 GTK_STYLE_GET_CLASS (style)->draw_cross (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
878 gtk_draw_ramp (GtkStyle *style,
880 GtkStateType state_type,
881 GtkShadowType shadow_type,
882 GtkArrowType arrow_type,
888 g_return_if_fail (style != NULL);
889 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_ramp != NULL);
891 GTK_STYLE_GET_CLASS (style)->draw_ramp (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, x, y, width, height);
895 gtk_draw_tab (GtkStyle *style,
897 GtkStateType state_type,
898 GtkShadowType shadow_type,
904 g_return_if_fail (style != NULL);
905 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL);
907 GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
911 gtk_draw_shadow_gap (GtkStyle *style,
913 GtkStateType state_type,
914 GtkShadowType shadow_type,
919 GtkPositionType gap_side,
923 g_return_if_fail (style != NULL);
924 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL);
926 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);
930 gtk_draw_box_gap (GtkStyle *style,
932 GtkStateType state_type,
933 GtkShadowType shadow_type,
938 GtkPositionType gap_side,
942 g_return_if_fail (style != NULL);
943 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL);
945 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);
949 gtk_draw_extension (GtkStyle *style,
951 GtkStateType state_type,
952 GtkShadowType shadow_type,
957 GtkPositionType gap_side)
959 g_return_if_fail (style != NULL);
960 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL);
962 GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side);
966 gtk_draw_focus (GtkStyle *style,
973 g_return_if_fail (style != NULL);
974 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL);
976 GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, NULL, NULL, NULL, x, y, width, height);
980 gtk_draw_slider (GtkStyle *style,
982 GtkStateType state_type,
983 GtkShadowType shadow_type,
988 GtkOrientation orientation)
990 g_return_if_fail (style != NULL);
991 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_slider != NULL);
993 GTK_STYLE_GET_CLASS (style)->draw_slider (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
997 gtk_draw_handle (GtkStyle *style,
999 GtkStateType state_type,
1000 GtkShadowType shadow_type,
1005 GtkOrientation orientation)
1007 g_return_if_fail (style != NULL);
1008 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL);
1010 GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
1014 gtk_style_set_background (GtkStyle *style,
1016 GtkStateType state_type)
1018 g_return_if_fail (style != NULL);
1019 g_return_if_fail (window != NULL);
1021 GTK_STYLE_GET_CLASS (style)->set_background (style, window, state_type);
1024 /* Default functions */
1026 gtk_style_real_clone (GtkStyle *style)
1028 return GTK_STYLE (g_object_new (G_OBJECT_TYPE (style), NULL));
1032 gtk_style_real_copy (GtkStyle *style,
1037 for (i = 0; i < 5; i++)
1039 style->fg[i] = src->fg[i];
1040 style->bg[i] = src->bg[i];
1041 style->text[i] = src->text[i];
1042 style->base[i] = src->base[i];
1044 style->bg_pixmap[i] = src->bg_pixmap[i];
1048 gdk_font_unref (style->font);
1049 style->font = src->font;
1051 gdk_font_ref (style->font);
1053 if (style->font_desc)
1054 pango_font_description_free (style->font_desc);
1056 style->font_desc = pango_font_description_copy (src->font_desc);
1058 style->font_desc = NULL;
1060 style->xthickness = src->xthickness;
1061 style->ythickness = src->ythickness;
1063 if (style->rc_style)
1064 gtk_rc_style_unref (style->rc_style);
1065 style->rc_style = src->rc_style;
1067 gtk_rc_style_ref (src->rc_style);
1071 gtk_style_real_init_from_rc (GtkStyle *style,
1072 GtkRcStyle *rc_style)
1077 if (rc_style->font_desc)
1079 pango_font_description_free (style->font_desc);
1080 style->font_desc = pango_font_description_copy (rc_style->font_desc);
1082 old_font = style->font;
1083 style->font = gdk_font_from_description (style->font_desc);
1085 gdk_font_unref (old_font);
1087 style->font = old_font;
1090 for (i = 0; i < 5; i++)
1092 if (rc_style->color_flags[i] & GTK_RC_FG)
1093 style->fg[i] = rc_style->fg[i];
1094 if (rc_style->color_flags[i] & GTK_RC_BG)
1095 style->bg[i] = rc_style->bg[i];
1096 if (rc_style->color_flags[i] & GTK_RC_TEXT)
1097 style->text[i] = rc_style->text[i];
1098 if (rc_style->color_flags[i] & GTK_RC_BASE)
1099 style->base[i] = rc_style->base[i];
1102 if (rc_style->xthickness >= 0)
1103 style->xthickness = rc_style->xthickness;
1104 if (rc_style->ythickness >= 0)
1105 style->ythickness = rc_style->ythickness;
1109 gtk_style_real_realize (GtkStyle *style)
1111 GdkGCValues gc_values;
1112 GdkGCValuesMask gc_values_mask;
1116 for (i = 0; i < 5; i++)
1118 gtk_style_shade (&style->bg[i], &style->light[i], LIGHTNESS_MULT);
1119 gtk_style_shade (&style->bg[i], &style->dark[i], DARKNESS_MULT);
1121 style->mid[i].red = (style->light[i].red + style->dark[i].red) / 2;
1122 style->mid[i].green = (style->light[i].green + style->dark[i].green) / 2;
1123 style->mid[i].blue = (style->light[i].blue + style->dark[i].blue) / 2;
1126 gdk_color_black (style->colormap, &style->black);
1127 gdk_color_white (style->colormap, &style->white);
1129 gc_values_mask = GDK_GC_FOREGROUND | GDK_GC_FONT;
1130 if (style->font->type == GDK_FONT_FONT)
1132 gc_values.font = style->font;
1134 else if (style->font->type == GDK_FONT_FONTSET)
1136 gc_values.font = default_font;
1139 gc_values.foreground = style->black;
1140 style->black_gc = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1142 gc_values.foreground = style->white;
1143 style->white_gc = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1145 for (i = 0; i < 5; i++)
1147 if (style->rc_style && style->rc_style->bg_pixmap_name[i])
1148 style->bg_pixmap[i] = gtk_rc_load_image (style->colormap,
1150 style->rc_style->bg_pixmap_name[i]);
1152 if (!gdk_color_alloc (style->colormap, &style->fg[i]))
1153 g_warning ("unable to allocate color: ( %d %d %d )",
1154 style->fg[i].red, style->fg[i].green, style->fg[i].blue);
1155 if (!gdk_color_alloc (style->colormap, &style->bg[i]))
1156 g_warning ("unable to allocate color: ( %d %d %d )",
1157 style->bg[i].red, style->bg[i].green, style->bg[i].blue);
1158 if (!gdk_color_alloc (style->colormap, &style->light[i]))
1159 g_warning ("unable to allocate color: ( %d %d %d )",
1160 style->light[i].red, style->light[i].green, style->light[i].blue);
1161 if (!gdk_color_alloc (style->colormap, &style->dark[i]))
1162 g_warning ("unable to allocate color: ( %d %d %d )",
1163 style->dark[i].red, style->dark[i].green, style->dark[i].blue);
1164 if (!gdk_color_alloc (style->colormap, &style->mid[i]))
1165 g_warning ("unable to allocate color: ( %d %d %d )",
1166 style->mid[i].red, style->mid[i].green, style->mid[i].blue);
1167 if (!gdk_color_alloc (style->colormap, &style->text[i]))
1168 g_warning ("unable to allocate color: ( %d %d %d )",
1169 style->text[i].red, style->text[i].green, style->text[i].blue);
1170 if (!gdk_color_alloc (style->colormap, &style->base[i]))
1171 g_warning ("unable to allocate color: ( %d %d %d )",
1172 style->base[i].red, style->base[i].green, style->base[i].blue);
1174 gc_values.foreground = style->fg[i];
1175 style->fg_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1177 gc_values.foreground = style->bg[i];
1178 style->bg_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1180 gc_values.foreground = style->light[i];
1181 style->light_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1183 gc_values.foreground = style->dark[i];
1184 style->dark_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1186 gc_values.foreground = style->mid[i];
1187 style->mid_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1189 gc_values.foreground = style->text[i];
1190 style->text_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1192 gc_values.foreground = style->base[i];
1193 style->base_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
1198 gtk_style_real_unrealize (GtkStyle *style)
1202 gtk_gc_release (style->black_gc);
1203 gtk_gc_release (style->white_gc);
1205 for (i = 0; i < 5; i++)
1207 gtk_gc_release (style->fg_gc[i]);
1208 gtk_gc_release (style->bg_gc[i]);
1209 gtk_gc_release (style->light_gc[i]);
1210 gtk_gc_release (style->dark_gc[i]);
1211 gtk_gc_release (style->mid_gc[i]);
1212 gtk_gc_release (style->text_gc[i]);
1213 gtk_gc_release (style->base_gc[i]);
1218 gtk_style_real_set_background (GtkStyle *style,
1220 GtkStateType state_type)
1223 gint parent_relative;
1225 if (style->bg_pixmap[state_type])
1227 if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
1230 parent_relative = TRUE;
1234 pixmap = style->bg_pixmap[state_type];
1235 parent_relative = FALSE;
1238 gdk_window_set_back_pixmap (window, pixmap, parent_relative);
1241 gdk_window_set_background (window, &style->bg[state_type]);
1245 gtk_style_apply_default_background (GtkStyle *style,
1248 GtkStateType state_type,
1255 GdkRectangle new_rect, old_rect;
1261 old_rect.width = width;
1262 old_rect.height = height;
1264 if (!gdk_rectangle_intersect (area, &old_rect, &new_rect))
1271 new_rect.width = width;
1272 new_rect.height = height;
1275 if (!style->bg_pixmap[state_type] ||
1276 GDK_IS_PIXMAP (window) ||
1277 (!set_bg && style->bg_pixmap[state_type] != (GdkPixmap*) GDK_PARENT_RELATIVE))
1279 GdkGC *gc = style->bg_gc[state_type];
1281 if (style->bg_pixmap[state_type])
1283 gdk_gc_set_fill (gc, GDK_TILED);
1284 gdk_gc_set_tile (gc, style->bg_pixmap[state_type]);
1287 gdk_draw_rectangle (window, gc, TRUE,
1288 new_rect.x, new_rect.y, new_rect.width, new_rect.height);
1289 if (style->bg_pixmap[state_type])
1290 gdk_gc_set_fill (gc, GDK_SOLID);
1296 if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
1297 gdk_window_set_back_pixmap (window, NULL, TRUE);
1299 gdk_window_set_back_pixmap (window, style->bg_pixmap[state_type], FALSE);
1302 gdk_window_clear_area (window,
1303 new_rect.x, new_rect.y,
1304 new_rect.width, new_rect.height);
1309 gtk_default_draw_hline (GtkStyle *style,
1311 GtkStateType state_type,
1314 const gchar *detail,
1319 gint thickness_light;
1320 gint thickness_dark;
1323 g_return_if_fail (style != NULL);
1324 g_return_if_fail (window != NULL);
1326 thickness_light = style->ythickness / 2;
1327 thickness_dark = style->ythickness - thickness_light;
1331 gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
1332 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
1335 if (detail && !strcmp (detail, "label"))
1337 if (state_type == GTK_STATE_INSENSITIVE)
1338 gdk_draw_line (window, style->white_gc, x1 + 1, y + 1, x2 + 1, y + 1);
1339 gdk_draw_line (window, style->fg_gc[state_type], x1, y, x2, y);
1343 for (i = 0; i < thickness_dark; i++)
1345 gdk_draw_line (window, style->light_gc[state_type], x2 - i - 1, y + i, x2, y + i);
1346 gdk_draw_line (window, style->dark_gc[state_type], x1, y + i, x2 - i - 1, y + i);
1349 y += thickness_dark;
1350 for (i = 0; i < thickness_light; i++)
1352 gdk_draw_line (window, style->dark_gc[state_type], x1, y + i, x1 + thickness_light - i - 1, y + i);
1353 gdk_draw_line (window, style->light_gc[state_type], x1 + thickness_light - i - 1, y + i, x2, y + i);
1359 gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
1360 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
1366 gtk_default_draw_vline (GtkStyle *style,
1368 GtkStateType state_type,
1371 const gchar *detail,
1376 gint thickness_light;
1377 gint thickness_dark;
1380 g_return_if_fail (style != NULL);
1381 g_return_if_fail (window != NULL);
1383 thickness_light = style->xthickness / 2;
1384 thickness_dark = style->xthickness - thickness_light;
1388 gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
1389 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
1391 for (i = 0; i < thickness_dark; i++)
1393 gdk_draw_line (window, style->light_gc[state_type], x + i, y2 - i - 1, x + i, y2);
1394 gdk_draw_line (window, style->dark_gc[state_type], x + i, y1, x + i, y2 - i - 1);
1397 x += thickness_dark;
1398 for (i = 0; i < thickness_light; i++)
1400 gdk_draw_line (window, style->dark_gc[state_type], x + i, y1, x + i, y1 + thickness_light - i);
1401 gdk_draw_line (window, style->light_gc[state_type], x + i, y1 + thickness_light - i, x + i, y2);
1405 gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
1406 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
1412 gtk_default_draw_shadow (GtkStyle *style,
1414 GtkStateType state_type,
1415 GtkShadowType shadow_type,
1418 const gchar *detail,
1426 gint thickness_light;
1427 gint thickness_dark;
1430 g_return_if_fail (style != NULL);
1431 g_return_if_fail (window != NULL);
1433 if ((width == -1) && (height == -1))
1434 gdk_window_get_size (window, &width, &height);
1435 else if (width == -1)
1436 gdk_window_get_size (window, &width, NULL);
1437 else if (height == -1)
1438 gdk_window_get_size (window, NULL, &height);
1440 switch (shadow_type)
1442 case GTK_SHADOW_NONE:
1445 case GTK_SHADOW_ETCHED_IN:
1446 gc1 = style->light_gc[state_type];
1447 gc2 = style->dark_gc[state_type];
1449 case GTK_SHADOW_OUT:
1450 case GTK_SHADOW_ETCHED_OUT:
1451 gc1 = style->dark_gc[state_type];
1452 gc2 = style->light_gc[state_type];
1458 gdk_gc_set_clip_rectangle (gc1, area);
1459 gdk_gc_set_clip_rectangle (gc2, area);
1460 if (shadow_type == GTK_SHADOW_IN ||
1461 shadow_type == GTK_SHADOW_OUT)
1463 gdk_gc_set_clip_rectangle (style->black_gc, area);
1464 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
1468 switch (shadow_type)
1470 case GTK_SHADOW_NONE:
1474 gdk_draw_line (window, gc1,
1475 x, y + height - 1, x + width - 1, y + height - 1);
1476 gdk_draw_line (window, gc1,
1477 x + width - 1, y, x + width - 1, y + height - 1);
1479 gdk_draw_line (window, style->bg_gc[state_type],
1480 x + 1, y + height - 2, x + width - 2, y + height - 2);
1481 gdk_draw_line (window, style->bg_gc[state_type],
1482 x + width - 2, y + 1, x + width - 2, y + height - 2);
1484 gdk_draw_line (window, style->black_gc,
1485 x + 1, y + 1, x + width - 2, y + 1);
1486 gdk_draw_line (window, style->black_gc,
1487 x + 1, y + 1, x + 1, y + height - 2);
1489 gdk_draw_line (window, gc2,
1490 x, y, x + width - 1, y);
1491 gdk_draw_line (window, gc2,
1492 x, y, x, y + height - 1);
1495 case GTK_SHADOW_OUT:
1496 gdk_draw_line (window, gc1,
1497 x + 1, y + height - 2, x + width - 2, y + height - 2);
1498 gdk_draw_line (window, gc1,
1499 x + width - 2, y + 1, x + width - 2, y + height - 2);
1501 gdk_draw_line (window, gc2,
1502 x, y, x + width - 1, y);
1503 gdk_draw_line (window, gc2,
1504 x, y, x, y + height - 1);
1506 gdk_draw_line (window, style->bg_gc[state_type],
1507 x + 1, y + 1, x + width - 2, y + 1);
1508 gdk_draw_line (window, style->bg_gc[state_type],
1509 x + 1, y + 1, x + 1, y + height - 2);
1511 gdk_draw_line (window, style->black_gc,
1512 x, y + height - 1, x + width - 1, y + height - 1);
1513 gdk_draw_line (window, style->black_gc,
1514 x + width - 1, y, x + width - 1, y + height - 1);
1517 case GTK_SHADOW_ETCHED_IN:
1518 case GTK_SHADOW_ETCHED_OUT:
1519 thickness_light = 1;
1522 for (i = 0; i < thickness_dark; i++)
1524 gdk_draw_line (window, gc1,
1528 y + height - i - 1);
1529 gdk_draw_line (window, gc1,
1533 y + height - i - 1);
1535 gdk_draw_line (window, gc2,
1540 gdk_draw_line (window, gc2,
1544 y + height - i - 2);
1547 for (i = 0; i < thickness_light; i++)
1549 gdk_draw_line (window, gc1,
1550 x + thickness_dark + i,
1551 y + thickness_dark + i,
1552 x + width - thickness_dark - i - 1,
1553 y + thickness_dark + i);
1554 gdk_draw_line (window, gc1,
1555 x + thickness_dark + i,
1556 y + thickness_dark + i,
1557 x + thickness_dark + i,
1558 y + height - thickness_dark - i - 1);
1560 gdk_draw_line (window, gc2,
1561 x + thickness_dark + i,
1562 y + height - thickness_light - i - 1,
1563 x + width - thickness_light - 1,
1564 y + height - thickness_light - i - 1);
1565 gdk_draw_line (window, gc2,
1566 x + width - thickness_light - i - 1,
1567 y + thickness_dark + i,
1568 x + width - thickness_light - i - 1,
1569 y + height - thickness_light - 1);
1575 gdk_gc_set_clip_rectangle (gc1, NULL);
1576 gdk_gc_set_clip_rectangle (gc2, NULL);
1577 if (shadow_type == GTK_SHADOW_IN ||
1578 shadow_type == GTK_SHADOW_OUT)
1580 gdk_gc_set_clip_rectangle (style->black_gc, NULL);
1581 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
1587 gtk_default_draw_polygon (GtkStyle *style,
1589 GtkStateType state_type,
1590 GtkShadowType shadow_type,
1593 const gchar *detail,
1598 static const gdouble pi_over_4 = M_PI_4;
1599 static const gdouble pi_3_over_4 = M_PI_4 * 3;
1609 g_return_if_fail (style != NULL);
1610 g_return_if_fail (window != NULL);
1611 g_return_if_fail (points != NULL);
1613 switch (shadow_type)
1616 gc1 = style->bg_gc[state_type];
1617 gc2 = style->dark_gc[state_type];
1618 gc3 = style->light_gc[state_type];
1619 gc4 = style->black_gc;
1621 case GTK_SHADOW_ETCHED_IN:
1622 gc1 = style->light_gc[state_type];
1623 gc2 = style->dark_gc[state_type];
1624 gc3 = style->dark_gc[state_type];
1625 gc4 = style->light_gc[state_type];
1627 case GTK_SHADOW_OUT:
1628 gc1 = style->dark_gc[state_type];
1629 gc2 = style->light_gc[state_type];
1630 gc3 = style->black_gc;
1631 gc4 = style->bg_gc[state_type];
1633 case GTK_SHADOW_ETCHED_OUT:
1634 gc1 = style->dark_gc[state_type];
1635 gc2 = style->light_gc[state_type];
1636 gc3 = style->light_gc[state_type];
1637 gc4 = style->dark_gc[state_type];
1645 gdk_gc_set_clip_rectangle (gc1, area);
1646 gdk_gc_set_clip_rectangle (gc2, area);
1647 gdk_gc_set_clip_rectangle (gc3, area);
1648 gdk_gc_set_clip_rectangle (gc4, area);
1652 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, npoints);
1656 for (i = 0; i < npoints; i++)
1658 if ((points[i].x == points[i+1].x) &&
1659 (points[i].y == points[i+1].y))
1665 angle = atan2 (points[i+1].y - points[i].y,
1666 points[i+1].x - points[i].x);
1669 if ((angle > -pi_3_over_4) && (angle < pi_over_4))
1671 if (angle > -pi_over_4)
1682 gdk_draw_line (window, gc1,
1683 points[i].x-xadjust, points[i].y-yadjust,
1684 points[i+1].x-xadjust, points[i+1].y-yadjust);
1685 gdk_draw_line (window, gc3,
1686 points[i].x, points[i].y,
1687 points[i+1].x, points[i+1].y);
1691 if ((angle < -pi_3_over_4) || (angle > pi_3_over_4))
1702 gdk_draw_line (window, gc4,
1703 points[i].x+xadjust, points[i].y+yadjust,
1704 points[i+1].x+xadjust, points[i+1].y+yadjust);
1705 gdk_draw_line (window, gc2,
1706 points[i].x, points[i].y,
1707 points[i+1].x, points[i+1].y);
1713 gdk_gc_set_clip_rectangle (gc1, NULL);
1714 gdk_gc_set_clip_rectangle (gc2, NULL);
1715 gdk_gc_set_clip_rectangle (gc3, NULL);
1716 gdk_gc_set_clip_rectangle (gc4, NULL);
1721 gtk_default_draw_arrow (GtkStyle *style,
1723 GtkStateType state_type,
1724 GtkShadowType shadow_type,
1727 const gchar *detail,
1728 GtkArrowType arrow_type,
1743 g_return_if_fail (style != NULL);
1744 g_return_if_fail (window != NULL);
1746 switch (shadow_type)
1749 gc1 = style->bg_gc[state_type];
1750 gc2 = style->dark_gc[state_type];
1751 gc3 = style->light_gc[state_type];
1752 gc4 = style->black_gc;
1754 case GTK_SHADOW_OUT:
1755 gc1 = style->dark_gc[state_type];
1756 gc2 = style->light_gc[state_type];
1757 gc3 = style->black_gc;
1758 gc4 = style->bg_gc[state_type];
1760 case GTK_SHADOW_ETCHED_IN:
1761 gc1 = style->light_gc[state_type];
1762 gc2 = style->dark_gc[state_type];
1766 case GTK_SHADOW_ETCHED_OUT:
1767 gc1 = style->dark_gc[state_type];
1768 gc2 = style->light_gc[state_type];
1776 if ((width == -1) && (height == -1))
1777 gdk_window_get_size (window, &width, &height);
1778 else if (width == -1)
1779 gdk_window_get_size (window, &width, NULL);
1780 else if (height == -1)
1781 gdk_window_get_size (window, NULL, &height);
1783 half_width = width / 2;
1784 half_height = height / 2;
1788 gdk_gc_set_clip_rectangle (gc1, area);
1789 gdk_gc_set_clip_rectangle (gc2, area);
1792 gdk_gc_set_clip_rectangle (gc3, area);
1793 gdk_gc_set_clip_rectangle (gc4, area);
1802 points[0].x = x + half_width;
1805 points[1].y = y + height - 1;
1806 points[2].x = x + width - 1;
1807 points[2].y = y + height - 1;
1809 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
1812 switch (shadow_type)
1815 case GTK_SHADOW_OUT:
1817 gdk_draw_line (window, gc1,
1818 x + 1, y + height - 2,
1819 x + width - 2, y + height - 2);
1820 gdk_draw_line (window, gc3,
1821 x + 0, y + height - 1,
1822 x + width - 1, y + height - 1);
1824 gdk_draw_line (window, gc1,
1825 x + width - 2, y + height - 1,
1826 x + half_width, y + 1);
1827 gdk_draw_line (window, gc3,
1828 x + width - 1, y + height - 1,
1831 gdk_draw_line (window, gc4,
1832 x + half_width, y + 1,
1833 x + 1, y + height - 1);
1834 gdk_draw_line (window, gc2,
1839 case GTK_SHADOW_ETCHED_IN:
1840 case GTK_SHADOW_ETCHED_OUT:
1841 gdk_draw_line (window, gc1,
1842 x + half_width, y + 1,
1843 x + 1, y + height - 1);
1844 gdk_draw_line (window, gc1,
1845 x + 1, y + height - 1,
1846 x + width - 1, y + height - 1);
1847 gdk_draw_line (window, gc1,
1848 x + width - 1, y + height - 1,
1849 x + half_width + 1, y + 1);
1851 points[0].x = x + half_width;
1854 points[1].y = y + height - 2;
1855 points[2].x = x + width - 2;
1856 points[2].y = y + height - 2;
1858 gdk_draw_polygon (window, gc2, FALSE, points, 3);
1866 case GTK_ARROW_DOWN:
1869 points[0].x = x + width - 1;
1873 points[2].x = x + half_width;
1874 points[2].y = y + height - 1;
1876 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
1878 switch (shadow_type)
1881 case GTK_SHADOW_OUT:
1882 gdk_draw_line (window, gc4,
1884 y + 1, x + 1, y + 1);
1885 gdk_draw_line (window, gc2,
1889 gdk_draw_line (window, gc4,
1891 x + half_width, y + height - 2);
1892 gdk_draw_line (window, gc2,
1894 x + half_width, y + height - 1);
1896 gdk_draw_line (window, gc1,
1897 x + half_width, y + height - 2,
1899 gdk_draw_line (window, gc3,
1900 x + half_width, y + height - 1,
1904 case GTK_SHADOW_ETCHED_IN:
1905 case GTK_SHADOW_ETCHED_OUT:
1906 gdk_draw_line (window, gc1,
1907 x + width - 1, y + 1,
1909 gdk_draw_line (window, gc1,
1911 x + half_width + 1, y + height - 1);
1912 gdk_draw_line (window, gc1,
1913 x + half_width + 1, y + height - 2,
1916 points[0].x = x + width - 2;
1920 points[2].x = x + half_width;
1921 points[2].y = y + height - 2;
1923 gdk_draw_polygon (window, gc2, FALSE, points, 3);
1930 case GTK_ARROW_LEFT:
1934 points[0].y = y + half_height;
1935 points[1].x = x + width - 1;
1936 points[1].y = y + height - 1;
1937 points[2].x = x + width - 1;
1940 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
1943 switch (shadow_type)
1946 case GTK_SHADOW_OUT:
1947 gdk_draw_line (window, gc1,
1948 x + 1, y + half_height,
1949 x + width - 1, y + height - 1);
1950 gdk_draw_line (window, gc3,
1952 x + width - 1, y + height - 1);
1954 gdk_draw_line (window, gc1,
1955 x + width - 2, y + height - 1,
1956 x + width - 2, y + 1);
1957 gdk_draw_line (window, gc3,
1958 x + width - 1, y + height - 1,
1961 gdk_draw_line (window, gc4,
1962 x + width - 1, y + 1,
1963 x + 1, y + half_height);
1964 gdk_draw_line (window, gc2,
1966 x, 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 + 1,
1973 x + 1, y + half_height);
1974 gdk_draw_line (window, gc1,
1975 x + 1, y + half_height + 1,
1976 x + width - 1, y + height - 1);
1977 gdk_draw_line (window, gc1,
1978 x + width - 1, y + height - 1,
1979 x + width - 1, y + 1);
1981 points[0].x = x + width - 2;
1984 points[1].y = y + half_height;
1985 points[2].x = x + width - 2;
1986 points[2].y = y + height - 2;
1988 gdk_draw_polygon (window, gc2, FALSE, points, 3);
1995 case GTK_ARROW_RIGHT:
1998 points[0].x = x + width - 1;
1999 points[0].y = y + half_height;
2003 points[2].y = y + height - 1;
2005 gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
2008 switch (shadow_type)
2011 case GTK_SHADOW_OUT:
2012 gdk_draw_line (window, gc4,
2013 x + width - 1, y + half_height,
2015 gdk_draw_line (window, gc2,
2016 x + width - 1, y + half_height,
2018 gdk_draw_line (window, gc4,
2020 x + 1, y + height - 2);
2021 gdk_draw_line (window, gc2,
2025 gdk_draw_line (window, gc1,
2026 x + 1, y + height - 2,
2027 x + width - 1, y + half_height);
2028 gdk_draw_line (window, gc3,
2030 x + width - 1, y + half_height);
2033 case GTK_SHADOW_ETCHED_IN:
2034 case GTK_SHADOW_ETCHED_OUT:
2035 gdk_draw_line (window, gc1,
2036 x + width - 1, y + half_height + 1,
2038 gdk_draw_line (window, gc1,
2040 x + 1, y + height - 1);
2041 gdk_draw_line (window, gc1,
2042 x + 1, y + height - 1,
2043 x + width - 1, y + half_height + 1);
2045 points[0].x = x + width - 2;
2046 points[0].y = y + half_height;
2050 points[2].y = y + height - 1;
2052 gdk_draw_polygon (window, gc2, FALSE, points, 3);
2063 gdk_gc_set_clip_rectangle (gc1, NULL);
2064 gdk_gc_set_clip_rectangle (gc2, NULL);
2067 gdk_gc_set_clip_rectangle (gc3, NULL);
2068 gdk_gc_set_clip_rectangle (gc4, NULL);
2074 gtk_default_draw_diamond (GtkStyle *style,
2076 GtkStateType state_type,
2077 GtkShadowType shadow_type,
2080 const gchar *detail,
2089 g_return_if_fail (style != NULL);
2090 g_return_if_fail (window != NULL);
2092 if ((width == -1) && (height == -1))
2093 gdk_window_get_size (window, &width, &height);
2094 else if (width == -1)
2095 gdk_window_get_size (window, &width, NULL);
2096 else if (height == -1)
2097 gdk_window_get_size (window, NULL, &height);
2099 half_width = width / 2;
2100 half_height = height / 2;
2104 gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
2105 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
2106 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
2107 gdk_gc_set_clip_rectangle (style->black_gc, area);
2109 switch (shadow_type)
2112 gdk_draw_line (window, style->bg_gc[state_type],
2113 x + 2, y + half_height,
2114 x + half_width, y + height - 2);
2115 gdk_draw_line (window, style->bg_gc[state_type],
2116 x + half_width, y + height - 2,
2117 x + width - 2, y + half_height);
2118 gdk_draw_line (window, style->light_gc[state_type],
2119 x + 1, y + half_height,
2120 x + half_width, y + height - 1);
2121 gdk_draw_line (window, style->light_gc[state_type],
2122 x + half_width, y + height - 1,
2123 x + width - 1, y + half_height);
2124 gdk_draw_line (window, style->light_gc[state_type],
2126 x + half_width, y + height);
2127 gdk_draw_line (window, style->light_gc[state_type],
2128 x + half_width, y + height,
2129 x + width, y + half_height);
2131 gdk_draw_line (window, style->black_gc,
2132 x + 2, y + half_height,
2133 x + half_width, y + 2);
2134 gdk_draw_line (window, style->black_gc,
2135 x + half_width, y + 2,
2136 x + width - 2, y + half_height);
2137 gdk_draw_line (window, style->dark_gc[state_type],
2138 x + 1, y + half_height,
2139 x + half_width, y + 1);
2140 gdk_draw_line (window, style->dark_gc[state_type],
2141 x + half_width, y + 1,
2142 x + width - 1, y + half_height);
2143 gdk_draw_line (window, style->dark_gc[state_type],
2146 gdk_draw_line (window, style->dark_gc[state_type],
2148 x + width, y + half_height);
2150 case GTK_SHADOW_OUT:
2151 gdk_draw_line (window, style->dark_gc[state_type],
2152 x + 2, y + half_height,
2153 x + half_width, y + height - 2);
2154 gdk_draw_line (window, style->dark_gc[state_type],
2155 x + half_width, y + height - 2,
2156 x + width - 2, y + half_height);
2157 gdk_draw_line (window, style->dark_gc[state_type],
2158 x + 1, y + half_height,
2159 x + half_width, y + height - 1);
2160 gdk_draw_line (window, style->dark_gc[state_type],
2161 x + half_width, y + height - 1,
2162 x + width - 1, y + half_height);
2163 gdk_draw_line (window, style->black_gc,
2165 x + half_width, y + height);
2166 gdk_draw_line (window, style->black_gc,
2167 x + half_width, y + height,
2168 x + width, y + half_height);
2170 gdk_draw_line (window, style->bg_gc[state_type],
2171 x + 2, y + half_height,
2172 x + half_width, y + 2);
2173 gdk_draw_line (window, style->bg_gc[state_type],
2174 x + half_width, y + 2,
2175 x + width - 2, y + half_height);
2176 gdk_draw_line (window, style->light_gc[state_type],
2177 x + 1, y + half_height,
2178 x + half_width, y + 1);
2179 gdk_draw_line (window, style->light_gc[state_type],
2180 x + half_width, y + 1,
2181 x + width - 1, y + half_height);
2182 gdk_draw_line (window, style->light_gc[state_type],
2185 gdk_draw_line (window, style->light_gc[state_type],
2187 x + width, y + half_height);
2194 gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
2195 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
2196 gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
2197 gdk_gc_set_clip_rectangle (style->black_gc, NULL);
2202 gtk_default_draw_oval (GtkStyle *style,
2204 GtkStateType state_type,
2205 GtkShadowType shadow_type,
2208 const gchar *detail,
2214 g_return_if_fail (style != NULL);
2215 g_return_if_fail (window != NULL);
2217 g_warning ("gtk_default_draw_oval(): FIXME, this function is currently unimplemented");
2221 gtk_default_draw_string (GtkStyle *style,
2223 GtkStateType state_type,
2226 const gchar *detail,
2229 const gchar *string)
2231 g_return_if_fail (style != NULL);
2232 g_return_if_fail (window != NULL);
2236 gdk_gc_set_clip_rectangle (style->white_gc, area);
2237 gdk_gc_set_clip_rectangle (style->fg_gc[state_type], area);
2240 if (state_type == GTK_STATE_INSENSITIVE)
2241 gdk_draw_string (window, style->font, style->white_gc, x + 1, y + 1, string);
2243 gdk_draw_string (window, style->font, style->fg_gc[state_type], x, y, string);
2247 gdk_gc_set_clip_rectangle (style->white_gc, NULL);
2248 gdk_gc_set_clip_rectangle (style->fg_gc[state_type], NULL);
2253 gtk_default_draw_box (GtkStyle *style,
2255 GtkStateType state_type,
2256 GtkShadowType shadow_type,
2259 const gchar *detail,
2265 g_return_if_fail (style != NULL);
2266 g_return_if_fail (window != NULL);
2268 if (width == -1 && height == -1)
2269 gdk_window_get_size (window, &width, &height);
2270 else if (width == -1)
2271 gdk_window_get_size (window, &width, NULL);
2272 else if (height == -1)
2273 gdk_window_get_size (window, NULL, &height);
2275 if (!style->bg_pixmap[state_type] ||
2276 GDK_IS_PIXMAP (window))
2279 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
2281 gdk_draw_rectangle (window, style->bg_gc[state_type], TRUE,
2282 x, y, width, height);
2284 gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
2287 gtk_style_apply_default_background (style, window,
2288 widget && !GTK_WIDGET_NO_WINDOW (widget),
2289 state_type, area, x, y, width, height);
2291 gtk_paint_shadow (style, window, state_type, shadow_type, area, widget, detail,
2292 x, y, width, height);
2296 gtk_default_draw_flat_box (GtkStyle *style,
2298 GtkStateType state_type,
2299 GtkShadowType shadow_type,
2302 const gchar *detail,
2310 g_return_if_fail (style != NULL);
2311 g_return_if_fail (window != NULL);
2313 if (width == -1 && height == -1)
2314 gdk_window_get_size (window, &width, &height);
2315 else if (width == -1)
2316 gdk_window_get_size (window, &width, NULL);
2317 else if (height == -1)
2318 gdk_window_get_size (window, NULL, &height);
2322 if (!strcmp ("text", detail) && state_type == GTK_STATE_SELECTED)
2323 gc1 = style->bg_gc[GTK_STATE_SELECTED];
2324 else if (!strcmp ("viewportbin", detail))
2325 gc1 = style->bg_gc[GTK_STATE_NORMAL];
2326 else if (!strcmp ("entry_bg", detail))
2327 gc1 = style->base_gc[state_type];
2329 gc1 = style->bg_gc[state_type];
2332 gc1 = style->bg_gc[state_type];
2334 if (!style->bg_pixmap[state_type] || gc1 != style->bg_gc[state_type] ||
2335 GDK_IS_PIXMAP (window))
2338 gdk_gc_set_clip_rectangle (gc1, area);
2340 gdk_draw_rectangle (window, gc1, TRUE,
2341 x, y, width, height);
2343 if (detail && !strcmp ("tooltip", detail))
2344 gdk_draw_rectangle (window, style->black_gc, FALSE,
2345 x, y, width - 1, height - 1);
2348 gdk_gc_set_clip_rectangle (gc1, NULL);
2351 gtk_style_apply_default_background (style, window,
2352 widget && !GTK_WIDGET_NO_WINDOW (widget),
2353 state_type, area, x, y, width, height);
2357 gtk_default_draw_check (GtkStyle *style,
2359 GtkStateType state_type,
2360 GtkShadowType shadow_type,
2363 const gchar *detail,
2369 gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail,
2370 x, y, width, height);
2374 gtk_default_draw_option (GtkStyle *style,
2376 GtkStateType state_type,
2377 GtkShadowType shadow_type,
2380 const gchar *detail,
2386 gtk_paint_diamond (style, window, state_type, shadow_type, area, widget,
2387 detail, x, y, width, height);
2391 gtk_default_draw_cross (GtkStyle *style,
2393 GtkStateType state_type,
2394 GtkShadowType shadow_type,
2397 const gchar *detail,
2403 g_return_if_fail (style != NULL);
2404 g_return_if_fail (window != NULL);
2406 g_warning ("gtk_default_draw_cross(): FIXME, this function is currently unimplemented");
2410 gtk_default_draw_ramp (GtkStyle *style,
2412 GtkStateType state_type,
2413 GtkShadowType shadow_type,
2416 const gchar *detail,
2417 GtkArrowType arrow_type,
2423 g_return_if_fail (style != NULL);
2424 g_return_if_fail (window != NULL);
2426 g_warning ("gtk_default_draw_ramp(): FIXME, this function is currently unimplemented");
2430 gtk_default_draw_tab (GtkStyle *style,
2432 GtkStateType state_type,
2433 GtkShadowType shadow_type,
2436 const gchar *detail,
2442 g_return_if_fail (style != NULL);
2443 g_return_if_fail (window != NULL);
2445 gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail,
2446 x, y, width, height);
2450 gtk_default_draw_shadow_gap (GtkStyle *style,
2452 GtkStateType state_type,
2453 GtkShadowType shadow_type,
2456 const gchar *detail,
2461 GtkPositionType gap_side,
2470 g_return_if_fail (style != NULL);
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);
2480 switch (shadow_type)
2482 case GTK_SHADOW_NONE:
2485 gc1 = style->dark_gc[state_type];
2486 gc2 = style->black_gc;
2487 gc3 = style->bg_gc[state_type];
2488 gc4 = style->light_gc[state_type];
2490 case GTK_SHADOW_ETCHED_IN:
2491 gc1 = style->dark_gc[state_type];
2492 gc2 = style->light_gc[state_type];
2493 gc3 = style->dark_gc[state_type];
2494 gc4 = style->light_gc[state_type];
2496 case GTK_SHADOW_OUT:
2497 gc1 = style->light_gc[state_type];
2498 gc2 = style->bg_gc[state_type];
2499 gc3 = style->dark_gc[state_type];
2500 gc4 = style->black_gc;
2502 case GTK_SHADOW_ETCHED_OUT:
2503 gc1 = style->light_gc[state_type];
2504 gc2 = style->dark_gc[state_type];
2505 gc3 = style->light_gc[state_type];
2506 gc4 = style->dark_gc[state_type];
2511 gdk_gc_set_clip_rectangle (gc1, area);
2512 gdk_gc_set_clip_rectangle (gc2, area);
2513 gdk_gc_set_clip_rectangle (gc3, area);
2514 gdk_gc_set_clip_rectangle (gc4, area);
2517 switch (shadow_type)
2519 case GTK_SHADOW_NONE:
2521 case GTK_SHADOW_OUT:
2522 case GTK_SHADOW_ETCHED_IN:
2523 case GTK_SHADOW_ETCHED_OUT:
2527 gdk_draw_line (window, gc1,
2528 x, y, x, y + height - 1);
2529 gdk_draw_line (window, gc2,
2530 x + 1, y, x + 1, y + height - 2);
2532 gdk_draw_line (window, gc3,
2533 x + 1, y + height - 2, x + width - 2, y + height - 2);
2534 gdk_draw_line (window, gc3,
2535 x + width - 2, y, x + width - 2, y + height - 2);
2536 gdk_draw_line (window, gc4,
2537 x, y + height - 1, x + width - 1, y + height - 1);
2538 gdk_draw_line (window, gc4,
2539 x + width - 1, y, x + width - 1, y + height - 1);
2542 gdk_draw_line (window, gc1,
2543 x, y, x + gap_x - 1, y);
2544 gdk_draw_line (window, gc2,
2545 x + 1, y + 1, x + gap_x - 1, y + 1);
2546 gdk_draw_line (window, gc2,
2547 x + gap_x, y, x + gap_x, y);
2549 if ((width - (gap_x + gap_width)) > 0)
2551 gdk_draw_line (window, gc1,
2552 x + gap_x + gap_width, y, x + width - 2, y);
2553 gdk_draw_line (window, gc2,
2554 x + gap_x + gap_width, y + 1, x + width - 2, y + 1);
2555 gdk_draw_line (window, gc2,
2556 x + gap_x + gap_width - 1, y, x + gap_x + gap_width - 1, y);
2559 case GTK_POS_BOTTOM:
2560 gdk_draw_line (window, gc1,
2561 x, y, x + width - 1, y);
2562 gdk_draw_line (window, gc1,
2563 x, y, x, y + height - 1);
2564 gdk_draw_line (window, gc2,
2565 x + 1, y + 1, x + width - 2, y + 1);
2566 gdk_draw_line (window, gc2,
2567 x + 1, y + 1, x + 1, y + height - 1);
2569 gdk_draw_line (window, gc3,
2570 x + width - 2, y + 1, x + width - 2, y + height - 1);
2571 gdk_draw_line (window, gc4,
2572 x + width - 1, y, x + width - 1, y + height - 1);
2575 gdk_draw_line (window, gc4,
2576 x, y + height - 1, x + gap_x - 1, y + height - 1);
2577 gdk_draw_line (window, gc3,
2578 x + 1, y + height - 2, x + gap_x - 1, y + height - 2);
2579 gdk_draw_line (window, gc3,
2580 x + gap_x, y + height - 1, x + gap_x, y + height - 1);
2582 if ((width - (gap_x + gap_width)) > 0)
2584 gdk_draw_line (window, gc4,
2585 x + gap_x + gap_width, y + height - 1, x + width - 2, y + height - 1);
2586 gdk_draw_line (window, gc3,
2587 x + gap_x + gap_width, y + height - 2, x + width - 2, y + height - 2);
2588 gdk_draw_line (window, gc3,
2589 x + gap_x + gap_width - 1, y + height - 1, x + gap_x + gap_width - 1, y + height - 1);
2593 gdk_draw_line (window, gc1,
2594 x, y, x + width - 1, y);
2595 gdk_draw_line (window, gc2,
2596 x, y + 1, x + width - 2, y + 1);
2598 gdk_draw_line (window, gc3,
2599 x, y + height - 2, x + width - 2, y + height - 2);
2600 gdk_draw_line (window, gc3,
2601 x + width - 2, y + 1, x + width - 2, y + height - 2);
2602 gdk_draw_line (window, gc4,
2603 x, y + height - 1, x + width - 1, y + height - 1);
2604 gdk_draw_line (window, gc4,
2605 x + width - 1, y, x + width - 1, y + height - 1);
2608 gdk_draw_line (window, gc1,
2609 x, y, x, y + gap_x - 1);
2610 gdk_draw_line (window, gc2,
2611 x + 1, y + 1, x + 1, y + gap_x - 1);
2612 gdk_draw_line (window, gc2,
2613 x, y + gap_x, x, y + gap_x);
2615 if ((width - (gap_x + gap_width)) > 0)
2617 gdk_draw_line (window, gc1,
2618 x, y + gap_x + gap_width, x, y + height - 2);
2619 gdk_draw_line (window, gc2,
2620 x + 1, y + gap_x + gap_width, x + 1, y + height - 2);
2621 gdk_draw_line (window, gc2,
2622 x, y + gap_x + gap_width - 1, x, y + gap_x + gap_width - 1);
2626 gdk_draw_line (window, gc1,
2627 x, y, x + width - 1, y);
2628 gdk_draw_line (window, gc1,
2629 x, y, x, y + height - 1);
2630 gdk_draw_line (window, gc2,
2631 x + 1, y + 1, x + width - 1, y + 1);
2632 gdk_draw_line (window, gc2,
2633 x + 1, y + 1, x + 1, y + height - 2);
2635 gdk_draw_line (window, gc3,
2636 x + 1, y + height - 2, x + width - 1, y + height - 2);
2637 gdk_draw_line (window, gc4,
2638 x, y + height - 1, x + width - 1, y + height - 1);
2641 gdk_draw_line (window, gc4,
2642 x + width - 1, y, x + width - 1, y + gap_x - 1);
2643 gdk_draw_line (window, gc3,
2644 x + width - 2, y + 1, x + width - 2, y + gap_x - 1);
2645 gdk_draw_line (window, gc3,
2646 x + width - 1, y + gap_x, x + width - 1, y + gap_x);
2648 if ((width - (gap_x + gap_width)) > 0)
2650 gdk_draw_line (window, gc4,
2651 x + width - 1, y + gap_x + gap_width, x + width - 1, y + height - 2);
2652 gdk_draw_line (window, gc3,
2653 x + width - 2, y + gap_x + gap_width, x + width - 2, y + height - 2);
2654 gdk_draw_line (window, gc3,
2655 x + width - 1, y + gap_x + gap_width - 1, x + width - 1, y + gap_x + gap_width - 1);
2663 gdk_gc_set_clip_rectangle (gc1, NULL);
2664 gdk_gc_set_clip_rectangle (gc2, NULL);
2665 gdk_gc_set_clip_rectangle (gc3, NULL);
2666 gdk_gc_set_clip_rectangle (gc4, NULL);
2671 gtk_default_draw_box_gap (GtkStyle *style,
2673 GtkStateType state_type,
2674 GtkShadowType shadow_type,
2677 const gchar *detail,
2682 GtkPositionType gap_side,
2691 g_return_if_fail (style != NULL);
2692 g_return_if_fail (window != NULL);
2694 gtk_style_apply_default_background (style, window,
2695 widget && !GTK_WIDGET_NO_WINDOW (widget),
2696 state_type, area, x, y, width, height);
2698 if (width == -1 && height == -1)
2699 gdk_window_get_size (window, &width, &height);
2700 else if (width == -1)
2701 gdk_window_get_size (window, &width, NULL);
2702 else if (height == -1)
2703 gdk_window_get_size (window, NULL, &height);
2705 switch (shadow_type)
2707 case GTK_SHADOW_NONE:
2710 gc1 = style->dark_gc[state_type];
2711 gc2 = style->black_gc;
2712 gc3 = style->bg_gc[state_type];
2713 gc4 = style->light_gc[state_type];
2715 case GTK_SHADOW_ETCHED_IN:
2716 gc1 = style->dark_gc[state_type];
2717 gc2 = style->light_gc[state_type];
2718 gc3 = style->dark_gc[state_type];
2719 gc4 = style->light_gc[state_type];
2721 case GTK_SHADOW_OUT:
2722 gc1 = style->light_gc[state_type];
2723 gc2 = style->bg_gc[state_type];
2724 gc3 = style->dark_gc[state_type];
2725 gc4 = style->black_gc;
2727 case GTK_SHADOW_ETCHED_OUT:
2728 gc1 = style->light_gc[state_type];
2729 gc2 = style->dark_gc[state_type];
2730 gc3 = style->light_gc[state_type];
2731 gc4 = style->dark_gc[state_type];
2737 gdk_gc_set_clip_rectangle (gc1, area);
2738 gdk_gc_set_clip_rectangle (gc2, area);
2739 gdk_gc_set_clip_rectangle (gc3, area);
2740 gdk_gc_set_clip_rectangle (gc4, area);
2743 switch (shadow_type)
2745 case GTK_SHADOW_NONE:
2747 case GTK_SHADOW_OUT:
2748 case GTK_SHADOW_ETCHED_IN:
2749 case GTK_SHADOW_ETCHED_OUT:
2753 gdk_draw_line (window, gc1,
2754 x, y, x, y + height - 1);
2755 gdk_draw_line (window, gc2,
2756 x + 1, y, x + 1, y + height - 2);
2758 gdk_draw_line (window, gc3,
2759 x + 1, y + height - 2, x + width - 2, y + height - 2);
2760 gdk_draw_line (window, gc3,
2761 x + width - 2, y, 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 + gap_x - 1, y);
2770 gdk_draw_line (window, gc2,
2771 x + 1, y + 1, x + gap_x - 1, y + 1);
2772 gdk_draw_line (window, gc2,
2773 x + gap_x, y, x + gap_x, y);
2775 if ((width - (gap_x + gap_width)) > 0)
2777 gdk_draw_line (window, gc1,
2778 x + gap_x + gap_width, y, x + width - 2, y);
2779 gdk_draw_line (window, gc2,
2780 x + gap_x + gap_width, y + 1, x + width - 2, y + 1);
2781 gdk_draw_line (window, gc2,
2782 x + gap_x + gap_width - 1, y, x + gap_x + gap_width - 1, y);
2785 case GTK_POS_BOTTOM:
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 - 2, y + 1);
2792 gdk_draw_line (window, gc2,
2793 x + 1, y + 1, x + 1, y + height - 1);
2795 gdk_draw_line (window, gc3,
2796 x + width - 2, y + 1, x + width - 2, y + height - 1);
2797 gdk_draw_line (window, gc4,
2798 x + width - 1, y, x + width - 1, y + height - 1);
2801 gdk_draw_line (window, gc4,
2802 x, y + height - 1, x + gap_x - 1, y + height - 1);
2803 gdk_draw_line (window, gc3,
2804 x + 1, y + height - 2, x + gap_x - 1, y + height - 2);
2805 gdk_draw_line (window, gc3,
2806 x + gap_x, y + height - 1, x + gap_x, y + height - 1);
2808 if ((width - (gap_x + gap_width)) > 0)
2810 gdk_draw_line (window, gc4,
2811 x + gap_x + gap_width, y + height - 1, x + width - 2, y + height - 1);
2812 gdk_draw_line (window, gc3,
2813 x + gap_x + gap_width, y + height - 2, x + width - 2, y + height - 2);
2814 gdk_draw_line (window, gc3,
2815 x + gap_x + gap_width - 1, y + height - 1, x + gap_x + gap_width - 1, y + height - 1);
2819 gdk_draw_line (window, gc1,
2820 x, y, x + width - 1, y);
2821 gdk_draw_line (window, gc2,
2822 x, y + 1, x + width - 2, y + 1);
2824 gdk_draw_line (window, gc3,
2825 x, y + height - 2, x + width - 2, y + height - 2);
2826 gdk_draw_line (window, gc3,
2827 x + width - 2, y + 1, x + width - 2, y + height - 2);
2828 gdk_draw_line (window, gc4,
2829 x, y + height - 1, x + width - 1, y + height - 1);
2830 gdk_draw_line (window, gc4,
2831 x + width - 1, y, x + width - 1, y + height - 1);
2834 gdk_draw_line (window, gc1,
2835 x, y, x, y + gap_x - 1);
2836 gdk_draw_line (window, gc2,
2837 x + 1, y + 1, x + 1, y + gap_x - 1);
2838 gdk_draw_line (window, gc2,
2839 x, y + gap_x, x, y + gap_x);
2841 if ((width - (gap_x + gap_width)) > 0)
2843 gdk_draw_line (window, gc1,
2844 x, y + gap_x + gap_width, x, y + height - 2);
2845 gdk_draw_line (window, gc2,
2846 x + 1, y + gap_x + gap_width, x + 1, y + height - 2);
2847 gdk_draw_line (window, gc2,
2848 x, y + gap_x + gap_width - 1, x, y + gap_x + gap_width - 1);
2852 gdk_draw_line (window, gc1,
2853 x, y, x + width - 1, y);
2854 gdk_draw_line (window, gc1,
2855 x, y, x, y + height - 1);
2856 gdk_draw_line (window, gc2,
2857 x + 1, y + 1, x + width - 1, y + 1);
2858 gdk_draw_line (window, gc2,
2859 x + 1, y + 1, x + 1, y + height - 2);
2861 gdk_draw_line (window, gc3,
2862 x + 1, y + height - 2, x + width - 1, y + height - 2);
2863 gdk_draw_line (window, gc4,
2864 x, y + height - 1, x + width - 1, y + height - 1);
2867 gdk_draw_line (window, gc4,
2868 x + width - 1, y, x + width - 1, y + gap_x - 1);
2869 gdk_draw_line (window, gc3,
2870 x + width - 2, y + 1, x + width - 2, y + gap_x - 1);
2871 gdk_draw_line (window, gc3,
2872 x + width - 1, y + gap_x, x + width - 1, y + gap_x);
2874 if ((width - (gap_x + gap_width)) > 0)
2876 gdk_draw_line (window, gc4,
2877 x + width - 1, y + gap_x + gap_width, x + width - 1, y + height - 2);
2878 gdk_draw_line (window, gc3,
2879 x + width - 2, y + gap_x + gap_width, x + width - 2, y + height - 2);
2880 gdk_draw_line (window, gc3,
2881 x + width - 1, y + gap_x + gap_width - 1, x + width - 1, y + gap_x + gap_width - 1);
2889 gdk_gc_set_clip_rectangle (gc1, NULL);
2890 gdk_gc_set_clip_rectangle (gc2, NULL);
2891 gdk_gc_set_clip_rectangle (gc3, NULL);
2892 gdk_gc_set_clip_rectangle (gc4, NULL);
2897 gtk_default_draw_extension (GtkStyle *style,
2899 GtkStateType state_type,
2900 GtkShadowType shadow_type,
2903 const gchar *detail,
2908 GtkPositionType gap_side)
2915 g_return_if_fail (style != NULL);
2916 g_return_if_fail (window != NULL);
2918 gtk_style_apply_default_background (style, window,
2919 widget && !GTK_WIDGET_NO_WINDOW (widget),
2920 GTK_STATE_NORMAL, area, x, y, width, height);
2922 if (width == -1 && height == -1)
2923 gdk_window_get_size (window, &width, &height);
2924 else if (width == -1)
2925 gdk_window_get_size (window, &width, NULL);
2926 else if (height == -1)
2927 gdk_window_get_size (window, NULL, &height);
2929 switch (shadow_type)
2931 case GTK_SHADOW_NONE:
2934 gc1 = style->dark_gc[state_type];
2935 gc2 = style->black_gc;
2936 gc3 = style->bg_gc[state_type];
2937 gc4 = style->light_gc[state_type];
2939 case GTK_SHADOW_ETCHED_IN:
2940 gc1 = style->dark_gc[state_type];
2941 gc2 = style->light_gc[state_type];
2942 gc3 = style->dark_gc[state_type];
2943 gc4 = style->light_gc[state_type];
2945 case GTK_SHADOW_OUT:
2946 gc1 = style->light_gc[state_type];
2947 gc2 = style->bg_gc[state_type];
2948 gc3 = style->dark_gc[state_type];
2949 gc4 = style->black_gc;
2951 case GTK_SHADOW_ETCHED_OUT:
2952 gc1 = style->light_gc[state_type];
2953 gc2 = style->dark_gc[state_type];
2954 gc3 = style->light_gc[state_type];
2955 gc4 = style->dark_gc[state_type];
2961 gdk_gc_set_clip_rectangle (gc1, area);
2962 gdk_gc_set_clip_rectangle (gc2, area);
2963 gdk_gc_set_clip_rectangle (gc3, area);
2964 gdk_gc_set_clip_rectangle (gc4, area);
2967 switch (shadow_type)
2969 case GTK_SHADOW_NONE:
2971 case GTK_SHADOW_OUT:
2972 case GTK_SHADOW_ETCHED_IN:
2973 case GTK_SHADOW_ETCHED_OUT:
2977 gtk_style_apply_default_background (style, window,
2978 widget && !GTK_WIDGET_NO_WINDOW (widget),
2980 x + style->xthickness,
2982 width - (2 * style->xthickness),
2983 height - (style->ythickness));
2984 gdk_draw_line (window, gc1,
2985 x, y, x, y + height - 2);
2986 gdk_draw_line (window, gc2,
2987 x + 1, y, x + 1, y + height - 2);
2989 gdk_draw_line (window, gc3,
2990 x + 2, y + height - 2, x + width - 2, y + height - 2);
2991 gdk_draw_line (window, gc3,
2992 x + width - 2, y, x + width - 2, y + height - 2);
2993 gdk_draw_line (window, gc4,
2994 x + 1, y + height - 1, x + width - 2, y + height - 1);
2995 gdk_draw_line (window, gc4,
2996 x + width - 1, y, x + width - 1, y + height - 2);
2998 case GTK_POS_BOTTOM:
2999 gtk_style_apply_default_background (style, window,
3000 widget && !GTK_WIDGET_NO_WINDOW (widget),
3002 x + style->xthickness,
3003 y + style->ythickness,
3004 width - (2 * style->xthickness),
3005 height - (style->ythickness));
3006 gdk_draw_line (window, gc1,
3007 x + 1, y, x + width - 2, y);
3008 gdk_draw_line (window, gc1,
3009 x, y + 1, x, y + height - 1);
3010 gdk_draw_line (window, gc2,
3011 x + 1, y + 1, x + width - 2, y + 1);
3012 gdk_draw_line (window, gc2,
3013 x + 1, y + 1, x + 1, y + height - 1);
3015 gdk_draw_line (window, gc3,
3016 x + width - 2, y + 2, x + width - 2, y + height - 1);
3017 gdk_draw_line (window, gc4,
3018 x + width - 1, y + 1, x + width - 1, y + height - 1);
3021 gtk_style_apply_default_background (style, window,
3022 widget && !GTK_WIDGET_NO_WINDOW (widget),
3025 y + style->ythickness,
3026 width - (style->xthickness),
3027 height - (2 * style->ythickness));
3028 gdk_draw_line (window, gc1,
3029 x, y, x + width - 2, y);
3030 gdk_draw_line (window, gc2,
3031 x + 1, y + 1, x + width - 2, y + 1);
3033 gdk_draw_line (window, gc3,
3034 x, y + height - 2, x + width - 2, y + height - 2);
3035 gdk_draw_line (window, gc3,
3036 x + width - 2, y + 2, x + width - 2, y + height - 2);
3037 gdk_draw_line (window, gc4,
3038 x, y + height - 1, x + width - 2, y + height - 1);
3039 gdk_draw_line (window, gc4,
3040 x + width - 1, y + 1, x + width - 1, y + height - 2);
3043 gtk_style_apply_default_background (style, window,
3044 widget && !GTK_WIDGET_NO_WINDOW (widget),
3046 x + style->xthickness,
3047 y + style->ythickness,
3048 width - (style->xthickness),
3049 height - (2 * style->ythickness));
3050 gdk_draw_line (window, gc1,
3051 x + 1, y, x + width - 1, y);
3052 gdk_draw_line (window, gc1,
3053 x, y + 1, x, y + height - 2);
3054 gdk_draw_line (window, gc2,
3055 x + 1, y + 1, x + width - 1, y + 1);
3056 gdk_draw_line (window, gc2,
3057 x + 1, y + 1, x + 1, y + height - 2);
3059 gdk_draw_line (window, gc3,
3060 x + 2, y + height - 2, x + width - 1, y + height - 2);
3061 gdk_draw_line (window, gc4,
3062 x + 1, y + height - 1, x + width - 1, y + height - 1);
3069 gdk_gc_set_clip_rectangle (gc1, NULL);
3070 gdk_gc_set_clip_rectangle (gc2, NULL);
3071 gdk_gc_set_clip_rectangle (gc3, NULL);
3072 gdk_gc_set_clip_rectangle (gc4, NULL);
3077 gtk_default_draw_focus (GtkStyle *style,
3081 const gchar *detail,
3087 g_return_if_fail (style != NULL);
3088 g_return_if_fail (window != NULL);
3090 if (width == -1 && height == -1)
3092 gdk_window_get_size (window, &width, &height);
3096 else if (width == -1)
3098 gdk_window_get_size (window, &width, NULL);
3101 else if (height == -1)
3103 gdk_window_get_size (window, NULL, &height);
3108 gdk_gc_set_clip_rectangle (style->black_gc, area);
3110 if (detail && !strcmp (detail, "add-mode"))
3112 gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_ON_OFF_DASH, 0, 0);
3113 gdk_gc_set_dashes (style->black_gc, 0, "\4\4", 2);
3115 gdk_draw_rectangle (window,
3116 style->black_gc, FALSE,
3117 x, y, width, height);
3119 gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_SOLID, 0, 0);
3123 gdk_draw_rectangle (window,
3124 style->black_gc, FALSE,
3125 x, y, width, height);
3129 gdk_gc_set_clip_rectangle (style->black_gc, NULL);
3133 gtk_default_draw_slider (GtkStyle *style,
3135 GtkStateType state_type,
3136 GtkShadowType shadow_type,
3139 const gchar *detail,
3144 GtkOrientation orientation)
3146 g_return_if_fail (style != NULL);
3147 g_return_if_fail (window != NULL);
3149 if (width == -1 && height == -1)
3150 gdk_window_get_size (window, &width, &height);
3151 else if (width == -1)
3152 gdk_window_get_size (window, &width, NULL);
3153 else if (height == -1)
3154 gdk_window_get_size (window, NULL, &height);
3156 gtk_paint_box (style, window, state_type, shadow_type,
3157 area, widget, detail, x, y, width, height);
3159 if (orientation == GTK_ORIENTATION_HORIZONTAL)
3160 gtk_paint_vline (style, window, state_type, area, widget, detail,
3162 height - style->ythickness - 1, width / 2);
3164 gtk_paint_hline (style, window, state_type, area, widget, detail,
3166 width - style->xthickness - 1, height / 2);
3170 draw_dot (GdkWindow *window,
3178 size = CLAMP (size, 2, 3);
3182 gdk_draw_point (window, light_gc, x, y);
3183 gdk_draw_point (window, light_gc, x+1, y+1);
3185 else if (size == 3);
3187 gdk_draw_point (window, light_gc, x, y);
3188 gdk_draw_point (window, light_gc, x+1, y);
3189 gdk_draw_point (window, light_gc, x, y+1);
3190 gdk_draw_point (window, dark_gc, x+1, y+2);
3191 gdk_draw_point (window, dark_gc, x+2, y+1);
3192 gdk_draw_point (window, dark_gc, x+2, y+2);
3197 gtk_default_draw_handle (GtkStyle *style,
3199 GtkStateType state_type,
3200 GtkShadowType shadow_type,
3203 const gchar *detail,
3208 GtkOrientation orientation)
3211 gint xthick, ythick;
3212 GdkGC *light_gc, *dark_gc;
3217 g_return_if_fail (style != NULL);
3218 g_return_if_fail (window != NULL);
3220 if (width == -1 && height == -1)
3221 gdk_window_get_size (window, &width, &height);
3222 else if (width == -1)
3223 gdk_window_get_size (window, &width, NULL);
3224 else if (height == -1)
3225 gdk_window_get_size (window, NULL, &height);
3227 gtk_paint_box (style, window, state_type, shadow_type, area, widget,
3228 detail, x, y, width, height);
3231 if (!strcmp (detail, "paned"))
3233 /* we want to ignore the shadow border in paned widgets */
3237 light_gc = style->light_gc[state_type];
3238 dark_gc = style->black_gc;
3242 xthick = style->xthickness;
3243 ythick = style->ythickness;
3245 light_gc = style->light_gc[state_type];
3246 dark_gc = style->dark_gc[state_type];
3249 rect.x = x + xthick;
3250 rect.y = y + ythick;
3251 rect.width = width - (xthick * 2);
3252 rect.height = height - (ythick * 2);
3255 intersect = gdk_rectangle_intersect (area, &rect, &dest);
3265 gdk_gc_set_clip_rectangle (light_gc, &dest);
3266 gdk_gc_set_clip_rectangle (dark_gc, &dest);
3268 if (!strcmp (detail, "paned"))
3273 gdk_window_get_size (window, &window_width, &window_height);
3275 if (orientation == GTK_ORIENTATION_HORIZONTAL)
3276 for (xx = window_width/2 - 15; xx <= window_width/2 + 15; xx += 5)
3277 draw_dot (window, light_gc, dark_gc, xx, window_height/2 - 1, 3);
3279 for (yy = window_height/2 - 15; yy <= window_height/2 + 15; yy += 5)
3280 draw_dot (window, light_gc, dark_gc, window_width/2 - 1, yy, 3);
3284 for (yy = y + ythick; yy < (y + height - ythick); yy += 3)
3285 for (xx = x + xthick; xx < (x + width - xthick); xx += 6)
3287 draw_dot (window, light_gc, dark_gc, xx, yy, 2);
3288 draw_dot (window, light_gc, dark_gc, xx + 3, yy + 1, 2);
3292 gdk_gc_set_clip_rectangle (light_gc, NULL);
3293 gdk_gc_set_clip_rectangle (dark_gc, NULL);
3297 gtk_style_shade (GdkColor *a,
3305 red = (gdouble) a->red / 65535.0;
3306 green = (gdouble) a->green / 65535.0;
3307 blue = (gdouble) a->blue / 65535.0;
3309 rgb_to_hls (&red, &green, &blue);
3314 else if (green < 0.0)
3320 else if (blue < 0.0)
3323 hls_to_rgb (&red, &green, &blue);
3325 b->red = red * 65535.0;
3326 b->green = green * 65535.0;
3327 b->blue = blue * 65535.0;
3331 rgb_to_hls (gdouble *r,
3372 l = (max + min) / 2;
3379 s = (max - min) / (max + min);
3381 s = (max - min) / (2 - max - min);
3385 h = (green - blue) / delta;
3386 else if (green == max)
3387 h = 2 + (blue - red) / delta;
3388 else if (blue == max)
3389 h = 4 + (red - green) / delta;
3402 hls_to_rgb (gdouble *h,
3415 if (lightness <= 0.5)
3416 m2 = lightness * (1 + saturation);
3418 m2 = lightness + saturation - lightness * saturation;
3419 m1 = 2 * lightness - m2;
3421 if (saturation == 0)
3436 r = m1 + (m2 - m1) * hue / 60;
3440 r = m1 + (m2 - m1) * (240 - hue) / 60;
3451 g = m1 + (m2 - m1) * hue / 60;
3455 g = m1 + (m2 - m1) * (240 - hue) / 60;
3466 b = m1 + (m2 - m1) * hue / 60;
3470 b = m1 + (m2 - m1) * (240 - hue) / 60;
3481 gtk_paint_hline (GtkStyle *style,
3483 GtkStateType state_type,
3486 const gchar *detail,
3491 g_return_if_fail (style != NULL);
3492 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL);
3494 GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type, area, widget, detail, x1, x2, y);
3498 gtk_paint_vline (GtkStyle *style,
3500 GtkStateType state_type,
3503 const gchar *detail,
3508 g_return_if_fail (style != NULL);
3509 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL);
3511 GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type, area, widget, detail, y1, y2, x);
3515 gtk_paint_shadow (GtkStyle *style,
3517 GtkStateType state_type,
3518 GtkShadowType shadow_type,
3521 const gchar *detail,
3527 g_return_if_fail (style != NULL);
3528 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
3530 GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3534 gtk_paint_polygon (GtkStyle *style,
3536 GtkStateType state_type,
3537 GtkShadowType shadow_type,
3540 const gchar *detail,
3545 g_return_if_fail (style != NULL);
3546 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL);
3548 GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type, area, widget, detail, points, npoints, fill);
3552 gtk_paint_arrow (GtkStyle *style,
3554 GtkStateType state_type,
3555 GtkShadowType shadow_type,
3558 const gchar *detail,
3559 GtkArrowType arrow_type,
3566 g_return_if_fail (style != NULL);
3567 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL);
3569 GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height);
3573 gtk_paint_diamond (GtkStyle *style,
3575 GtkStateType state_type,
3576 GtkShadowType shadow_type,
3579 const gchar *detail,
3585 g_return_if_fail (style != NULL);
3586 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL);
3588 GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3592 gtk_paint_oval (GtkStyle *style,
3594 GtkStateType state_type,
3595 GtkShadowType shadow_type,
3598 const gchar *detail,
3604 g_return_if_fail (style != NULL);
3605 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_oval != NULL);
3607 GTK_STYLE_GET_CLASS (style)->draw_oval (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3611 gtk_paint_string (GtkStyle *style,
3613 GtkStateType state_type,
3616 const gchar *detail,
3619 const gchar *string)
3621 g_return_if_fail (style != NULL);
3622 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_string != NULL);
3624 GTK_STYLE_GET_CLASS (style)->draw_string (style, window, state_type, area, widget, detail, x, y, string);
3628 gtk_paint_box (GtkStyle *style,
3630 GtkStateType state_type,
3631 GtkShadowType shadow_type,
3634 const gchar *detail,
3640 g_return_if_fail (style != NULL);
3641 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL);
3643 GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3647 gtk_paint_flat_box (GtkStyle *style,
3649 GtkStateType state_type,
3650 GtkShadowType shadow_type,
3653 const gchar *detail,
3659 g_return_if_fail (style != NULL);
3660 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL);
3662 GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3666 gtk_paint_check (GtkStyle *style,
3668 GtkStateType state_type,
3669 GtkShadowType shadow_type,
3672 const gchar *detail,
3678 g_return_if_fail (style != NULL);
3679 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL);
3681 GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3685 gtk_paint_option (GtkStyle *style,
3687 GtkStateType state_type,
3688 GtkShadowType shadow_type,
3691 const gchar *detail,
3697 g_return_if_fail (style != NULL);
3698 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL);
3700 GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3704 gtk_paint_cross (GtkStyle *style,
3706 GtkStateType state_type,
3707 GtkShadowType shadow_type,
3710 const gchar *detail,
3716 g_return_if_fail (style != NULL);
3717 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_cross != NULL);
3719 GTK_STYLE_GET_CLASS (style)->draw_cross (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3723 gtk_paint_ramp (GtkStyle *style,
3725 GtkStateType state_type,
3726 GtkShadowType shadow_type,
3729 const gchar *detail,
3730 GtkArrowType arrow_type,
3736 g_return_if_fail (style != NULL);
3737 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_ramp != NULL);
3739 GTK_STYLE_GET_CLASS (style)->draw_ramp (style, window, state_type, shadow_type, area, widget, detail, arrow_type, x, y, width, height);
3743 gtk_paint_tab (GtkStyle *style,
3745 GtkStateType state_type,
3746 GtkShadowType shadow_type,
3749 const gchar *detail,
3755 g_return_if_fail (style != NULL);
3756 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL);
3758 GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
3762 gtk_paint_shadow_gap (GtkStyle *style,
3764 GtkStateType state_type,
3765 GtkShadowType shadow_type,
3773 GtkPositionType gap_side,
3777 g_return_if_fail (style != NULL);
3778 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL);
3780 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);
3785 gtk_paint_box_gap (GtkStyle *style,
3787 GtkStateType state_type,
3788 GtkShadowType shadow_type,
3796 GtkPositionType gap_side,
3800 g_return_if_fail (style != NULL);
3801 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL);
3803 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);
3807 gtk_paint_extension (GtkStyle *style,
3809 GtkStateType state_type,
3810 GtkShadowType shadow_type,
3818 GtkPositionType gap_side)
3820 g_return_if_fail (style != NULL);
3821 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL);
3823 GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side);
3827 gtk_paint_focus (GtkStyle *style,
3831 const gchar *detail,
3837 g_return_if_fail (style != NULL);
3838 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL);
3840 GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, area, widget, detail, x, y, width, height);
3844 gtk_paint_slider (GtkStyle *style,
3846 GtkStateType state_type,
3847 GtkShadowType shadow_type,
3850 const gchar *detail,
3855 GtkOrientation orientation)
3857 g_return_if_fail (style != NULL);
3858 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_slider != NULL);
3860 GTK_STYLE_GET_CLASS (style)->draw_slider (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);
3864 gtk_paint_handle (GtkStyle *style,
3866 GtkStateType state_type,
3867 GtkShadowType shadow_type,
3870 const gchar *detail,
3875 GtkOrientation orientation)
3877 g_return_if_fail (style != NULL);
3878 g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL);
3880 GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);