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/deprecated/gtkstyleproperties.h>
31#include <gtk/gtktypes.h>
32
33G_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
42typedef struct _GtkThemingEngine GtkThemingEngine;
43typedef struct GtkThemingEnginePrivate GtkThemingEnginePrivate;
44typedef struct _GtkThemingEngineClass GtkThemingEngineClass;
45
46struct _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 * @render_icon_surface: Renders an icon given as a #cairo_surface_t.
74 *
75 * Base class for theming engines.
76 */
77struct _GtkThemingEngineClass
78{
79 GObjectClass parent_class;
80
81 /*< public >*/
82
83 void (* render_line) (GtkThemingEngine *engine,
84 cairo_t *cr,
85 gdouble x0,
86 gdouble y0,
87 gdouble x1,
88 gdouble y1);
89 void (* render_background) (GtkThemingEngine *engine,
90 cairo_t *cr,
91 gdouble x,
92 gdouble y,
93 gdouble width,
94 gdouble height);
95 void (* render_frame) (GtkThemingEngine *engine,
96 cairo_t *cr,
97 gdouble x,
98 gdouble y,
99 gdouble width,
100 gdouble height);
101 void (* render_frame_gap) (GtkThemingEngine *engine,
102 cairo_t *cr,
103 gdouble x,
104 gdouble y,
105 gdouble width,
106 gdouble height,
107 GtkPositionType gap_side,
108 gdouble xy0_gap,
109 gdouble xy1_gap);
110 void (* render_extension) (GtkThemingEngine *engine,
111 cairo_t *cr,
112 gdouble x,
113 gdouble y,
114 gdouble width,
115 gdouble height,
116 GtkPositionType gap_side);
117 void (* render_check) (GtkThemingEngine *engine,
118 cairo_t *cr,
119 gdouble x,
120 gdouble y,
121 gdouble width,
122 gdouble height);
123 void (* render_option) (GtkThemingEngine *engine,
124 cairo_t *cr,
125 gdouble x,
126 gdouble y,
127 gdouble width,
128 gdouble height);
129 void (* render_arrow) (GtkThemingEngine *engine,
130 cairo_t *cr,
131 gdouble angle,
132 gdouble x,
133 gdouble y,
134 gdouble size);
135 void (* render_expander) (GtkThemingEngine *engine,
136 cairo_t *cr,
137 gdouble x,
138 gdouble y,
139 gdouble width,
140 gdouble height);
141 void (* render_focus) (GtkThemingEngine *engine,
142 cairo_t *cr,
143 gdouble x,
144 gdouble y,
145 gdouble width,
146 gdouble height);
147 void (* render_layout) (GtkThemingEngine *engine,
148 cairo_t *cr,
149 gdouble x,
150 gdouble y,
151 PangoLayout *layout);
152 void (* render_slider) (GtkThemingEngine *engine,
153 cairo_t *cr,
154 gdouble x,
155 gdouble y,
156 gdouble width,
157 gdouble height,
158 GtkOrientation orientation);
159 void (* render_handle) (GtkThemingEngine *engine,
160 cairo_t *cr,
161 gdouble x,
162 gdouble y,
163 gdouble width,
164 gdouble height);
165 void (* render_activity) (GtkThemingEngine *engine,
166 cairo_t *cr,
167 gdouble x,
168 gdouble y,
169 gdouble width,
170 gdouble height);
171
172 GdkPixbuf * (* render_icon_pixbuf) (GtkThemingEngine *engine,
173 const GtkIconSource *source,
174 GtkIconSize size);
175 void (* render_icon) (GtkThemingEngine *engine,
176 cairo_t *cr,
177 GdkPixbuf *pixbuf,
178 gdouble x,
179 gdouble y);
180 void (* render_icon_surface) (GtkThemingEngine *engine,
181 cairo_t *cr,
182 cairo_surface_t *surface,
183 gdouble x,
184 gdouble y);
185
186 /*< private >*/
187 gpointer padding[14];
188};
189
190GDK_DEPRECATED_IN_3_14
191GType gtk_theming_engine_get_type (void) G_GNUC_CONST;
192
193/* function implemented in gtkcsscustomproperty.c */
194GDK_DEPRECATED_IN_3_8
195void gtk_theming_engine_register_property (const gchar *name_space,
196 GtkStylePropertyParser parse_func,
197 GParamSpec *pspec);
198
199GDK_DEPRECATED_IN_3_14
200void gtk_theming_engine_get_property (GtkThemingEngine *engine,
201 const gchar *property,
202 GtkStateFlags state,
203 GValue *value);
204GDK_DEPRECATED_IN_3_14
205void gtk_theming_engine_get_valist (GtkThemingEngine *engine,
206 GtkStateFlags state,
207 va_list args);
208GDK_DEPRECATED_IN_3_14
209void gtk_theming_engine_get (GtkThemingEngine *engine,
210 GtkStateFlags state,
211 ...) G_GNUC_NULL_TERMINATED;
212
213GDK_DEPRECATED_IN_3_14
214void gtk_theming_engine_get_style_property (GtkThemingEngine *engine,
215 const gchar *property_name,
216 GValue *value);
217GDK_DEPRECATED_IN_3_14
218void gtk_theming_engine_get_style_valist (GtkThemingEngine *engine,
219 va_list args);
220GDK_DEPRECATED_IN_3_14
221void gtk_theming_engine_get_style (GtkThemingEngine *engine,
222 ...);
223
224GDK_DEPRECATED_IN_3_14
225gboolean gtk_theming_engine_lookup_color (GtkThemingEngine *engine,
226 const gchar *color_name,
227 GdkRGBA *color);
228
229GDK_DEPRECATED_IN_3_14
230const GtkWidgetPath * gtk_theming_engine_get_path (GtkThemingEngine *engine);
231
232GDK_DEPRECATED_IN_3_14
233gboolean gtk_theming_engine_has_class (GtkThemingEngine *engine,
234 const gchar *style_class);
235GDK_DEPRECATED_IN_3_14
236gboolean gtk_theming_engine_has_region (GtkThemingEngine *engine,
237 const gchar *style_region,
238 GtkRegionFlags *flags);
239
240GDK_DEPRECATED_IN_3_14
241GtkStateFlags gtk_theming_engine_get_state (GtkThemingEngine *engine);
242GDK_DEPRECATED_IN_3_6
243gboolean gtk_theming_engine_state_is_running (GtkThemingEngine *engine,
244 GtkStateType state,
245 gdouble *progress);
246
247GDK_DEPRECATED_IN_3_8_FOR(gtk_theming_engine_get_state)
248GtkTextDirection gtk_theming_engine_get_direction (GtkThemingEngine *engine);
249
250GDK_DEPRECATED_IN_3_14
251GtkJunctionSides gtk_theming_engine_get_junction_sides (GtkThemingEngine *engine);
252
253/* Helper functions */
254GDK_DEPRECATED_IN_3_14
255void gtk_theming_engine_get_color (GtkThemingEngine *engine,
256 GtkStateFlags state,
257 GdkRGBA *color);
258GDK_DEPRECATED_IN_3_14
259void gtk_theming_engine_get_background_color (GtkThemingEngine *engine,
260 GtkStateFlags state,
261 GdkRGBA *color);
262GDK_DEPRECATED_IN_3_14
263void gtk_theming_engine_get_border_color (GtkThemingEngine *engine,
264 GtkStateFlags state,
265 GdkRGBA *color);
266
267GDK_DEPRECATED_IN_3_14
268void gtk_theming_engine_get_border (GtkThemingEngine *engine,
269 GtkStateFlags state,
270 GtkBorder *border);
271GDK_DEPRECATED_IN_3_14
272void gtk_theming_engine_get_padding (GtkThemingEngine *engine,
273 GtkStateFlags state,
274 GtkBorder *padding);
275GDK_DEPRECATED_IN_3_14
276void gtk_theming_engine_get_margin (GtkThemingEngine *engine,
277 GtkStateFlags state,
278 GtkBorder *margin);
279
280GDK_DEPRECATED_IN_3_8_FOR(gtk_theming_engine_get)
281const PangoFontDescription * gtk_theming_engine_get_font (GtkThemingEngine *engine,
282 GtkStateFlags state);
283
284GDK_DEPRECATED_IN_3_14
285GtkThemingEngine * gtk_theming_engine_load (const gchar *name);
286
287GDK_DEPRECATED_IN_3_14
288GdkScreen * gtk_theming_engine_get_screen (GtkThemingEngine *engine);
289
290G_END_DECLS
291
292#endif /* __GTK_THEMING_ENGINE_H__ */
293