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 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
31 #ifndef __GTK_STYLE_H__
32 #define __GTK_STYLE_H__
36 #include <gtk/gtkenums.h>
37 #include <gtk/gtkwidgetpath.h>
42 #define GTK_TYPE_STYLE (gtk_style_get_type ())
43 #define GTK_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_STYLE, GtkStyle))
44 #define GTK_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_STYLE, GtkStyleClass))
45 #define GTK_IS_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_STYLE))
46 #define GTK_IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STYLE))
47 #define GTK_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STYLE, GtkStyleClass))
49 /* Some forward declarations needed to rationalize the header
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 struct _GtkSettings GtkSettings;
60 typedef gboolean (*GtkRcPropertyParser) (const GParamSpec *pspec,
61 const GString *rc_string,
62 GValue *property_value);
64 /* We make this forward declaration here, since we pass
65 * GtkWidget's to the draw functions.
67 typedef struct _GtkWidget GtkWidget;
71 * @style: a #GtkStyle.
73 * Returns whether the style is attached to a window.
75 #define GTK_STYLE_ATTACHED(style) (GTK_STYLE (style)->attach_count > 0)
79 GObject parent_instance;
90 GdkColor text_aa[5]; /* Halfway between text/base */
94 PangoFontDescription *font_desc;
99 cairo_pattern_t *background[5];
106 PangoFontDescription *private_font_desc; /* Font description for style->private_font or %NULL */
108 /* the RcStyle from which this style was created */
109 GtkRcStyle *rc_style;
111 GSList *styles; /* of type GtkStyle* */
112 GArray *property_cache;
113 GSList *icon_factories; /* of type GtkIconFactory* */
116 struct _GtkStyleClass
118 GObjectClass parent_class;
120 /* Initialize for a particular visual. style->visual
121 * will have been set at this point. Will typically chain
124 void (*realize) (GtkStyle *style);
126 /* Clean up for a particular visual. Will typically chain
129 void (*unrealize) (GtkStyle *style);
131 /* Make style an exact duplicate of src.
133 void (*copy) (GtkStyle *style,
136 /* Create an empty style of the same type as this style.
137 * The default implementation, which does
138 * g_object_new (G_OBJECT_TYPE (style), NULL);
139 * should work in most cases.
141 GtkStyle *(*clone) (GtkStyle *style);
143 /* Initialize the GtkStyle with the values in the GtkRcStyle.
144 * should chain to the parent implementation.
146 void (*init_from_rc) (GtkStyle *style,
147 GtkRcStyle *rc_style);
149 void (*set_background) (GtkStyle *style,
151 GtkStateType state_type);
154 GdkPixbuf * (* render_icon) (GtkStyle *style,
155 const GtkIconSource *source,
156 GtkTextDirection direction,
160 const gchar *detail);
165 void (*draw_hline) (GtkStyle *style,
167 GtkStateType state_type,
173 void (*draw_vline) (GtkStyle *style,
175 GtkStateType state_type,
181 void (*draw_shadow) (GtkStyle *style,
183 GtkStateType state_type,
184 GtkShadowType shadow_type,
191 void (*draw_arrow) (GtkStyle *style,
193 GtkStateType state_type,
194 GtkShadowType shadow_type,
197 GtkArrowType arrow_type,
203 void (*draw_diamond) (GtkStyle *style,
205 GtkStateType state_type,
206 GtkShadowType shadow_type,
213 void (*draw_box) (GtkStyle *style,
215 GtkStateType state_type,
216 GtkShadowType shadow_type,
223 void (*draw_flat_box) (GtkStyle *style,
225 GtkStateType state_type,
226 GtkShadowType shadow_type,
233 void (*draw_check) (GtkStyle *style,
235 GtkStateType state_type,
236 GtkShadowType shadow_type,
243 void (*draw_option) (GtkStyle *style,
245 GtkStateType state_type,
246 GtkShadowType shadow_type,
253 void (*draw_tab) (GtkStyle *style,
255 GtkStateType state_type,
256 GtkShadowType shadow_type,
263 void (*draw_shadow_gap) (GtkStyle *style,
265 GtkStateType state_type,
266 GtkShadowType shadow_type,
273 GtkPositionType gap_side,
276 void (*draw_box_gap) (GtkStyle *style,
278 GtkStateType state_type,
279 GtkShadowType shadow_type,
286 GtkPositionType gap_side,
289 void (*draw_extension) (GtkStyle *style,
291 GtkStateType state_type,
292 GtkShadowType shadow_type,
299 GtkPositionType gap_side);
300 void (*draw_focus) (GtkStyle *style,
302 GtkStateType state_type,
309 void (*draw_slider) (GtkStyle *style,
311 GtkStateType state_type,
312 GtkShadowType shadow_type,
319 GtkOrientation orientation);
320 void (*draw_handle) (GtkStyle *style,
322 GtkStateType state_type,
323 GtkShadowType shadow_type,
330 GtkOrientation orientation);
332 void (*draw_expander) (GtkStyle *style,
334 GtkStateType state_type,
339 GtkExpanderStyle expander_style);
340 void (*draw_layout) (GtkStyle *style,
342 GtkStateType state_type,
348 PangoLayout *layout);
349 void (*draw_resize_grip) (GtkStyle *style,
351 GtkStateType state_type,
359 void (*draw_spinner) (GtkStyle *style,
361 GtkStateType state_type,
370 /* Padding for future expansion */
371 void (*_gtk_reserved1) (void);
372 void (*_gtk_reserved2) (void);
373 void (*_gtk_reserved3) (void);
374 void (*_gtk_reserved4) (void);
375 void (*_gtk_reserved5) (void);
376 void (*_gtk_reserved6) (void);
377 void (*_gtk_reserved7) (void);
378 void (*_gtk_reserved8) (void);
379 void (*_gtk_reserved9) (void);
380 void (*_gtk_reserved10) (void);
381 void (*_gtk_reserved11) (void);
384 #if !defined(GTK_DISABLE_DEPRECATED) || defined(GTK_COMPILATION)
386 GType gtk_style_get_type (void) G_GNUC_CONST;
387 GtkStyle* gtk_style_new (void);
388 GtkStyle* gtk_style_copy (GtkStyle *style);
389 GtkStyle* gtk_style_attach (GtkStyle *style,
390 GdkWindow *window) G_GNUC_WARN_UNUSED_RESULT;
391 void gtk_style_detach (GtkStyle *style);
392 void gtk_style_set_background (GtkStyle *style,
394 GtkStateType state_type);
395 void gtk_style_apply_default_background (GtkStyle *style,
398 GtkStateType state_type,
404 GtkIconSet* gtk_style_lookup_icon_set (GtkStyle *style,
405 const gchar *stock_id);
406 gboolean gtk_style_lookup_color (GtkStyle *style,
407 const gchar *color_name,
410 GdkPixbuf* gtk_style_render_icon (GtkStyle *style,
411 const GtkIconSource *source,
412 GtkTextDirection direction,
416 const gchar *detail);
418 void gtk_paint_hline (GtkStyle *style,
420 GtkStateType state_type,
426 void gtk_paint_vline (GtkStyle *style,
428 GtkStateType state_type,
434 void gtk_paint_shadow (GtkStyle *style,
436 GtkStateType state_type,
437 GtkShadowType shadow_type,
444 void gtk_paint_arrow (GtkStyle *style,
446 GtkStateType state_type,
447 GtkShadowType shadow_type,
450 GtkArrowType arrow_type,
456 void gtk_paint_diamond (GtkStyle *style,
458 GtkStateType state_type,
459 GtkShadowType shadow_type,
466 void gtk_paint_box (GtkStyle *style,
468 GtkStateType state_type,
469 GtkShadowType shadow_type,
476 void gtk_paint_flat_box (GtkStyle *style,
478 GtkStateType state_type,
479 GtkShadowType shadow_type,
486 void gtk_paint_check (GtkStyle *style,
488 GtkStateType state_type,
489 GtkShadowType shadow_type,
496 void gtk_paint_option (GtkStyle *style,
498 GtkStateType state_type,
499 GtkShadowType shadow_type,
506 void gtk_paint_tab (GtkStyle *style,
508 GtkStateType state_type,
509 GtkShadowType shadow_type,
516 void gtk_paint_shadow_gap (GtkStyle *style,
518 GtkStateType state_type,
519 GtkShadowType shadow_type,
526 GtkPositionType gap_side,
529 void gtk_paint_box_gap (GtkStyle *style,
531 GtkStateType state_type,
532 GtkShadowType shadow_type,
539 GtkPositionType gap_side,
542 void gtk_paint_extension (GtkStyle *style,
544 GtkStateType state_type,
545 GtkShadowType shadow_type,
552 GtkPositionType gap_side);
553 void gtk_paint_focus (GtkStyle *style,
555 GtkStateType state_type,
562 void gtk_paint_slider (GtkStyle *style,
564 GtkStateType state_type,
565 GtkShadowType shadow_type,
572 GtkOrientation orientation);
573 void gtk_paint_handle (GtkStyle *style,
575 GtkStateType state_type,
576 GtkShadowType shadow_type,
583 GtkOrientation orientation);
584 void gtk_paint_expander (GtkStyle *style,
586 GtkStateType state_type,
591 GtkExpanderStyle expander_style);
592 void gtk_paint_layout (GtkStyle *style,
594 GtkStateType state_type,
600 PangoLayout *layout);
601 void gtk_paint_resize_grip (GtkStyle *style,
603 GtkStateType state_type,
611 void gtk_paint_spinner (GtkStyle *style,
613 GtkStateType state_type,
622 void gtk_style_get_style_property (GtkStyle *style,
624 const gchar *property_name,
626 void gtk_style_get_valist (GtkStyle *style,
628 const gchar *first_property_name,
630 void gtk_style_get (GtkStyle *style,
632 const gchar *first_property_name,
633 ...) G_GNUC_NULL_TERMINATED;
637 /* --- private API --- */
638 GtkStyle* _gtk_style_new_for_path (GdkScreen *screen,
639 GtkWidgetPath *path);
640 void _gtk_style_shade (const GdkColor *a,
644 void gtk_draw_insertion_cursor (GtkWidget *widget,
646 const GdkRectangle *location,
648 GtkTextDirection direction,
649 gboolean draw_arrow);
651 gboolean gtk_style_has_context (GtkStyle *style);
657 #endif /* __GTK_STYLE_H__ */