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 #define GTK_TYPE_BORDER (gtk_border_get_type ())
48 /* Some forward declarations needed to rationalize the header
51 typedef struct _GtkBorder GtkBorder;
52 typedef struct _GtkStyle GtkStyle;
53 typedef struct _GtkStyleClass GtkStyleClass;
54 typedef struct _GtkThemeEngine GtkThemeEngine;
55 typedef struct _GtkRcStyle GtkRcStyle;
56 typedef struct _GtkIconSet GtkIconSet;
57 typedef struct _GtkIconSource GtkIconSource;
58 typedef struct _GtkRcProperty GtkRcProperty;
59 typedef gboolean (*GtkRcPropertyParser) (const GParamSpec *pspec,
60 const GString *rc_string,
61 GValue *property_value);
63 /* We make this forward declaration here, since we pass
64 * GtkWidget's to the draw functions.
66 typedef struct _GtkWidget GtkWidget;
68 #define GTK_STYLE_ATTACHED(style) (GTK_STYLE (style)->attach_count > 0)
72 GObject parent_instance;
83 GdkColor text_aa[5]; /* Halfway between text/base */
87 PangoFontDescription *font_desc;
103 GdkPixmap *bg_pixmap[5];
110 GdkColormap *colormap;
111 GdkFont *private_font;
112 PangoFontDescription *private_font_desc; /* Font description for style->private_font or %NULL */
114 /* the RcStyle from which this style was created */
115 GtkRcStyle *rc_style;
117 GSList *styles; /* of type GtkStyle* */
118 GArray *property_cache;
119 GSList *icon_factories; /* of type GtkIconFactory* */
122 struct _GtkStyleClass
124 GObjectClass parent_class;
126 /* Initialize for a particular colormap/depth
127 * combination. style->colormap/style->depth will have
128 * been set at this point. Will typically chain to parent.
130 void (*realize) (GtkStyle *style);
132 /* Clean up for a particular colormap/depth combination. Will
133 * typically chain to parent.
135 void (*unrealize) (GtkStyle *style);
137 /* Make style an exact duplicate of src.
139 void (*copy) (GtkStyle *style,
142 /* Create an empty style of the same type as this style.
143 * The default implementation, which does
144 * g_object_new (G_OBJECT_TYPE (style), NULL);
145 * should work in most cases.
147 GtkStyle *(*clone) (GtkStyle *style);
149 /* Initialize the GtkStyle with the values in the GtkRcStyle.
150 * should chain to the parent implementation.
152 void (*init_from_rc) (GtkStyle *style,
153 GtkRcStyle *rc_style);
155 void (*set_background) (GtkStyle *style,
157 GtkStateType state_type);
160 GdkPixbuf * (* render_icon) (GtkStyle *style,
161 const GtkIconSource *source,
162 GtkTextDirection direction,
166 const gchar *detail);
171 void (*draw_hline) (GtkStyle *style,
173 GtkStateType state_type,
180 void (*draw_vline) (GtkStyle *style,
182 GtkStateType state_type,
189 void (*draw_shadow) (GtkStyle *style,
191 GtkStateType state_type,
192 GtkShadowType shadow_type,
200 void (*draw_polygon) (GtkStyle *style,
202 GtkStateType state_type,
203 GtkShadowType shadow_type,
210 void (*draw_arrow) (GtkStyle *style,
212 GtkStateType state_type,
213 GtkShadowType shadow_type,
217 GtkArrowType arrow_type,
223 void (*draw_diamond) (GtkStyle *style,
225 GtkStateType state_type,
226 GtkShadowType shadow_type,
234 void (*draw_string) (GtkStyle *style,
236 GtkStateType state_type,
242 const gchar *string);
243 void (*draw_box) (GtkStyle *style,
245 GtkStateType state_type,
246 GtkShadowType shadow_type,
254 void (*draw_flat_box) (GtkStyle *style,
256 GtkStateType state_type,
257 GtkShadowType shadow_type,
265 void (*draw_check) (GtkStyle *style,
267 GtkStateType state_type,
268 GtkShadowType shadow_type,
276 void (*draw_option) (GtkStyle *style,
278 GtkStateType state_type,
279 GtkShadowType shadow_type,
287 void (*draw_tab) (GtkStyle *style,
289 GtkStateType state_type,
290 GtkShadowType shadow_type,
298 void (*draw_shadow_gap) (GtkStyle *style,
300 GtkStateType state_type,
301 GtkShadowType shadow_type,
309 GtkPositionType gap_side,
312 void (*draw_box_gap) (GtkStyle *style,
314 GtkStateType state_type,
315 GtkShadowType shadow_type,
323 GtkPositionType gap_side,
326 void (*draw_extension) (GtkStyle *style,
328 GtkStateType state_type,
329 GtkShadowType shadow_type,
337 GtkPositionType gap_side);
338 void (*draw_focus) (GtkStyle *style,
340 GtkStateType state_type,
348 void (*draw_slider) (GtkStyle *style,
350 GtkStateType state_type,
351 GtkShadowType shadow_type,
359 GtkOrientation orientation);
360 void (*draw_handle) (GtkStyle *style,
362 GtkStateType state_type,
363 GtkShadowType shadow_type,
371 GtkOrientation orientation);
373 void (*draw_expander) (GtkStyle *style,
375 GtkStateType state_type,
381 GtkExpanderStyle expander_style);
382 void (*draw_layout) (GtkStyle *style,
384 GtkStateType state_type,
391 PangoLayout *layout);
392 void (*draw_resize_grip) (GtkStyle *style,
394 GtkStateType state_type,
404 /* Padding for future expansion */
405 void (*_gtk_reserved1) (void);
406 void (*_gtk_reserved2) (void);
407 void (*_gtk_reserved3) (void);
408 void (*_gtk_reserved4) (void);
409 void (*_gtk_reserved5) (void);
410 void (*_gtk_reserved6) (void);
411 void (*_gtk_reserved7) (void);
412 void (*_gtk_reserved8) (void);
413 void (*_gtk_reserved9) (void);
414 void (*_gtk_reserved10) (void);
415 void (*_gtk_reserved11) (void);
416 void (*_gtk_reserved12) (void);
427 GType gtk_style_get_type (void) G_GNUC_CONST;
428 GtkStyle* gtk_style_new (void);
429 GtkStyle* gtk_style_copy (GtkStyle *style);
430 GtkStyle* gtk_style_attach (GtkStyle *style,
432 void gtk_style_detach (GtkStyle *style);
434 #ifndef GTK_DISABLE_DEPRECATED
435 GtkStyle* gtk_style_ref (GtkStyle *style);
436 void gtk_style_unref (GtkStyle *style);
438 #ifndef GDK_MULTIHEAD_SAFE
439 GdkFont * gtk_style_get_font (GtkStyle *style);
441 GdkFont * gtk_style_get_font_for_display (GdkDisplay *display,
443 void gtk_style_set_font (GtkStyle *style,
445 #endif /* GTK_DISABLE_DEPRECATED */
447 void gtk_style_set_background (GtkStyle *style,
449 GtkStateType state_type);
450 void gtk_style_apply_default_background (GtkStyle *style,
453 GtkStateType state_type,
460 GtkIconSet* gtk_style_lookup_icon_set (GtkStyle *style,
461 const gchar *stock_id);
462 GdkPixbuf* gtk_style_render_icon (GtkStyle *style,
463 const GtkIconSource *source,
464 GtkTextDirection direction,
468 const gchar *detail);
469 #ifndef GTK_DISABLE_DEPRECATED
470 void gtk_draw_hline (GtkStyle *style,
472 GtkStateType state_type,
476 void gtk_draw_vline (GtkStyle *style,
478 GtkStateType state_type,
482 void gtk_draw_shadow (GtkStyle *style,
484 GtkStateType state_type,
485 GtkShadowType shadow_type,
490 void gtk_draw_polygon (GtkStyle *style,
492 GtkStateType state_type,
493 GtkShadowType shadow_type,
497 void gtk_draw_arrow (GtkStyle *style,
499 GtkStateType state_type,
500 GtkShadowType shadow_type,
501 GtkArrowType arrow_type,
507 void gtk_draw_diamond (GtkStyle *style,
509 GtkStateType state_type,
510 GtkShadowType shadow_type,
515 void gtk_draw_box (GtkStyle *style,
517 GtkStateType state_type,
518 GtkShadowType shadow_type,
523 void gtk_draw_flat_box (GtkStyle *style,
525 GtkStateType state_type,
526 GtkShadowType shadow_type,
531 void gtk_draw_check (GtkStyle *style,
533 GtkStateType state_type,
534 GtkShadowType shadow_type,
539 void gtk_draw_option (GtkStyle *style,
541 GtkStateType state_type,
542 GtkShadowType shadow_type,
547 void gtk_draw_tab (GtkStyle *style,
549 GtkStateType state_type,
550 GtkShadowType shadow_type,
555 void gtk_draw_shadow_gap (GtkStyle *style,
557 GtkStateType state_type,
558 GtkShadowType shadow_type,
563 GtkPositionType gap_side,
566 void gtk_draw_box_gap (GtkStyle *style,
568 GtkStateType state_type,
569 GtkShadowType shadow_type,
574 GtkPositionType gap_side,
577 void gtk_draw_extension (GtkStyle *style,
579 GtkStateType state_type,
580 GtkShadowType shadow_type,
585 GtkPositionType gap_side);
586 void gtk_draw_focus (GtkStyle *style,
592 void gtk_draw_slider (GtkStyle *style,
594 GtkStateType state_type,
595 GtkShadowType shadow_type,
600 GtkOrientation orientation);
601 void gtk_draw_handle (GtkStyle *style,
603 GtkStateType state_type,
604 GtkShadowType shadow_type,
609 GtkOrientation orientation);
610 void gtk_draw_expander (GtkStyle *style,
612 GtkStateType state_type,
615 GtkExpanderStyle expander_style);
616 void gtk_draw_layout (GtkStyle *style,
618 GtkStateType state_type,
622 PangoLayout *layout);
623 void gtk_draw_resize_grip (GtkStyle *style,
625 GtkStateType state_type,
631 #endif /* GTK_DISABLE_DEPRECATED */
633 void gtk_paint_hline (GtkStyle *style,
635 GtkStateType state_type,
642 void gtk_paint_vline (GtkStyle *style,
644 GtkStateType state_type,
651 void gtk_paint_shadow (GtkStyle *style,
653 GtkStateType state_type,
654 GtkShadowType shadow_type,
662 void gtk_paint_polygon (GtkStyle *style,
664 GtkStateType state_type,
665 GtkShadowType shadow_type,
672 void gtk_paint_arrow (GtkStyle *style,
674 GtkStateType state_type,
675 GtkShadowType shadow_type,
679 GtkArrowType arrow_type,
685 void gtk_paint_diamond (GtkStyle *style,
687 GtkStateType state_type,
688 GtkShadowType shadow_type,
696 void gtk_paint_box (GtkStyle *style,
698 GtkStateType state_type,
699 GtkShadowType shadow_type,
707 void gtk_paint_flat_box (GtkStyle *style,
709 GtkStateType state_type,
710 GtkShadowType shadow_type,
718 void gtk_paint_check (GtkStyle *style,
720 GtkStateType state_type,
721 GtkShadowType shadow_type,
729 void gtk_paint_option (GtkStyle *style,
731 GtkStateType state_type,
732 GtkShadowType shadow_type,
740 void gtk_paint_tab (GtkStyle *style,
742 GtkStateType state_type,
743 GtkShadowType shadow_type,
751 void gtk_paint_shadow_gap (GtkStyle *style,
753 GtkStateType state_type,
754 GtkShadowType shadow_type,
762 GtkPositionType gap_side,
765 void gtk_paint_box_gap (GtkStyle *style,
767 GtkStateType state_type,
768 GtkShadowType shadow_type,
776 GtkPositionType gap_side,
779 void gtk_paint_extension (GtkStyle *style,
781 GtkStateType state_type,
782 GtkShadowType shadow_type,
790 GtkPositionType gap_side);
791 void gtk_paint_focus (GtkStyle *style,
793 GtkStateType state_type,
801 void gtk_paint_slider (GtkStyle *style,
803 GtkStateType state_type,
804 GtkShadowType shadow_type,
812 GtkOrientation orientation);
813 void gtk_paint_handle (GtkStyle *style,
815 GtkStateType state_type,
816 GtkShadowType shadow_type,
824 GtkOrientation orientation);
825 void gtk_paint_expander (GtkStyle *style,
827 GtkStateType state_type,
833 GtkExpanderStyle expander_style);
834 void gtk_paint_layout (GtkStyle *style,
836 GtkStateType state_type,
843 PangoLayout *layout);
845 void gtk_paint_resize_grip (GtkStyle *style,
847 GtkStateType state_type,
858 GType gtk_border_get_type (void);
859 GtkBorder *gtk_border_copy (const GtkBorder *border);
860 void gtk_border_free ( GtkBorder *border);
862 /* --- private API --- */
863 const GValue* _gtk_style_peek_property_value (GtkStyle *style,
866 GtkRcPropertyParser parser);
870 #ifndef GTK_DISABLE_DEPRECATED
871 #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)
872 void gtk_draw_string (GtkStyle *style,
874 GtkStateType state_type,
877 const gchar *string);
878 void gtk_paint_string (GtkStyle *style,
880 GtkStateType state_type,
886 const gchar *string);
887 #endif /* GTK_DISABLE_DEPRECATED */
889 GdkGC *_gtk_get_insertion_cursor_gc (GtkWidget *widget,
890 gboolean is_primary);
891 void _gtk_draw_insertion_cursor (GtkWidget *widget,
892 GdkDrawable *drawable,
894 GdkRectangle *location,
895 GtkTextDirection direction,
896 gboolean draw_arrow);
900 #endif /* __cplusplus */
903 #endif /* __GTK_STYLE_H__ */