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, see <http://www.gnu.org/licenses/>.
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
26 #error "Only <gtk/gtk.h> can be included directly."
29 #ifndef __GTK_STYLE_H__
30 #define __GTK_STYLE_H__
34 #include <gtk/gtkenums.h>
35 #include <gtk/gtkwidgetpath.h>
40 #define GTK_TYPE_STYLE (gtk_style_get_type ())
41 #define GTK_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_STYLE, GtkStyle))
42 #define GTK_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_STYLE, GtkStyleClass))
43 #define GTK_IS_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_STYLE))
44 #define GTK_IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STYLE))
45 #define GTK_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STYLE, GtkStyleClass))
47 /* Some forward declarations needed to rationalize the header
50 typedef struct _GtkStyleClass GtkStyleClass;
51 typedef struct _GtkThemeEngine GtkThemeEngine;
52 typedef struct _GtkRcProperty GtkRcProperty;
56 * @style: a #GtkStyle.
58 * Returns whether the style is attached to a window.
60 #define GTK_STYLE_ATTACHED(style) (GTK_STYLE (style)->attach_count > 0)
64 GObject parent_instance;
75 GdkColor text_aa[5]; /* Halfway between text/base */
79 PangoFontDescription *font_desc;
84 cairo_pattern_t *background[5];
91 PangoFontDescription *private_font_desc; /* Font description for style->private_font or %NULL */
93 /* the RcStyle from which this style was created */
96 GSList *styles; /* of type GtkStyle* */
97 GArray *property_cache;
98 GSList *icon_factories; /* of type GtkIconFactory* */
101 struct _GtkStyleClass
103 GObjectClass parent_class;
105 /* Initialize for a particular visual. style->visual
106 * will have been set at this point. Will typically chain
109 void (*realize) (GtkStyle *style);
111 /* Clean up for a particular visual. Will typically chain
114 void (*unrealize) (GtkStyle *style);
116 /* Make style an exact duplicate of src.
118 void (*copy) (GtkStyle *style,
121 /* Create an empty style of the same type as this style.
122 * The default implementation, which does
123 * g_object_new (G_OBJECT_TYPE (style), NULL);
124 * should work in most cases.
126 GtkStyle *(*clone) (GtkStyle *style);
128 /* Initialize the GtkStyle with the values in the GtkRcStyle.
129 * should chain to the parent implementation.
131 void (*init_from_rc) (GtkStyle *style,
132 GtkRcStyle *rc_style);
134 void (*set_background) (GtkStyle *style,
136 GtkStateType state_type);
139 GdkPixbuf * (* render_icon) (GtkStyle *style,
140 const GtkIconSource *source,
141 GtkTextDirection direction,
145 const gchar *detail);
150 void (*draw_hline) (GtkStyle *style,
152 GtkStateType state_type,
158 void (*draw_vline) (GtkStyle *style,
160 GtkStateType state_type,
166 void (*draw_shadow) (GtkStyle *style,
168 GtkStateType state_type,
169 GtkShadowType shadow_type,
176 void (*draw_arrow) (GtkStyle *style,
178 GtkStateType state_type,
179 GtkShadowType shadow_type,
182 GtkArrowType arrow_type,
188 void (*draw_diamond) (GtkStyle *style,
190 GtkStateType state_type,
191 GtkShadowType shadow_type,
198 void (*draw_box) (GtkStyle *style,
200 GtkStateType state_type,
201 GtkShadowType shadow_type,
208 void (*draw_flat_box) (GtkStyle *style,
210 GtkStateType state_type,
211 GtkShadowType shadow_type,
218 void (*draw_check) (GtkStyle *style,
220 GtkStateType state_type,
221 GtkShadowType shadow_type,
228 void (*draw_option) (GtkStyle *style,
230 GtkStateType state_type,
231 GtkShadowType shadow_type,
238 void (*draw_tab) (GtkStyle *style,
240 GtkStateType state_type,
241 GtkShadowType shadow_type,
248 void (*draw_shadow_gap) (GtkStyle *style,
250 GtkStateType state_type,
251 GtkShadowType shadow_type,
258 GtkPositionType gap_side,
261 void (*draw_box_gap) (GtkStyle *style,
263 GtkStateType state_type,
264 GtkShadowType shadow_type,
271 GtkPositionType gap_side,
274 void (*draw_extension) (GtkStyle *style,
276 GtkStateType state_type,
277 GtkShadowType shadow_type,
284 GtkPositionType gap_side);
285 void (*draw_focus) (GtkStyle *style,
287 GtkStateType state_type,
294 void (*draw_slider) (GtkStyle *style,
296 GtkStateType state_type,
297 GtkShadowType shadow_type,
304 GtkOrientation orientation);
305 void (*draw_handle) (GtkStyle *style,
307 GtkStateType state_type,
308 GtkShadowType shadow_type,
315 GtkOrientation orientation);
317 void (*draw_expander) (GtkStyle *style,
319 GtkStateType state_type,
324 GtkExpanderStyle expander_style);
325 void (*draw_layout) (GtkStyle *style,
327 GtkStateType state_type,
333 PangoLayout *layout);
334 void (*draw_resize_grip) (GtkStyle *style,
336 GtkStateType state_type,
344 void (*draw_spinner) (GtkStyle *style,
346 GtkStateType state_type,
355 /* Padding for future expansion */
356 void (*_gtk_reserved1) (void);
357 void (*_gtk_reserved2) (void);
358 void (*_gtk_reserved3) (void);
359 void (*_gtk_reserved4) (void);
360 void (*_gtk_reserved5) (void);
361 void (*_gtk_reserved6) (void);
362 void (*_gtk_reserved7) (void);
363 void (*_gtk_reserved8) (void);
364 void (*_gtk_reserved9) (void);
365 void (*_gtk_reserved10) (void);
366 void (*_gtk_reserved11) (void);
369 GType gtk_style_get_type (void) G_GNUC_CONST;
370 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
371 GtkStyle* gtk_style_new (void);
372 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
373 GtkStyle* gtk_style_copy (GtkStyle *style);
374 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
375 GtkStyle* gtk_style_attach (GtkStyle *style,
377 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
378 void gtk_style_detach (GtkStyle *style);
379 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
380 void gtk_style_set_background (GtkStyle *style,
382 GtkStateType state_type);
383 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
384 void gtk_style_apply_default_background (GtkStyle *style,
387 GtkStateType state_type,
393 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
394 GtkIconSet* gtk_style_lookup_icon_set (GtkStyle *style,
395 const gchar *stock_id);
396 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
397 gboolean gtk_style_lookup_color (GtkStyle *style,
398 const gchar *color_name,
401 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
402 GdkPixbuf* gtk_style_render_icon (GtkStyle *style,
403 const GtkIconSource *source,
404 GtkTextDirection direction,
408 const gchar *detail);
410 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
411 void gtk_paint_hline (GtkStyle *style,
413 GtkStateType state_type,
419 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
420 void gtk_paint_vline (GtkStyle *style,
422 GtkStateType state_type,
428 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
429 void gtk_paint_shadow (GtkStyle *style,
431 GtkStateType state_type,
432 GtkShadowType shadow_type,
439 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
440 void gtk_paint_arrow (GtkStyle *style,
442 GtkStateType state_type,
443 GtkShadowType shadow_type,
446 GtkArrowType arrow_type,
452 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
453 void gtk_paint_diamond (GtkStyle *style,
455 GtkStateType state_type,
456 GtkShadowType shadow_type,
463 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
464 void gtk_paint_box (GtkStyle *style,
466 GtkStateType state_type,
467 GtkShadowType shadow_type,
474 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
475 void gtk_paint_flat_box (GtkStyle *style,
477 GtkStateType state_type,
478 GtkShadowType shadow_type,
485 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
486 void gtk_paint_check (GtkStyle *style,
488 GtkStateType state_type,
489 GtkShadowType shadow_type,
496 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
497 void gtk_paint_option (GtkStyle *style,
499 GtkStateType state_type,
500 GtkShadowType shadow_type,
507 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
508 void gtk_paint_tab (GtkStyle *style,
510 GtkStateType state_type,
511 GtkShadowType shadow_type,
518 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
519 void gtk_paint_shadow_gap (GtkStyle *style,
521 GtkStateType state_type,
522 GtkShadowType shadow_type,
529 GtkPositionType gap_side,
532 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
533 void gtk_paint_box_gap (GtkStyle *style,
535 GtkStateType state_type,
536 GtkShadowType shadow_type,
543 GtkPositionType gap_side,
546 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
547 void gtk_paint_extension (GtkStyle *style,
549 GtkStateType state_type,
550 GtkShadowType shadow_type,
557 GtkPositionType gap_side);
558 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
559 void gtk_paint_focus (GtkStyle *style,
561 GtkStateType state_type,
568 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
569 void gtk_paint_slider (GtkStyle *style,
571 GtkStateType state_type,
572 GtkShadowType shadow_type,
579 GtkOrientation orientation);
580 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
581 void gtk_paint_handle (GtkStyle *style,
583 GtkStateType state_type,
584 GtkShadowType shadow_type,
591 GtkOrientation orientation);
592 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
593 void gtk_paint_expander (GtkStyle *style,
595 GtkStateType state_type,
600 GtkExpanderStyle expander_style);
601 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
602 void gtk_paint_layout (GtkStyle *style,
604 GtkStateType state_type,
610 PangoLayout *layout);
611 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
612 void gtk_paint_resize_grip (GtkStyle *style,
614 GtkStateType state_type,
622 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
623 void gtk_paint_spinner (GtkStyle *style,
625 GtkStateType state_type,
634 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
635 void gtk_style_get_style_property (GtkStyle *style,
637 const gchar *property_name,
639 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
640 void gtk_style_get_valist (GtkStyle *style,
642 const gchar *first_property_name,
644 GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
645 void gtk_style_get (GtkStyle *style,
647 const gchar *first_property_name,
648 ...) G_GNUC_NULL_TERMINATED;
651 /* --- private API --- */
652 GtkStyle* _gtk_style_new_for_path (GdkScreen *screen,
653 GtkWidgetPath *path);
654 void _gtk_style_shade (const GdkColor *a,
658 gboolean gtk_style_has_context (GtkStyle *style);
660 void gtk_widget_style_attach (GtkWidget *widget);
661 gboolean gtk_widget_has_rc_style (GtkWidget *widget);
662 void gtk_widget_set_style (GtkWidget *widget,
664 void gtk_widget_ensure_style (GtkWidget *widget);
665 GtkStyle * gtk_widget_get_style (GtkWidget *widget);
666 void gtk_widget_modify_style (GtkWidget *widget,
668 GtkRcStyle *gtk_widget_get_modifier_style (GtkWidget *widget);
669 void gtk_widget_modify_fg (GtkWidget *widget,
671 const GdkColor *color);
672 void gtk_widget_modify_bg (GtkWidget *widget,
674 const GdkColor *color);
675 void gtk_widget_modify_text (GtkWidget *widget,
677 const GdkColor *color);
678 void gtk_widget_modify_base (GtkWidget *widget,
680 const GdkColor *color);
681 void gtk_widget_modify_cursor (GtkWidget *widget,
682 const GdkColor *primary,
683 const GdkColor *secondary);
684 void gtk_widget_modify_font (GtkWidget *widget,
685 PangoFontDescription *font_desc);
686 void gtk_widget_reset_rc_styles (GtkWidget *widget);
687 GtkStyle* gtk_widget_get_default_style (void);
688 void gtk_widget_path (GtkWidget *widget,
691 gchar **path_reversed);
692 void gtk_widget_class_path (GtkWidget *widget,
695 gchar **path_reversed);
696 GdkPixbuf *gtk_widget_render_icon (GtkWidget *widget,
697 const gchar *stock_id,
699 const gchar *detail);
703 #endif /* __GTK_STYLE_H__ */