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 _GtkStyleClass GtkStyleClass;
53 typedef struct _GtkThemeEngine GtkThemeEngine;
54 typedef struct _GtkRcProperty GtkRcProperty;
58 * @style: a #GtkStyle.
60 * Returns whether the style is attached to a window.
62 #define GTK_STYLE_ATTACHED(style) (GTK_STYLE (style)->attach_count > 0)
66 GObject parent_instance;
77 GdkColor text_aa[5]; /* Halfway between text/base */
81 PangoFontDescription *font_desc;
86 cairo_pattern_t *background[5];
93 PangoFontDescription *private_font_desc; /* Font description for style->private_font or %NULL */
95 /* the RcStyle from which this style was created */
98 GSList *styles; /* of type GtkStyle* */
99 GArray *property_cache;
100 GSList *icon_factories; /* of type GtkIconFactory* */
103 struct _GtkStyleClass
105 GObjectClass parent_class;
107 /* Initialize for a particular visual. style->visual
108 * will have been set at this point. Will typically chain
111 void (*realize) (GtkStyle *style);
113 /* Clean up for a particular visual. Will typically chain
116 void (*unrealize) (GtkStyle *style);
118 /* Make style an exact duplicate of src.
120 void (*copy) (GtkStyle *style,
123 /* Create an empty style of the same type as this style.
124 * The default implementation, which does
125 * g_object_new (G_OBJECT_TYPE (style), NULL);
126 * should work in most cases.
128 GtkStyle *(*clone) (GtkStyle *style);
130 /* Initialize the GtkStyle with the values in the GtkRcStyle.
131 * should chain to the parent implementation.
133 void (*init_from_rc) (GtkStyle *style,
134 GtkRcStyle *rc_style);
136 void (*set_background) (GtkStyle *style,
138 GtkStateType state_type);
141 GdkPixbuf * (* render_icon) (GtkStyle *style,
142 const GtkIconSource *source,
143 GtkTextDirection direction,
147 const gchar *detail);
152 void (*draw_hline) (GtkStyle *style,
154 GtkStateType state_type,
160 void (*draw_vline) (GtkStyle *style,
162 GtkStateType state_type,
168 void (*draw_shadow) (GtkStyle *style,
170 GtkStateType state_type,
171 GtkShadowType shadow_type,
178 void (*draw_arrow) (GtkStyle *style,
180 GtkStateType state_type,
181 GtkShadowType shadow_type,
184 GtkArrowType arrow_type,
190 void (*draw_diamond) (GtkStyle *style,
192 GtkStateType state_type,
193 GtkShadowType shadow_type,
200 void (*draw_box) (GtkStyle *style,
202 GtkStateType state_type,
203 GtkShadowType shadow_type,
210 void (*draw_flat_box) (GtkStyle *style,
212 GtkStateType state_type,
213 GtkShadowType shadow_type,
220 void (*draw_check) (GtkStyle *style,
222 GtkStateType state_type,
223 GtkShadowType shadow_type,
230 void (*draw_option) (GtkStyle *style,
232 GtkStateType state_type,
233 GtkShadowType shadow_type,
240 void (*draw_tab) (GtkStyle *style,
242 GtkStateType state_type,
243 GtkShadowType shadow_type,
250 void (*draw_shadow_gap) (GtkStyle *style,
252 GtkStateType state_type,
253 GtkShadowType shadow_type,
260 GtkPositionType gap_side,
263 void (*draw_box_gap) (GtkStyle *style,
265 GtkStateType state_type,
266 GtkShadowType shadow_type,
273 GtkPositionType gap_side,
276 void (*draw_extension) (GtkStyle *style,
278 GtkStateType state_type,
279 GtkShadowType shadow_type,
286 GtkPositionType gap_side);
287 void (*draw_focus) (GtkStyle *style,
289 GtkStateType state_type,
296 void (*draw_slider) (GtkStyle *style,
298 GtkStateType state_type,
299 GtkShadowType shadow_type,
306 GtkOrientation orientation);
307 void (*draw_handle) (GtkStyle *style,
309 GtkStateType state_type,
310 GtkShadowType shadow_type,
317 GtkOrientation orientation);
319 void (*draw_expander) (GtkStyle *style,
321 GtkStateType state_type,
326 GtkExpanderStyle expander_style);
327 void (*draw_layout) (GtkStyle *style,
329 GtkStateType state_type,
335 PangoLayout *layout);
336 void (*draw_resize_grip) (GtkStyle *style,
338 GtkStateType state_type,
346 void (*draw_spinner) (GtkStyle *style,
348 GtkStateType state_type,
357 /* Padding for future expansion */
358 void (*_gtk_reserved1) (void);
359 void (*_gtk_reserved2) (void);
360 void (*_gtk_reserved3) (void);
361 void (*_gtk_reserved4) (void);
362 void (*_gtk_reserved5) (void);
363 void (*_gtk_reserved6) (void);
364 void (*_gtk_reserved7) (void);
365 void (*_gtk_reserved8) (void);
366 void (*_gtk_reserved9) (void);
367 void (*_gtk_reserved10) (void);
368 void (*_gtk_reserved11) (void);
371 GType gtk_style_get_type (void) G_GNUC_CONST;
372 GDK_DEPRECATED_FOR(GtkStyleContext)
373 GtkStyle* gtk_style_new (void);
374 GDK_DEPRECATED_FOR(GtkStyleContext)
375 GtkStyle* gtk_style_copy (GtkStyle *style);
376 GDK_DEPRECATED_FOR(GtkStyleContext)
377 GtkStyle* gtk_style_attach (GtkStyle *style,
379 GDK_DEPRECATED_FOR(GtkStyleContext)
380 void gtk_style_detach (GtkStyle *style);
381 GDK_DEPRECATED_FOR(GtkStyleContext)
382 void gtk_style_set_background (GtkStyle *style,
384 GtkStateType state_type);
385 GDK_DEPRECATED_FOR(GtkStyleContext)
386 void gtk_style_apply_default_background (GtkStyle *style,
389 GtkStateType state_type,
395 GDK_DEPRECATED_FOR(GtkStyleContext)
396 GtkIconSet* gtk_style_lookup_icon_set (GtkStyle *style,
397 const gchar *stock_id);
398 GDK_DEPRECATED_FOR(GtkStyleContext)
399 gboolean gtk_style_lookup_color (GtkStyle *style,
400 const gchar *color_name,
403 GDK_DEPRECATED_FOR(GtkStyleContext)
404 GdkPixbuf* gtk_style_render_icon (GtkStyle *style,
405 const GtkIconSource *source,
406 GtkTextDirection direction,
410 const gchar *detail);
412 GDK_DEPRECATED_FOR(GtkStyleContext)
413 void gtk_paint_hline (GtkStyle *style,
415 GtkStateType state_type,
421 GDK_DEPRECATED_FOR(GtkStyleContext)
422 void gtk_paint_vline (GtkStyle *style,
424 GtkStateType state_type,
430 GDK_DEPRECATED_FOR(GtkStyleContext)
431 void gtk_paint_shadow (GtkStyle *style,
433 GtkStateType state_type,
434 GtkShadowType shadow_type,
441 GDK_DEPRECATED_FOR(GtkStyleContext)
442 void gtk_paint_arrow (GtkStyle *style,
444 GtkStateType state_type,
445 GtkShadowType shadow_type,
448 GtkArrowType arrow_type,
454 GDK_DEPRECATED_FOR(GtkStyleContext)
455 void gtk_paint_diamond (GtkStyle *style,
457 GtkStateType state_type,
458 GtkShadowType shadow_type,
465 GDK_DEPRECATED_FOR(GtkStyleContext)
466 void gtk_paint_box (GtkStyle *style,
468 GtkStateType state_type,
469 GtkShadowType shadow_type,
476 GDK_DEPRECATED_FOR(GtkStyleContext)
477 void gtk_paint_flat_box (GtkStyle *style,
479 GtkStateType state_type,
480 GtkShadowType shadow_type,
487 GDK_DEPRECATED_FOR(GtkStyleContext)
488 void gtk_paint_check (GtkStyle *style,
490 GtkStateType state_type,
491 GtkShadowType shadow_type,
498 GDK_DEPRECATED_FOR(GtkStyleContext)
499 void gtk_paint_option (GtkStyle *style,
501 GtkStateType state_type,
502 GtkShadowType shadow_type,
509 GDK_DEPRECATED_FOR(GtkStyleContext)
510 void gtk_paint_tab (GtkStyle *style,
512 GtkStateType state_type,
513 GtkShadowType shadow_type,
520 GDK_DEPRECATED_FOR(GtkStyleContext)
521 void gtk_paint_shadow_gap (GtkStyle *style,
523 GtkStateType state_type,
524 GtkShadowType shadow_type,
531 GtkPositionType gap_side,
534 GDK_DEPRECATED_FOR(GtkStyleContext)
535 void gtk_paint_box_gap (GtkStyle *style,
537 GtkStateType state_type,
538 GtkShadowType shadow_type,
545 GtkPositionType gap_side,
548 GDK_DEPRECATED_FOR(GtkStyleContext)
549 void gtk_paint_extension (GtkStyle *style,
551 GtkStateType state_type,
552 GtkShadowType shadow_type,
559 GtkPositionType gap_side);
560 GDK_DEPRECATED_FOR(GtkStyleContext)
561 void gtk_paint_focus (GtkStyle *style,
563 GtkStateType state_type,
570 GDK_DEPRECATED_FOR(GtkStyleContext)
571 void gtk_paint_slider (GtkStyle *style,
573 GtkStateType state_type,
574 GtkShadowType shadow_type,
581 GtkOrientation orientation);
582 GDK_DEPRECATED_FOR(GtkStyleContext)
583 void gtk_paint_handle (GtkStyle *style,
585 GtkStateType state_type,
586 GtkShadowType shadow_type,
593 GtkOrientation orientation);
594 GDK_DEPRECATED_FOR(GtkStyleContext)
595 void gtk_paint_expander (GtkStyle *style,
597 GtkStateType state_type,
602 GtkExpanderStyle expander_style);
603 GDK_DEPRECATED_FOR(GtkStyleContext)
604 void gtk_paint_layout (GtkStyle *style,
606 GtkStateType state_type,
612 PangoLayout *layout);
613 GDK_DEPRECATED_FOR(GtkStyleContext)
614 void gtk_paint_resize_grip (GtkStyle *style,
616 GtkStateType state_type,
624 GDK_DEPRECATED_FOR(GtkStyleContext)
625 void gtk_paint_spinner (GtkStyle *style,
627 GtkStateType state_type,
636 GDK_DEPRECATED_FOR(GtkStyleContext)
637 void gtk_style_get_style_property (GtkStyle *style,
639 const gchar *property_name,
641 GDK_DEPRECATED_FOR(GtkStyleContext)
642 void gtk_style_get_valist (GtkStyle *style,
644 const gchar *first_property_name,
646 GDK_DEPRECATED_FOR(GtkStyleContext)
647 void gtk_style_get (GtkStyle *style,
649 const gchar *first_property_name,
650 ...) G_GNUC_NULL_TERMINATED;
653 /* --- private API --- */
654 GtkStyle* _gtk_style_new_for_path (GdkScreen *screen,
655 GtkWidgetPath *path);
656 void _gtk_style_shade (const GdkColor *a,
660 gboolean gtk_style_has_context (GtkStyle *style);
666 #endif /* __GTK_STYLE_H__ */