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