]> Pileus Git - ~andy/gtk/blob - gtk/gtkstylecontext.h
07cec5b71ff63ee8d158da0ac78bcf386e9425cf
[~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_is_state_set (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
150 /* Semi-private API */
151 const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
152                                                        GType            widget_type,
153                                                        GParamSpec      *pspec);
154 void           _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context);
155 void           _gtk_style_context_coalesce_animation_areas   (GtkStyleContext *context);
156
157 /* Animation for state changes */
158 void gtk_style_context_state_transition_start  (GtkStyleContext *context,
159                                                 gpointer         identifier,
160                                                 GtkWidget       *widget,
161                                                 GtkStateType     state,
162                                                 gboolean         value,
163                                                 GdkRectangle    *rect);
164 void gtk_style_context_state_transition_update (GtkStyleContext *context,
165                                                 gpointer         identifier,
166                                                 GdkRectangle    *rect,
167                                                 GtkStateType     state);
168 void gtk_style_context_state_transition_stop   (GtkStyleContext *context,
169                                                 gpointer         identifier);
170
171 void gtk_style_context_invalidate (GtkStyleContext *context);
172
173
174 /* Paint methods */
175 void gtk_render_check (GtkStyleContext *context,
176                        cairo_t         *cr,
177                        gdouble          x,
178                        gdouble          y,
179                        gdouble          width,
180                        gdouble          height);
181 void gtk_render_option (GtkStyleContext *context,
182                         cairo_t         *cr,
183                         gdouble          x,
184                         gdouble          y,
185                         gdouble          width,
186                         gdouble          height);
187 void gtk_render_arrow  (GtkStyleContext *context,
188                         cairo_t         *cr,
189                         gdouble          angle,
190                         gdouble          x,
191                         gdouble          y,
192                         gdouble          size);
193 void gtk_render_background (GtkStyleContext *context,
194                             cairo_t         *cr,
195                             gdouble          x,
196                             gdouble          y,
197                             gdouble          width,
198                             gdouble          height);
199 void gtk_render_frame  (GtkStyleContext *context,
200                         cairo_t         *cr,
201                         gdouble          x,
202                         gdouble          y,
203                         gdouble          width,
204                         gdouble          height);
205 void gtk_render_expander (GtkStyleContext *context,
206                           cairo_t         *cr,
207                           gdouble          x,
208                           gdouble          y,
209                           gdouble          width,
210                           gdouble          height);
211 void gtk_render_focus    (GtkStyleContext *context,
212                           cairo_t         *cr,
213                           gdouble          x,
214                           gdouble          y,
215                           gdouble          width,
216                           gdouble          height);
217 void gtk_render_layout   (GtkStyleContext *context,
218                           cairo_t         *cr,
219                           gdouble          x,
220                           gdouble          y,
221                           PangoLayout     *layout);
222 void gtk_render_line     (GtkStyleContext *context,
223                           cairo_t         *cr,
224                           gdouble          x0,
225                           gdouble          y0,
226                           gdouble          x1,
227                           gdouble          y1);
228 void gtk_render_slider   (GtkStyleContext *context,
229                           cairo_t         *cr,
230                           gdouble          x,
231                           gdouble          y,
232                           gdouble          width,
233                           gdouble          height,
234                           GtkOrientation   orientation);
235 void gtk_render_frame_gap (GtkStyleContext *context,
236                            cairo_t         *cr,
237                            gdouble          x,
238                            gdouble          y,
239                            gdouble          width,
240                            gdouble          height,
241                            GtkPositionType  gap_side,
242                            gdouble          xy0_gap,
243                            gdouble          xy1_gap);
244 void gtk_render_extension (GtkStyleContext *context,
245                            cairo_t         *cr,
246                            gdouble          x,
247                            gdouble          y,
248                            gdouble          width,
249                            gdouble          height,
250                            GtkPositionType  gap_side);
251 void gtk_render_handle    (GtkStyleContext *context,
252                            cairo_t         *cr,
253                            gdouble          x,
254                            gdouble          y,
255                            gdouble          width,
256                            gdouble          height,
257                            GtkOrientation   orientation);
258
259 G_END_DECLS
260
261 #endif /* __GTK_STYLE_CONTEXT_H__ */