]> Pileus Git - ~andy/gtk/blob - gtk/gtkstylecontext.h
GtkStyleContext: Add gtk_style_context_lookup_color().
[~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 void             gtk_style_context_set_direction (GtkStyleContext  *context,
118                                                   GtkTextDirection  direction);
119 GtkTextDirection gtk_style_context_get_direction (GtkStyleContext  *context);
120
121 gboolean gtk_style_context_lookup_color (GtkStyleContext *context,
122                                          const gchar     *color_name,
123                                          GdkColor        *color);
124
125 /* Semi-private API */
126 const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
127                                                        GType            widget_type,
128                                                        GParamSpec      *pspec);
129
130 /* Paint methods */
131 void gtk_render_check (GtkStyleContext *context,
132                        cairo_t         *cr,
133                        gdouble          x,
134                        gdouble          y,
135                        gdouble          width,
136                        gdouble          height);
137 void gtk_render_option (GtkStyleContext *context,
138                         cairo_t         *cr,
139                         gdouble          x,
140                         gdouble          y,
141                         gdouble          width,
142                         gdouble          height);
143 void gtk_render_arrow  (GtkStyleContext *context,
144                         cairo_t         *cr,
145                         gdouble          angle,
146                         gdouble          x,
147                         gdouble          y,
148                         gdouble          size);
149 void gtk_render_background (GtkStyleContext *context,
150                             cairo_t         *cr,
151                             gdouble          x,
152                             gdouble          y,
153                             gdouble          width,
154                             gdouble          height);
155 void gtk_render_frame  (GtkStyleContext *context,
156                         cairo_t         *cr,
157                         gdouble          x,
158                         gdouble          y,
159                         gdouble          width,
160                         gdouble          height);
161 void gtk_render_expander (GtkStyleContext *context,
162                           cairo_t         *cr,
163                           gdouble          x,
164                           gdouble          y,
165                           gdouble          width,
166                           gdouble          height);
167 void gtk_render_focus    (GtkStyleContext *context,
168                           cairo_t         *cr,
169                           gdouble          x,
170                           gdouble          y,
171                           gdouble          width,
172                           gdouble          height);
173 void gtk_render_layout   (GtkStyleContext *context,
174                           cairo_t         *cr,
175                           gdouble          x,
176                           gdouble          y,
177                           PangoLayout     *layout);
178 void gtk_render_line     (GtkStyleContext *context,
179                           cairo_t         *cr,
180                           gdouble          x0,
181                           gdouble          y0,
182                           gdouble          x1,
183                           gdouble          y1);
184 void gtk_render_slider   (GtkStyleContext *context,
185                           cairo_t         *cr,
186                           gdouble          x,
187                           gdouble          y,
188                           gdouble          width,
189                           gdouble          height,
190                           GtkOrientation   orientation);
191 void gtk_render_frame_gap (GtkStyleContext *context,
192                            cairo_t         *cr,
193                            gdouble          x,
194                            gdouble          y,
195                            gdouble          width,
196                            gdouble          height,
197                            GtkPositionType  gap_side,
198                            gdouble          xy0_gap,
199                            gdouble          xy1_gap);
200 void gtk_render_extension (GtkStyleContext *context,
201                            cairo_t         *cr,
202                            gdouble          x,
203                            gdouble          y,
204                            gdouble          width,
205                            gdouble          height,
206                            GtkPositionType  gap_side);
207 void gtk_render_handle    (GtkStyleContext *context,
208                            cairo_t         *cr,
209                            gdouble          x,
210                            gdouble          y,
211                            gdouble          width,
212                            gdouble          height,
213                            GtkOrientation   orientation);
214
215 G_END_DECLS
216
217 #endif /* __GTK_STYLE_CONTEXT_H__ */