]> Pileus Git - ~andy/gtk/blob - gtk/gtkthemingengine.h
stylecontext: Do invalidation on first resize container
[~andy/gtk] / gtk / gtkthemingengine.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, see <http://www.gnu.org/licenses/>.
16  */
17
18 #ifndef __GTK_THEMING_ENGINE_H__
19 #define __GTK_THEMING_ENGINE_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 <glib-object.h>
26 #include <cairo.h>
27
28 #include <gtk/gtkborder.h>
29 #include <gtk/gtkenums.h>
30 #include <gtk/gtkstyleproperties.h>
31 #include <gtk/gtktypes.h>
32
33 G_BEGIN_DECLS
34
35 #define GTK_TYPE_THEMING_ENGINE         (gtk_theming_engine_get_type ())
36 #define GTK_THEMING_ENGINE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_THEMING_ENGINE, GtkThemingEngine))
37 #define GTK_THEMING_ENGINE_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST    ((c), GTK_TYPE_THEMING_ENGINE, GtkThemingEngineClass))
38 #define GTK_IS_THEMING_ENGINE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_THEMING_ENGINE))
39 #define GTK_IS_THEMING_ENGINE_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE    ((c), GTK_TYPE_THEMING_ENGINE))
40 #define GTK_THEMING_ENGINE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS  ((o), GTK_TYPE_THEMING_ENGINE, GtkThemingEngineClass))
41
42 typedef struct _GtkThemingEngine GtkThemingEngine;
43 typedef struct GtkThemingEnginePrivate GtkThemingEnginePrivate;
44 typedef struct _GtkThemingEngineClass GtkThemingEngineClass;
45
46 struct _GtkThemingEngine
47 {
48   GObject parent_object;
49   GtkThemingEnginePrivate *priv;
50 };
51
52 /**
53  * GtkThemingEngineClass:
54  * @parent_class: The parent class.
55  * @render_line: Renders a line between two points.
56  * @render_background: Renders the background area of a widget region.
57  * @render_frame: Renders the frame around a widget area.
58  * @render_frame_gap: Renders the frame around a widget area with a gap in it.
59  * @render_extension: Renders a extension to a box, usually a notebook tab.
60  * @render_check: Renders a checkmark, as in #GtkCheckButton.
61  * @render_option: Renders an option, as in #GtkRadioButton.
62  * @render_arrow: Renders an arrow pointing to a certain direction.
63  * @render_expander: Renders an element what will expose/expand part of
64  *                   the UI, as in #GtkExpander.
65  * @render_focus: Renders the focus indicator.
66  * @render_layout: Renders a #PangoLayout
67  * @render_slider: Renders a slider control, as in #GtkScale.
68  * @render_handle: Renders a handle to drag UI elements, as in #GtkPaned.
69  * @render_activity: Renders an area displaying activity, such as in #GtkSpinner,
70  *                   or #GtkProgressBar.
71  * @render_icon_pixbuf: Renders an icon as a #GdkPixbuf.
72  * @render_icon: Renders an icon given as a #GdkPixbuf.
73  *
74  * Base class for theming engines.
75  */
76 struct _GtkThemingEngineClass
77 {
78   GObjectClass parent_class;
79
80   void (* render_line) (GtkThemingEngine *engine,
81                         cairo_t          *cr,
82                         gdouble           x0,
83                         gdouble           y0,
84                         gdouble           x1,
85                         gdouble           y1);
86   void (* render_background) (GtkThemingEngine *engine,
87                               cairo_t          *cr,
88                               gdouble           x,
89                               gdouble           y,
90                               gdouble           width,
91                               gdouble           height);
92   void (* render_frame) (GtkThemingEngine *engine,
93                          cairo_t          *cr,
94                          gdouble           x,
95                          gdouble           y,
96                          gdouble           width,
97                          gdouble           height);
98   void (* render_frame_gap) (GtkThemingEngine *engine,
99                              cairo_t          *cr,
100                              gdouble           x,
101                              gdouble           y,
102                              gdouble           width,
103                              gdouble           height,
104                              GtkPositionType   gap_side,
105                              gdouble           xy0_gap,
106                              gdouble           xy1_gap);
107   void (* render_extension) (GtkThemingEngine *engine,
108                              cairo_t          *cr,
109                              gdouble           x,
110                              gdouble           y,
111                              gdouble           width,
112                              gdouble           height,
113                              GtkPositionType   gap_side);
114   void (* render_check) (GtkThemingEngine *engine,
115                          cairo_t          *cr,
116                          gdouble           x,
117                          gdouble           y,
118                          gdouble           width,
119                          gdouble           height);
120   void (* render_option) (GtkThemingEngine *engine,
121                           cairo_t          *cr,
122                           gdouble           x,
123                           gdouble           y,
124                           gdouble           width,
125                           gdouble           height);
126   void (* render_arrow) (GtkThemingEngine *engine,
127                          cairo_t          *cr,
128                          gdouble           angle,
129                          gdouble           x,
130                          gdouble           y,
131                          gdouble           size);
132   void (* render_expander) (GtkThemingEngine *engine,
133                             cairo_t          *cr,
134                             gdouble           x,
135                             gdouble           y,
136                             gdouble           width,
137                             gdouble           height);
138   void (* render_focus) (GtkThemingEngine *engine,
139                          cairo_t          *cr,
140                          gdouble           x,
141                          gdouble           y,
142                          gdouble           width,
143                          gdouble           height);
144   void (* render_layout) (GtkThemingEngine *engine,
145                           cairo_t          *cr,
146                           gdouble           x,
147                           gdouble           y,
148                           PangoLayout      *layout);
149   void (* render_slider) (GtkThemingEngine *engine,
150                           cairo_t          *cr,
151                           gdouble           x,
152                           gdouble           y,
153                           gdouble           width,
154                           gdouble           height,
155                           GtkOrientation    orientation);
156   void (* render_handle)    (GtkThemingEngine *engine,
157                              cairo_t          *cr,
158                              gdouble           x,
159                              gdouble           y,
160                              gdouble           width,
161                              gdouble           height);
162   void (* render_activity) (GtkThemingEngine *engine,
163                             cairo_t          *cr,
164                             gdouble           x,
165                             gdouble           y,
166                             gdouble           width,
167                             gdouble           height);
168
169   GdkPixbuf * (* render_icon_pixbuf) (GtkThemingEngine    *engine,
170                                       const GtkIconSource *source,
171                                       GtkIconSize          size);
172   void (* render_icon) (GtkThemingEngine *engine,
173                         cairo_t          *cr,
174                         GdkPixbuf        *pixbuf,
175                         gdouble           x,
176                         gdouble           y);
177
178   /*< private >*/
179   gpointer padding[15];
180 };
181
182 GType gtk_theming_engine_get_type (void) G_GNUC_CONST;
183
184 /* function implemented in gtkcsscustomproperty.c */
185 GDK_DEPRECATED_IN_3_8
186 void gtk_theming_engine_register_property (const gchar            *name_space,
187                                            GtkStylePropertyParser  parse_func,
188                                            GParamSpec             *pspec);
189
190 void gtk_theming_engine_get_property (GtkThemingEngine *engine,
191                                       const gchar      *property,
192                                       GtkStateFlags     state,
193                                       GValue           *value);
194 void gtk_theming_engine_get_valist   (GtkThemingEngine *engine,
195                                       GtkStateFlags     state,
196                                       va_list           args);
197 void gtk_theming_engine_get          (GtkThemingEngine *engine,
198                                       GtkStateFlags     state,
199                                       ...) G_GNUC_NULL_TERMINATED;
200
201 void gtk_theming_engine_get_style_property (GtkThemingEngine *engine,
202                                             const gchar      *property_name,
203                                             GValue           *value);
204 void gtk_theming_engine_get_style_valist   (GtkThemingEngine *engine,
205                                             va_list           args);
206 void gtk_theming_engine_get_style          (GtkThemingEngine *engine,
207                                             ...);
208
209 gboolean gtk_theming_engine_lookup_color (GtkThemingEngine *engine,
210                                           const gchar      *color_name,
211                                           GdkRGBA          *color);
212
213 const GtkWidgetPath * gtk_theming_engine_get_path (GtkThemingEngine *engine);
214
215 gboolean gtk_theming_engine_has_class  (GtkThemingEngine *engine,
216                                         const gchar      *style_class);
217 gboolean gtk_theming_engine_has_region (GtkThemingEngine *engine,
218                                         const gchar      *style_region,
219                                         GtkRegionFlags   *flags);
220
221 GtkStateFlags gtk_theming_engine_get_state        (GtkThemingEngine *engine);
222 GDK_DEPRECATED_IN_3_6
223 gboolean      gtk_theming_engine_state_is_running (GtkThemingEngine *engine,
224                                                    GtkStateType      state,
225                                                    gdouble          *progress);
226
227 GDK_DEPRECATED_IN_3_8_FOR(gtk_theming_engine_get_state)
228 GtkTextDirection gtk_theming_engine_get_direction (GtkThemingEngine *engine);
229
230 GtkJunctionSides gtk_theming_engine_get_junction_sides (GtkThemingEngine *engine);
231
232 /* Helper functions */
233 void gtk_theming_engine_get_color            (GtkThemingEngine *engine,
234                                               GtkStateFlags     state,
235                                               GdkRGBA          *color);
236 void gtk_theming_engine_get_background_color (GtkThemingEngine *engine,
237                                               GtkStateFlags     state,
238                                               GdkRGBA          *color);
239 void gtk_theming_engine_get_border_color     (GtkThemingEngine *engine,
240                                               GtkStateFlags     state,
241                                               GdkRGBA          *color);
242
243 void gtk_theming_engine_get_border  (GtkThemingEngine *engine,
244                                      GtkStateFlags     state,
245                                      GtkBorder        *border);
246 void gtk_theming_engine_get_padding (GtkThemingEngine *engine,
247                                      GtkStateFlags     state,
248                                      GtkBorder        *padding);
249 void gtk_theming_engine_get_margin  (GtkThemingEngine *engine,
250                                      GtkStateFlags     state,
251                                      GtkBorder        *margin);
252
253 GDK_DEPRECATED_IN_3_8_FOR(gtk_theming_engine_get)
254 const PangoFontDescription * gtk_theming_engine_get_font (GtkThemingEngine *engine,
255                                                           GtkStateFlags     state);
256
257 GtkThemingEngine * gtk_theming_engine_load (const gchar *name);
258
259 GdkScreen * gtk_theming_engine_get_screen (GtkThemingEngine *engine);
260
261 G_END_DECLS
262
263 #endif /* __GTK_THEMING_ENGINE_H__ */