]> Pileus Git - ~andy/gtk/blob - gtk/gtkstylecontext.h
Change semantics of the methods to check whether an animation is running.
[~andy/gtk] / gtk / gtkstylecontext.h
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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __GTK_STYLE_CONTEXT_H__
21 #define __GTK_STYLE_CONTEXT_H__
22
23 #include <glib-object.h>
24 #include <gtk/gtkstyleprovider.h>
25 #include <gtk/gtkwidgetpath.h>
26
27 G_BEGIN_DECLS
28
29 #define GTK_TYPE_STYLE_CONTEXT         (gtk_style_context_get_type ())
30 #define GTK_STYLE_CONTEXT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_STYLE_CONTEXT, GtkStyleContext))
31 #define GTK_STYLE_CONTEXT_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST    ((c), GTK_TYPE_STYLE_CONTEXT, GtkStyleContextClass))
32 #define GTK_IS_STYLE_CONTEXT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_STYLE_CONTEXT))
33 #define GTK_IS_STYLE_CONTEXT_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE    ((c), GTK_TYPE_STYLE_CONTEXT))
34 #define GTK_STYLE_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS  ((o), GTK_TYPE_STYLE_CONTEXT, GtkStyleContextClass))
35
36 typedef struct _GtkStyleContext GtkStyleContext;
37 typedef struct _GtkStyleContextClass GtkStyleContextClass;
38
39 struct _GtkStyleContext
40 {
41   GObject parent_object;
42   gpointer priv;
43 };
44
45 struct _GtkStyleContextClass
46 {
47   GObjectClass parent_class;
48
49   void (* changed) (GtkStyleContext *context);
50 };
51
52 GType gtk_style_context_get_type (void) G_GNUC_CONST;
53
54 void gtk_style_context_add_provider_for_screen    (GdkScreen        *screen,
55                                                    GtkStyleProvider *provider,
56                                                    guint             priority);
57 void gtk_style_context_remove_provider_for_screen (GdkScreen        *screen,
58                                                    GtkStyleProvider *provider);
59
60 void gtk_style_context_add_provider    (GtkStyleContext  *context,
61                                         GtkStyleProvider *provider,
62                                         guint             priority);
63
64 void gtk_style_context_remove_provider (GtkStyleContext  *context,
65                                         GtkStyleProvider *provider);
66
67 void gtk_style_context_save    (GtkStyleContext *context);
68 void gtk_style_context_restore (GtkStyleContext *context);
69
70 void gtk_style_context_get_property (GtkStyleContext *context,
71                                      const gchar     *property,
72                                      GtkStateFlags    state,
73                                      GValue          *value);
74 void gtk_style_context_get_valist   (GtkStyleContext *context,
75                                      GtkStateFlags    state,
76                                      va_list          args);
77 void gtk_style_context_get          (GtkStyleContext *context,
78                                      GtkStateFlags    state,
79                                      ...) G_GNUC_NULL_TERMINATED;
80
81 void          gtk_style_context_set_state    (GtkStyleContext *context,
82                                               GtkStateFlags    flags);
83 GtkStateFlags gtk_style_context_get_state    (GtkStyleContext *context);
84
85 gboolean      gtk_style_context_state_is_running (GtkStyleContext *context,
86                                                   GtkStateType     state,
87                                                   gdouble         *progress);
88
89 void          gtk_style_context_set_path     (GtkStyleContext *context,
90                                               GtkWidgetPath   *path);
91 G_CONST_RETURN GtkWidgetPath * gtk_style_context_get_path (GtkStyleContext *context);
92
93 GList *  gtk_style_context_list_classes (GtkStyleContext *context);
94
95 void     gtk_style_context_set_class   (GtkStyleContext *context,
96                                         const gchar     *class_name);
97 void     gtk_style_context_unset_class (GtkStyleContext *context,
98                                         const gchar     *class_name);
99 gboolean gtk_style_context_has_class   (GtkStyleContext *context,
100                                         const gchar     *class_name);
101
102 GList *  gtk_style_context_list_regions (GtkStyleContext *context);
103
104 void     gtk_style_context_set_region   (GtkStyleContext    *context,
105                                          const gchar        *region_name,
106                                          GtkRegionFlags      flags);
107 void     gtk_style_context_unset_region (GtkStyleContext    *context,
108                                          const gchar        *region_name);
109 gboolean gtk_style_context_has_region   (GtkStyleContext    *context,
110                                          const gchar        *region_name,
111                                          GtkRegionFlags     *flags_return);
112
113 void gtk_style_context_get_style_property (GtkStyleContext *context,
114                                            const gchar     *property_name,
115                                            GValue          *value);
116 void gtk_style_context_get_style_valist   (GtkStyleContext *context,
117                                            va_list          args);
118 void gtk_style_context_get_style          (GtkStyleContext *context,
119                                            ...);
120
121 GtkIconSet * gtk_style_context_lookup_icon_set (GtkStyleContext *context,
122                                                 const gchar     *stock_id);
123
124 void        gtk_style_context_set_screen (GtkStyleContext *context,
125                                           GdkScreen       *screen);
126 GdkScreen * gtk_style_context_get_screen (GtkStyleContext *context);
127
128 void             gtk_style_context_set_direction (GtkStyleContext  *context,
129                                                   GtkTextDirection  direction);
130 GtkTextDirection gtk_style_context_get_direction (GtkStyleContext  *context);
131
132 void             gtk_style_context_set_junction_sides (GtkStyleContext  *context,
133                                                        GtkJunctionSides  sides);
134 GtkJunctionSides gtk_style_context_get_junction_sides (GtkStyleContext  *context);
135
136 gboolean gtk_style_context_lookup_color (GtkStyleContext *context,
137                                          const gchar     *color_name,
138                                          GdkColor        *color);
139
140 void  gtk_style_context_notify_state_change (GtkStyleContext *context,
141                                              GdkWindow       *window,
142                                              gpointer         region_id,
143                                              GtkStateType     state,
144                                              gboolean         state_value);
145 void gtk_style_context_push_animatable_region (GtkStyleContext *context,
146                                                gpointer         region_id);
147 void gtk_style_context_pop_animatable_region  (GtkStyleContext *context);
148
149 void gtk_style_context_invalidate (GtkStyleContext *context);
150 void gtk_style_context_reset_widgets (GdkScreen *screen);
151
152 /* Semi-private API */
153 const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
154                                                        GType            widget_type,
155                                                        GParamSpec      *pspec);
156 void           _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context);
157 void           _gtk_style_context_coalesce_animation_areas   (GtkStyleContext *context,
158                                                               gint             rel_x,
159                                                               gint             rel_y);
160
161 /* Paint methods */
162 void gtk_render_check (GtkStyleContext *context,
163                        cairo_t         *cr,
164                        gdouble          x,
165                        gdouble          y,
166                        gdouble          width,
167                        gdouble          height);
168 void gtk_render_option (GtkStyleContext *context,
169                         cairo_t         *cr,
170                         gdouble          x,
171                         gdouble          y,
172                         gdouble          width,
173                         gdouble          height);
174 void gtk_render_arrow  (GtkStyleContext *context,
175                         cairo_t         *cr,
176                         gdouble          angle,
177                         gdouble          x,
178                         gdouble          y,
179                         gdouble          size);
180 void gtk_render_background (GtkStyleContext *context,
181                             cairo_t         *cr,
182                             gdouble          x,
183                             gdouble          y,
184                             gdouble          width,
185                             gdouble          height);
186 void gtk_render_frame  (GtkStyleContext *context,
187                         cairo_t         *cr,
188                         gdouble          x,
189                         gdouble          y,
190                         gdouble          width,
191                         gdouble          height);
192 void gtk_render_expander (GtkStyleContext *context,
193                           cairo_t         *cr,
194                           gdouble          x,
195                           gdouble          y,
196                           gdouble          width,
197                           gdouble          height);
198 void gtk_render_focus    (GtkStyleContext *context,
199                           cairo_t         *cr,
200                           gdouble          x,
201                           gdouble          y,
202                           gdouble          width,
203                           gdouble          height);
204 void gtk_render_layout   (GtkStyleContext *context,
205                           cairo_t         *cr,
206                           gdouble          x,
207                           gdouble          y,
208                           PangoLayout     *layout);
209 void gtk_render_line     (GtkStyleContext *context,
210                           cairo_t         *cr,
211                           gdouble          x0,
212                           gdouble          y0,
213                           gdouble          x1,
214                           gdouble          y1);
215 void gtk_render_slider   (GtkStyleContext *context,
216                           cairo_t         *cr,
217                           gdouble          x,
218                           gdouble          y,
219                           gdouble          width,
220                           gdouble          height,
221                           GtkOrientation   orientation);
222 void gtk_render_frame_gap (GtkStyleContext *context,
223                            cairo_t         *cr,
224                            gdouble          x,
225                            gdouble          y,
226                            gdouble          width,
227                            gdouble          height,
228                            GtkPositionType  gap_side,
229                            gdouble          xy0_gap,
230                            gdouble          xy1_gap);
231 void gtk_render_extension (GtkStyleContext *context,
232                            cairo_t         *cr,
233                            gdouble          x,
234                            gdouble          y,
235                            gdouble          width,
236                            gdouble          height,
237                            GtkPositionType  gap_side);
238 void gtk_render_handle    (GtkStyleContext *context,
239                            cairo_t         *cr,
240                            gdouble          x,
241                            gdouble          y,
242                            gdouble          width,
243                            gdouble          height);
244 void gtk_render_progress  (GtkStyleContext *context,
245                            cairo_t         *cr,
246                            gdouble          x,
247                            gdouble          y,
248                            gdouble          width,
249                            gdouble          height);
250
251 G_END_DECLS
252
253 #endif /* __GTK_STYLE_CONTEXT_H__ */