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/.
27 #ifndef __GTK_STYLE_H__
28 #define __GTK_STYLE_H__
32 #include <gtk/gtkenums.h>
33 #include <pango/pango.h>
37 #endif /* __cplusplus */
39 #define GTK_TYPE_STYLE (gtk_style_get_type ())
40 #define GTK_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_STYLE, GtkStyle))
41 #define GTK_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_STYLE, GtkStyleClass))
42 #define GTK_IS_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_STYLE))
43 #define GTK_IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STYLE))
44 #define GTK_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STYLE, GtkStyleClass))
46 /* Some forward declarations needed to rationalize the header
49 typedef struct _GtkBorder GtkBorder;
50 typedef struct _GtkStyle GtkStyle;
51 typedef struct _GtkStyleClass GtkStyleClass;
52 typedef struct _GtkThemeEngine GtkThemeEngine;
53 typedef struct _GtkRcStyle GtkRcStyle;
54 typedef struct _GtkIconSet GtkIconSet;
55 typedef struct _GtkIconSource GtkIconSource;
56 typedef struct _GtkRcProperty GtkRcProperty;
57 typedef gboolean (*GtkRcPropertyParser) (const GParamSpec *pspec,
58 const GString *rc_string,
59 GValue *property_value);
61 /* We make this forward declaration here, since we pass
62 * GtkWidgt's to the draw functions.
64 typedef struct _GtkWidget GtkWidget;
66 /* This is used for having dynamic style changing stuff
67 * fg, bg, light, dark, mid, text, base
69 #define GTK_STYLE_NUM_STYLECOLORS() (7 * 5)
71 #define GTK_STYLE_ATTACHED(style) (GTK_STYLE (style)->attach_count > 0)
75 GObject parent_instance;
86 GdkColor text_aa[5]; /* Halfway between text/base */
90 PangoFontDescription *font_desc;
102 GdkGC *text_aa_gc[5];
106 GdkPixmap *bg_pixmap[5];
113 GdkColormap *colormap;
114 GdkFont *private_font;
115 PangoFontDescription *private_font_desc; /* Font description for style->private_font or %NULL */
117 /* the RcStyle from which this style was created */
118 GtkRcStyle *rc_style;
120 GSList *styles; /* of type GtkStyle* */
121 GArray *property_cache;
122 GSList *icon_factories; /* of type GtkIconFactory* */
125 struct _GtkStyleClass
127 GObjectClass parent_class;
129 /* Initialize for a particular colormap/depth
130 * combination. style->colormap/style->depth will have
131 * been set at this point. Will typically chain to parent.
133 void (*realize) (GtkStyle *style);
135 /* Clean up for a particular colormap/depth combination. Will
136 * typically chain to parent.
138 void (*unrealize) (GtkStyle *style);
140 /* Make style an exact duplicate of src.
142 void (*copy) (GtkStyle *style,
145 /* Create an empty style of the same type as this style.
146 * The default implementation, which does
147 * g_object_new (G_OBJECT_TYPE (style), NULL);
148 * should work in most cases.
150 GtkStyle *(*clone) (GtkStyle *style);
152 /* Initialize the GtkStyle with the values in the GtkRcStyle.
153 * should chain to the parent implementation.
155 void (*init_from_rc) (GtkStyle *style,
156 GtkRcStyle *rc_style);
158 void (*set_background) (GtkStyle *style,
160 GtkStateType state_type);
163 GdkPixbuf * (* render_icon) (GtkStyle *style,
164 const GtkIconSource *source,
165 GtkTextDirection direction,
169 const gchar *detail);
174 void (*draw_hline) (GtkStyle *style,
176 GtkStateType state_type,
183 void (*draw_vline) (GtkStyle *style,
185 GtkStateType state_type,
192 void (*draw_shadow) (GtkStyle *style,
194 GtkStateType state_type,
195 GtkShadowType shadow_type,
203 void (*draw_polygon) (GtkStyle *style,
205 GtkStateType state_type,
206 GtkShadowType shadow_type,
213 void (*draw_arrow) (GtkStyle *style,
215 GtkStateType state_type,
216 GtkShadowType shadow_type,
220 GtkArrowType arrow_type,
226 void (*draw_diamond) (GtkStyle *style,
228 GtkStateType state_type,
229 GtkShadowType shadow_type,
237 void (*draw_string) (GtkStyle *style,
239 GtkStateType state_type,
245 const gchar *string);
246 void (*draw_box) (GtkStyle *style,
248 GtkStateType state_type,
249 GtkShadowType shadow_type,
257 void (*draw_flat_box) (GtkStyle *style,
259 GtkStateType state_type,
260 GtkShadowType shadow_type,
268 void (*draw_check) (GtkStyle *style,
270 GtkStateType state_type,
271 GtkShadowType shadow_type,
279 void (*draw_option) (GtkStyle *style,
281 GtkStateType state_type,
282 GtkShadowType shadow_type,
290 void (*draw_tab) (GtkStyle *style,
292 GtkStateType state_type,
293 GtkShadowType shadow_type,
301 void (*draw_shadow_gap) (GtkStyle *style,
303 GtkStateType state_type,
304 GtkShadowType shadow_type,
312 GtkPositionType gap_side,
315 void (*draw_box_gap) (GtkStyle *style,
317 GtkStateType state_type,
318 GtkShadowType shadow_type,
326 GtkPositionType gap_side,
329 void (*draw_extension) (GtkStyle *style,
331 GtkStateType state_type,
332 GtkShadowType shadow_type,
340 GtkPositionType gap_side);
341 void (*draw_focus) (GtkStyle *style,
350 void (*draw_slider) (GtkStyle *style,
352 GtkStateType state_type,
353 GtkShadowType shadow_type,
361 GtkOrientation orientation);
362 void (*draw_handle) (GtkStyle *style,
364 GtkStateType state_type,
365 GtkShadowType shadow_type,
373 GtkOrientation orientation);
375 void (*draw_expander) (GtkStyle *style,
377 GtkStateType state_type,
383 GtkExpanderStyle expander_style);
384 void (*draw_layout) (GtkStyle *style,
386 GtkStateType state_type,
393 PangoLayout *layout);
394 void (*draw_resize_grip) (GtkStyle *style,
396 GtkStateType state_type,
416 GType gtk_style_get_type (void) G_GNUC_CONST;
417 GtkStyle* gtk_style_new (void);
418 GtkStyle* gtk_style_copy (GtkStyle *style);
419 GtkStyle* gtk_style_attach (GtkStyle *style,
421 void gtk_style_detach (GtkStyle *style);
423 #ifndef GTK_DISABLE_DEPRECATED
424 GtkStyle* gtk_style_ref (GtkStyle *style);
425 void gtk_style_unref (GtkStyle *style);
427 GdkFont * gtk_style_get_font (GtkStyle *style);
428 void gtk_style_set_font (GtkStyle *style,
430 #endif /* GTK_DISABLE_DEPRECATED */
432 void gtk_style_set_background (GtkStyle *style,
434 GtkStateType state_type);
435 void gtk_style_apply_default_background (GtkStyle *style,
438 GtkStateType state_type,
445 GtkIconSet* gtk_style_lookup_icon_set (GtkStyle *style,
446 const gchar *stock_id);
447 GdkPixbuf* gtk_style_render_icon (GtkStyle *style,
448 const GtkIconSource *source,
449 GtkTextDirection direction,
453 const gchar *detail);
454 #ifndef GTK_DISABLE_DEPRECATED
455 void gtk_draw_hline (GtkStyle *style,
457 GtkStateType state_type,
461 void gtk_draw_vline (GtkStyle *style,
463 GtkStateType state_type,
467 void gtk_draw_shadow (GtkStyle *style,
469 GtkStateType state_type,
470 GtkShadowType shadow_type,
475 void gtk_draw_polygon (GtkStyle *style,
477 GtkStateType state_type,
478 GtkShadowType shadow_type,
482 void gtk_draw_arrow (GtkStyle *style,
484 GtkStateType state_type,
485 GtkShadowType shadow_type,
486 GtkArrowType arrow_type,
492 void gtk_draw_diamond (GtkStyle *style,
494 GtkStateType state_type,
495 GtkShadowType shadow_type,
500 void gtk_draw_box (GtkStyle *style,
502 GtkStateType state_type,
503 GtkShadowType shadow_type,
508 void gtk_draw_flat_box (GtkStyle *style,
510 GtkStateType state_type,
511 GtkShadowType shadow_type,
516 void gtk_draw_check (GtkStyle *style,
518 GtkStateType state_type,
519 GtkShadowType shadow_type,
524 void gtk_draw_option (GtkStyle *style,
526 GtkStateType state_type,
527 GtkShadowType shadow_type,
532 void gtk_draw_tab (GtkStyle *style,
534 GtkStateType state_type,
535 GtkShadowType shadow_type,
540 void gtk_draw_shadow_gap (GtkStyle *style,
542 GtkStateType state_type,
543 GtkShadowType shadow_type,
548 GtkPositionType gap_side,
551 void gtk_draw_box_gap (GtkStyle *style,
553 GtkStateType state_type,
554 GtkShadowType shadow_type,
559 GtkPositionType gap_side,
562 void gtk_draw_extension (GtkStyle *style,
564 GtkStateType state_type,
565 GtkShadowType shadow_type,
570 GtkPositionType gap_side);
571 void gtk_draw_focus (GtkStyle *style,
577 void gtk_draw_slider (GtkStyle *style,
579 GtkStateType state_type,
580 GtkShadowType shadow_type,
585 GtkOrientation orientation);
586 void gtk_draw_handle (GtkStyle *style,
588 GtkStateType state_type,
589 GtkShadowType shadow_type,
594 GtkOrientation orientation);
595 void gtk_draw_expander (GtkStyle *style,
597 GtkStateType state_type,
600 GtkExpanderStyle expander_style);
601 void gtk_draw_layout (GtkStyle *style,
603 GtkStateType state_type,
607 PangoLayout *layout);
608 void gtk_draw_resize_grip (GtkStyle *style,
610 GtkStateType state_type,
616 #endif /* GTK_DISABLE_DEPRECATED */
618 void gtk_paint_hline (GtkStyle *style,
620 GtkStateType state_type,
627 void gtk_paint_vline (GtkStyle *style,
629 GtkStateType state_type,
636 void gtk_paint_shadow (GtkStyle *style,
638 GtkStateType state_type,
639 GtkShadowType shadow_type,
647 void gtk_paint_polygon (GtkStyle *style,
649 GtkStateType state_type,
650 GtkShadowType shadow_type,
657 void gtk_paint_arrow (GtkStyle *style,
659 GtkStateType state_type,
660 GtkShadowType shadow_type,
664 GtkArrowType arrow_type,
670 void gtk_paint_diamond (GtkStyle *style,
672 GtkStateType state_type,
673 GtkShadowType shadow_type,
681 void gtk_paint_box (GtkStyle *style,
683 GtkStateType state_type,
684 GtkShadowType shadow_type,
692 void gtk_paint_flat_box (GtkStyle *style,
694 GtkStateType state_type,
695 GtkShadowType shadow_type,
703 void gtk_paint_check (GtkStyle *style,
705 GtkStateType state_type,
706 GtkShadowType shadow_type,
714 void gtk_paint_option (GtkStyle *style,
716 GtkStateType state_type,
717 GtkShadowType shadow_type,
725 void gtk_paint_tab (GtkStyle *style,
727 GtkStateType state_type,
728 GtkShadowType shadow_type,
736 void gtk_paint_shadow_gap (GtkStyle *style,
738 GtkStateType state_type,
739 GtkShadowType shadow_type,
747 GtkPositionType gap_side,
750 void gtk_paint_box_gap (GtkStyle *style,
752 GtkStateType state_type,
753 GtkShadowType shadow_type,
761 GtkPositionType gap_side,
764 void gtk_paint_extension (GtkStyle *style,
766 GtkStateType state_type,
767 GtkShadowType shadow_type,
775 GtkPositionType gap_side);
776 void gtk_paint_focus (GtkStyle *style,
785 void gtk_paint_slider (GtkStyle *style,
787 GtkStateType state_type,
788 GtkShadowType shadow_type,
796 GtkOrientation orientation);
797 void gtk_paint_handle (GtkStyle *style,
799 GtkStateType state_type,
800 GtkShadowType shadow_type,
808 GtkOrientation orientation);
809 void gtk_paint_expander (GtkStyle *style,
811 GtkStateType state_type,
817 GtkExpanderStyle expander_style);
818 void gtk_paint_layout (GtkStyle *style,
820 GtkStateType state_type,
827 PangoLayout *layout);
829 void gtk_paint_resize_grip (GtkStyle *style,
831 GtkStateType state_type,
842 GtkBorder *gtk_border_copy (const GtkBorder *border);
843 void gtk_border_free (GtkBorder *border);
845 /* --- private API --- */
846 const GValue* _gtk_style_peek_property_value (GtkStyle *style,
849 GtkRcPropertyParser parser);
853 #ifndef GTK_DISABLE_DEPRECATED
854 #define gtk_style_apply_default_pixmap(s,gw,st,a,x,y,w,h) gtk_style_apply_default_background (s,gw,1,st,a,x,y,w,h)
855 void gtk_draw_string (GtkStyle *style,
857 GtkStateType state_type,
860 const gchar *string);
861 void gtk_paint_string (GtkStyle *style,
863 GtkStateType state_type,
869 const gchar *string);
870 #endif /* GTK_DISABLE_DEPRECATED */
872 void _gtk_draw_insertion_cursor (GdkDrawable *drawable,
874 GdkRectangle *location,
875 GtkTextDirection dir);
879 #endif /* __cplusplus */
882 #endif /* __GTK_STYLE_H__ */