]> Pileus Git - ~andy/gtk/blob - gtk/gtkstylecontext.h
GtkStyleContext: Add varargs functions for getting widget style properties.
[~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
50 GType gtk_style_context_get_type (void) G_GNUC_CONST;
51
52 void gtk_style_context_add_provider    (GtkStyleContext  *context,
53                                         GtkStyleProvider *provider,
54                                         guint             priority);
55
56 void gtk_style_context_remove_provider (GtkStyleContext  *context,
57                                         GtkStyleProvider *provider);
58
59 void gtk_style_context_save    (GtkStyleContext *context);
60 void gtk_style_context_restore (GtkStyleContext *context);
61
62 void gtk_style_context_get_property (GtkStyleContext *context,
63                                      const gchar     *property,
64                                      GtkStateType     state,
65                                      GValue          *value);
66 void gtk_style_context_get_valist   (GtkStyleContext *context,
67                                      GtkStateType     state,
68                                      va_list          args);
69 void gtk_style_context_get          (GtkStyleContext *context,
70                                      GtkStateType     state,
71                                      ...) G_GNUC_NULL_TERMINATED;
72
73 void          gtk_style_context_set_state    (GtkStyleContext *context,
74                                               GtkStateFlags    flags);
75 GtkStateFlags gtk_style_context_get_state    (GtkStyleContext *context);
76
77 gboolean      gtk_style_context_is_state_set (GtkStyleContext *context,
78                                               GtkStateType     state);
79
80 void          gtk_style_context_set_path     (GtkStyleContext *context,
81                                               GtkWidgetPath   *path);
82 G_CONST_RETURN GtkWidgetPath * gtk_style_context_get_path (GtkStyleContext *context);
83
84 void     gtk_style_context_set_class   (GtkStyleContext *context,
85                                         const gchar     *class_name);
86 void     gtk_style_context_unset_class (GtkStyleContext *context,
87                                         const gchar     *class_name);
88 gboolean gtk_style_context_has_class   (GtkStyleContext *context,
89                                         const gchar     *class_name);
90
91 GList *  gtk_style_context_list_child_classes (GtkStyleContext *context);
92
93 void     gtk_style_context_set_child_class   (GtkStyleContext    *context,
94                                               const gchar        *class_name,
95                                               GtkChildClassFlags  flags);
96 void     gtk_style_context_unset_child_class (GtkStyleContext    *context,
97                                               const gchar        *class_name);
98 gboolean gtk_style_context_has_child_class   (GtkStyleContext    *context,
99                                               const gchar        *class_name,
100                                               GtkChildClassFlags *flags_return);
101
102 void gtk_style_context_get_style_property (GtkStyleContext *context,
103                                            const gchar     *property_name,
104                                            GValue          *value);
105 void gtk_style_context_get_style_valist   (GtkStyleContext *context,
106                                            va_list          args);
107 void gtk_style_context_get_style          (GtkStyleContext *context,
108                                            ...);
109
110 GtkIconSet * gtk_style_context_lookup_icon_set (GtkStyleContext *context,
111                                                 const gchar     *stock_id);
112
113 void        gtk_style_context_set_screen (GtkStyleContext *context,
114                                           GdkScreen       *screen);
115 GdkScreen * gtk_style_context_get_screen (GtkStyleContext *context);
116
117
118 /* Semi-private API */
119 const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
120                                                        GType            widget_type,
121                                                        GParamSpec      *pspec);
122
123 /* Paint methods */
124 void gtk_render_check (GtkStyleContext *context,
125                        cairo_t         *cr,
126                        gdouble          x,
127                        gdouble          y,
128                        gdouble          width,
129                        gdouble          height);
130 void gtk_render_option (GtkStyleContext *context,
131                         cairo_t         *cr,
132                         gdouble          x,
133                         gdouble          y,
134                         gdouble          width,
135                         gdouble          height);
136 void gtk_render_arrow  (GtkStyleContext *context,
137                         cairo_t         *cr,
138                         gdouble          angle,
139                         gdouble          x,
140                         gdouble          y,
141                         gdouble          size);
142 void gtk_render_background (GtkStyleContext *context,
143                             cairo_t         *cr,
144                             gdouble          x,
145                             gdouble          y,
146                             gdouble          width,
147                             gdouble          height);
148 void gtk_render_frame  (GtkStyleContext *context,
149                         cairo_t         *cr,
150                         gdouble          x,
151                         gdouble          y,
152                         gdouble          width,
153                         gdouble          height);
154 void gtk_render_expander (GtkStyleContext *context,
155                           cairo_t         *cr,
156                           gdouble          x,
157                           gdouble          y,
158                           gdouble          width,
159                           gdouble          height);
160 void gtk_render_focus    (GtkStyleContext *context,
161                           cairo_t         *cr,
162                           gdouble          x,
163                           gdouble          y,
164                           gdouble          width,
165                           gdouble          height);
166 void gtk_render_layout   (GtkStyleContext *context,
167                           cairo_t         *cr,
168                           gdouble          x,
169                           gdouble          y,
170                           PangoLayout     *layout);
171 void gtk_render_line     (GtkStyleContext *context,
172                           cairo_t         *cr,
173                           gdouble          x0,
174                           gdouble          y0,
175                           gdouble          x1,
176                           gdouble          y1);
177 void gtk_render_slider   (GtkStyleContext *context,
178                           cairo_t         *cr,
179                           gdouble          x,
180                           gdouble          y,
181                           gdouble          width,
182                           gdouble          height,
183                           GtkOrientation   orientation);
184 void gtk_render_frame_gap (GtkStyleContext *context,
185                            cairo_t         *cr,
186                            gdouble          x,
187                            gdouble          y,
188                            gdouble          width,
189                            gdouble          height,
190                            GtkPositionType  gap_side,
191                            gdouble          xy0_gap,
192                            gdouble          xy1_gap);
193 void gtk_render_extension (GtkStyleContext *context,
194                            cairo_t         *cr,
195                            gdouble          x,
196                            gdouble          y,
197                            gdouble          width,
198                            gdouble          height,
199                            GtkPositionType  gap_side);
200 void gtk_render_handle    (GtkStyleContext *context,
201                            cairo_t         *cr,
202                            gdouble          x,
203                            gdouble          y,
204                            gdouble          width,
205                            gdouble          height,
206                            GtkOrientation   orientation);
207
208 G_END_DECLS
209
210 #endif /* __GTK_STYLE_CONTEXT_H__ */