1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
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.
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.
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.
20 #ifndef __GTK_STYLE_CONTEXT_H__
21 #define __GTK_STYLE_CONTEXT_H__
23 #include <glib-object.h>
24 #include <gtk/gtkstyleprovider.h>
25 #include <gtk/gtkwidgetpath.h>
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))
36 typedef struct _GtkStyleContext GtkStyleContext;
37 typedef struct _GtkStyleContextClass GtkStyleContextClass;
39 struct _GtkStyleContext
41 GObject parent_object;
45 struct _GtkStyleContextClass
47 GObjectClass parent_class;
49 void (* changed) (GtkStyleContext *context);
52 /* Predefined set of CSS classes */
55 * GTK_STYLE_CLASS_CELL:
57 * A CSS class to match content rendered in cell views.
59 #define GTK_STYLE_CLASS_CELL "cell"
62 * GTK_STYLE_CLASS_ENTRY:
64 * A CSS class to match text entries.
66 #define GTK_STYLE_CLASS_ENTRY "entry"
69 * GTK_STYLE_CLASS_BUTTON:
71 * A CSS class to match buttons.
73 #define GTK_STYLE_CLASS_BUTTON "button"
76 * GTK_STYLE_CLASS_CALENDAR:
78 * A CSS class to match calendars.
80 #define GTK_STYLE_CLASS_CALENDAR "calendar"
83 * GTK_STYLE_CLASS_SLIDER:
85 * A CSS class to match sliders.
87 #define GTK_STYLE_CLASS_SLIDER "slider"
90 * GTK_STYLE_CLASS_BACKGROUND:
92 * A CSS class to match the window background.
94 #define GTK_STYLE_CLASS_BACKGROUND "background"
97 * GTK_STYLE_CLASS_RUBBERBAND:
99 * A CSS class to match the rubberband selection rectangle.
101 #define GTK_STYLE_CLASS_RUBBERBAND "rubberband"
104 * GTK_STYLE_CLASS_TOOLTIP:
106 * A CSS class to match tooltip windows.
108 #define GTK_STYLE_CLASS_TOOLTIP "tooltip"
111 * GTK_STYLE_CLASS_MENU:
113 * A CSS class to match popup menus.
115 #define GTK_STYLE_CLASS_MENU "menu"
118 * GTK_STYLE_CLASS_MENUBAR:
120 * A CSS class to menubars.
122 #define GTK_STYLE_CLASS_MENUBAR "menubar"
125 * GTK_STYLE_CLASS_MENUITEM:
127 * A CSS class to match menu items.
129 #define GTK_STYLE_CLASS_MENUITEM "menuitem"
132 * GTK_STYLE_CLASS_RADIO:
134 * A CSS class to match radio buttons.
136 #define GTK_STYLE_CLASS_RADIO "radio"
139 * GTK_STYLE_CLASS_CHECK:
141 * A CSS class to match check boxes.
143 #define GTK_STYLE_CLASS_CHECK "check"
146 * GTK_STYLE_CLASS_DEFAULT:
148 * A CSS class to match the default widget.
150 #define GTK_STYLE_CLASS_DEFAULT "default"
153 * GTK_STYLE_CLASS_TROUGH:
155 * A CSS class to match troughs, as in scrollbars and progressbars.
157 #define GTK_STYLE_CLASS_TROUGH "trough"
160 * GTK_STYLE_CLASS_SCROLLBAR:
162 * A CSS class to match scrollbars.
164 #define GTK_STYLE_CLASS_SCROLLBAR "scrollbar"
167 * GTK_STYLE_CLASS_HEADER:
169 * A CSS class to match a header element.
171 #define GTK_STYLE_CLASS_HEADER "header"
174 * GTK_STYLE_CLASS_ACCELERATOR:
176 * A CSS class to match an accelerator.
178 #define GTK_STYLE_CLASS_ACCELERATOR "accelerator"
181 * GTK_STYLE_CLASS_GRIP:
183 * A widget class defining a resize grip
185 #define GTK_STYLE_CLASS_GRIP "grip"
188 * GTK_STYLE_CLASS_PROGRESSBAR:
190 * A widget class defining a resize grip
192 #define GTK_STYLE_CLASS_PROGRESSBAR "progressbar"
194 /* Predefined set of widget regions */
197 * GTK_STYLE_REGION_ROW:
199 * A widget region name to define a treeview row.
201 #define GTK_STYLE_REGION_ROW "row"
204 * GTK_STYLE_REGION_COLUMN:
206 * A widget region name to define a treeview column.
208 #define GTK_STYLE_REGION_COLUMN "column"
211 * GTK_STYLE_REGION_COLUMN_HEADER:
213 * A widget region name to define a treeview column header.
215 #define GTK_STYLE_REGION_COLUMN_HEADER "column-header"
218 * GTK_STYLE_REGION_TAB:
220 * A widget region name to define a notebook tab.
222 #define GTK_STYLE_REGION_TAB "tab"
225 GType gtk_style_context_get_type (void) G_GNUC_CONST;
227 GtkStyleContext * gtk_style_context_new (void);
229 void gtk_style_context_add_provider_for_screen (GdkScreen *screen,
230 GtkStyleProvider *provider,
232 void gtk_style_context_remove_provider_for_screen (GdkScreen *screen,
233 GtkStyleProvider *provider);
235 void gtk_style_context_add_provider (GtkStyleContext *context,
236 GtkStyleProvider *provider,
239 void gtk_style_context_remove_provider (GtkStyleContext *context,
240 GtkStyleProvider *provider);
242 void gtk_style_context_save (GtkStyleContext *context);
243 void gtk_style_context_restore (GtkStyleContext *context);
245 void gtk_style_context_get_property (GtkStyleContext *context,
246 const gchar *property,
249 void gtk_style_context_get_valist (GtkStyleContext *context,
252 void gtk_style_context_get (GtkStyleContext *context,
254 ...) G_GNUC_NULL_TERMINATED;
256 void gtk_style_context_set_state (GtkStyleContext *context,
257 GtkStateFlags flags);
258 GtkStateFlags gtk_style_context_get_state (GtkStyleContext *context);
260 gboolean gtk_style_context_state_is_running (GtkStyleContext *context,
264 void gtk_style_context_set_path (GtkStyleContext *context,
265 GtkWidgetPath *path);
266 G_CONST_RETURN GtkWidgetPath * gtk_style_context_get_path (GtkStyleContext *context);
268 GList * gtk_style_context_list_classes (GtkStyleContext *context);
270 void gtk_style_context_add_class (GtkStyleContext *context,
271 const gchar *class_name);
272 void gtk_style_context_remove_class (GtkStyleContext *context,
273 const gchar *class_name);
274 gboolean gtk_style_context_has_class (GtkStyleContext *context,
275 const gchar *class_name);
277 GList * gtk_style_context_list_regions (GtkStyleContext *context);
279 void gtk_style_context_add_region (GtkStyleContext *context,
280 const gchar *region_name,
281 GtkRegionFlags flags);
282 void gtk_style_context_remove_region (GtkStyleContext *context,
283 const gchar *region_name);
284 gboolean gtk_style_context_has_region (GtkStyleContext *context,
285 const gchar *region_name,
286 GtkRegionFlags *flags_return);
288 void gtk_style_context_get_style_property (GtkStyleContext *context,
289 const gchar *property_name,
291 void gtk_style_context_get_style_valist (GtkStyleContext *context,
293 void gtk_style_context_get_style (GtkStyleContext *context,
296 GtkIconSet * gtk_style_context_lookup_icon_set (GtkStyleContext *context,
297 const gchar *stock_id);
299 void gtk_style_context_set_screen (GtkStyleContext *context,
301 GdkScreen * gtk_style_context_get_screen (GtkStyleContext *context);
303 void gtk_style_context_set_direction (GtkStyleContext *context,
304 GtkTextDirection direction);
305 GtkTextDirection gtk_style_context_get_direction (GtkStyleContext *context);
307 void gtk_style_context_set_junction_sides (GtkStyleContext *context,
308 GtkJunctionSides sides);
309 GtkJunctionSides gtk_style_context_get_junction_sides (GtkStyleContext *context);
311 gboolean gtk_style_context_lookup_color (GtkStyleContext *context,
312 const gchar *color_name,
315 void gtk_style_context_notify_state_change (GtkStyleContext *context,
319 gboolean state_value);
320 void gtk_style_context_push_animatable_region (GtkStyleContext *context,
322 void gtk_style_context_pop_animatable_region (GtkStyleContext *context);
325 /* Semi-private API */
326 const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
329 void _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context);
330 void _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
334 /* Animation for state changes */
335 void gtk_style_context_state_transition_start (GtkStyleContext *context,
341 void gtk_style_context_state_transition_update (GtkStyleContext *context,
345 void gtk_style_context_state_transition_stop (GtkStyleContext *context,
346 gpointer identifier);
348 void gtk_style_context_invalidate (GtkStyleContext *context);
349 void gtk_style_context_reset_widgets (GdkScreen *screen);
352 void gtk_render_check (GtkStyleContext *context,
358 void gtk_render_option (GtkStyleContext *context,
364 void gtk_render_arrow (GtkStyleContext *context,
370 void gtk_render_background (GtkStyleContext *context,
376 void gtk_render_frame (GtkStyleContext *context,
382 void gtk_render_expander (GtkStyleContext *context,
388 void gtk_render_focus (GtkStyleContext *context,
394 void gtk_render_layout (GtkStyleContext *context,
398 PangoLayout *layout);
399 void gtk_render_line (GtkStyleContext *context,
405 void gtk_render_slider (GtkStyleContext *context,
411 GtkOrientation orientation);
412 void gtk_render_frame_gap (GtkStyleContext *context,
418 GtkPositionType gap_side,
421 void gtk_render_extension (GtkStyleContext *context,
427 GtkPositionType gap_side);
428 void gtk_render_handle (GtkStyleContext *context,
434 void gtk_render_activity (GtkStyleContext *context,
441 GdkPixbuf * gtk_render_icon_pixbuf (GtkStyleContext *context,
442 const GtkIconSource *source,
447 #endif /* __GTK_STYLE_CONTEXT_H__ */