1 | /* GTK - The GIMP Toolkit |
2 | * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org> |
3 | * |
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. |
8 | * |
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. |
13 | * |
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/>. |
16 | */ |
17 | |
18 | #ifndef __GTK_STYLE_CONTEXT_H__ |
19 | #define __GTK_STYLE_CONTEXT_H__ |
20 | |
21 | #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) |
22 | #error "Only <gtk/gtk.h> can be included directly." |
23 | #endif |
24 | |
25 | #include <gtk/css/gtkcss.h> |
26 | |
27 | #include <gtk/gtkborder.h> |
28 | #include <gtk/gtkstyleprovider.h> |
29 | #include <gtk/gtktypes.h> |
30 | |
31 | G_BEGIN_DECLS |
32 | |
33 | #define GTK_TYPE_STYLE_CONTEXT (gtk_style_context_get_type ()) |
34 | #define GTK_STYLE_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_STYLE_CONTEXT, GtkStyleContext)) |
35 | #define GTK_STYLE_CONTEXT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GTK_TYPE_STYLE_CONTEXT, GtkStyleContextClass)) |
36 | #define GTK_IS_STYLE_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_STYLE_CONTEXT)) |
37 | #define GTK_IS_STYLE_CONTEXT_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GTK_TYPE_STYLE_CONTEXT)) |
38 | #define GTK_STYLE_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_STYLE_CONTEXT, GtkStyleContextClass)) |
39 | |
40 | typedef struct _GtkStyleContextClass GtkStyleContextClass; |
41 | |
42 | struct _GtkStyleContext |
43 | { |
44 | GObject parent_object; |
45 | }; |
46 | |
47 | struct _GtkStyleContextClass |
48 | { |
49 | GObjectClass parent_class; |
50 | |
51 | void (* changed) (GtkStyleContext *context); |
52 | |
53 | /* Padding for future expansion */ |
54 | void (*_gtk_reserved1) (void); |
55 | void (*_gtk_reserved2) (void); |
56 | void (*_gtk_reserved3) (void); |
57 | void (*_gtk_reserved4) (void); |
58 | }; |
59 | |
60 | |
61 | GDK_AVAILABLE_IN_ALL |
62 | GType gtk_style_context_get_type (void) G_GNUC_CONST; |
63 | |
64 | GDK_AVAILABLE_IN_ALL |
65 | void gtk_style_context_add_provider_for_display (GdkDisplay *display, |
66 | GtkStyleProvider *provider, |
67 | guint priority); |
68 | GDK_AVAILABLE_IN_ALL |
69 | void gtk_style_context_remove_provider_for_display (GdkDisplay *display, |
70 | GtkStyleProvider *provider); |
71 | |
72 | GDK_AVAILABLE_IN_ALL |
73 | void gtk_style_context_add_provider (GtkStyleContext *context, |
74 | GtkStyleProvider *provider, |
75 | guint priority); |
76 | |
77 | GDK_AVAILABLE_IN_ALL |
78 | void gtk_style_context_remove_provider (GtkStyleContext *context, |
79 | GtkStyleProvider *provider); |
80 | |
81 | GDK_AVAILABLE_IN_ALL |
82 | void gtk_style_context_save (GtkStyleContext *context); |
83 | GDK_AVAILABLE_IN_ALL |
84 | void gtk_style_context_restore (GtkStyleContext *context); |
85 | |
86 | GDK_AVAILABLE_IN_ALL |
87 | void gtk_style_context_set_state (GtkStyleContext *context, |
88 | GtkStateFlags flags); |
89 | GDK_AVAILABLE_IN_ALL |
90 | GtkStateFlags gtk_style_context_get_state (GtkStyleContext *context); |
91 | |
92 | GDK_AVAILABLE_IN_ALL |
93 | void gtk_style_context_set_scale (GtkStyleContext *context, |
94 | int scale); |
95 | GDK_AVAILABLE_IN_ALL |
96 | int gtk_style_context_get_scale (GtkStyleContext *context); |
97 | |
98 | GDK_AVAILABLE_IN_ALL |
99 | void gtk_style_context_add_class (GtkStyleContext *context, |
100 | const char *class_name); |
101 | GDK_AVAILABLE_IN_ALL |
102 | void gtk_style_context_remove_class (GtkStyleContext *context, |
103 | const char *class_name); |
104 | GDK_AVAILABLE_IN_ALL |
105 | gboolean gtk_style_context_has_class (GtkStyleContext *context, |
106 | const char *class_name); |
107 | |
108 | GDK_AVAILABLE_IN_ALL |
109 | void gtk_style_context_set_display (GtkStyleContext *context, |
110 | GdkDisplay *display); |
111 | GDK_AVAILABLE_IN_ALL |
112 | GdkDisplay *gtk_style_context_get_display (GtkStyleContext *context); |
113 | |
114 | GDK_AVAILABLE_IN_ALL |
115 | gboolean gtk_style_context_lookup_color (GtkStyleContext *context, |
116 | const char *color_name, |
117 | GdkRGBA *color); |
118 | |
119 | /* Some helper functions to retrieve most common properties */ |
120 | GDK_AVAILABLE_IN_ALL |
121 | void gtk_style_context_get_color (GtkStyleContext *context, |
122 | GdkRGBA *color); |
123 | GDK_AVAILABLE_IN_ALL |
124 | void gtk_style_context_get_border (GtkStyleContext *context, |
125 | GtkBorder *border); |
126 | GDK_AVAILABLE_IN_ALL |
127 | void gtk_style_context_get_padding (GtkStyleContext *context, |
128 | GtkBorder *padding); |
129 | GDK_AVAILABLE_IN_ALL |
130 | void gtk_style_context_get_margin (GtkStyleContext *context, |
131 | GtkBorder *margin); |
132 | |
133 | typedef enum { |
134 | GTK_STYLE_CONTEXT_PRINT_NONE = 0, |
135 | GTK_STYLE_CONTEXT_PRINT_RECURSE = 1 << 0, |
136 | GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE = 1 << 1, |
137 | GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE = 1 << 2 |
138 | } GtkStyleContextPrintFlags; |
139 | |
140 | GDK_AVAILABLE_IN_ALL |
141 | char * gtk_style_context_to_string (GtkStyleContext *context, |
142 | GtkStyleContextPrintFlags flags); |
143 | |
144 | G_END_DECLS |
145 | |
146 | #endif /* __GTK_STYLE_CONTEXT_H__ */ |
147 | |