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>
26 #include <gtk/gtkborder.h>
30 #define GTK_TYPE_STYLE_CONTEXT (gtk_style_context_get_type ())
31 #define GTK_STYLE_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_STYLE_CONTEXT, GtkStyleContext))
32 #define GTK_STYLE_CONTEXT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GTK_TYPE_STYLE_CONTEXT, GtkStyleContextClass))
33 #define GTK_IS_STYLE_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_STYLE_CONTEXT))
34 #define GTK_IS_STYLE_CONTEXT_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GTK_TYPE_STYLE_CONTEXT))
35 #define GTK_STYLE_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_STYLE_CONTEXT, GtkStyleContextClass))
37 typedef struct _GtkStyleContext GtkStyleContext;
38 typedef struct _GtkStyleContextClass GtkStyleContextClass;
40 struct _GtkStyleContext
42 GObject parent_object;
46 struct _GtkStyleContextClass
48 GObjectClass parent_class;
50 void (* changed) (GtkStyleContext *context);
53 /* Default set of properties that GtkStyleContext may contain */
56 * GTK_STYLE_PROPERTY_BACKGROUND_COLOR:
58 * A property holding the background color of rendered elements as a #GdkRGBA.
60 #define GTK_STYLE_PROPERTY_BACKGROUND_COLOR "background-color"
63 * GTK_STYLE_PROPERTY_COLOR:
65 * A property holding the foreground color of rendered elements as a #GdkRGBA.
67 #define GTK_STYLE_PROPERTY_COLOR "color"
70 * GTK_STYLE_PROPERTY_FONT:
72 * A property holding the font properties used when rendering text
73 * as a #PangoFontDescription.
75 #define GTK_STYLE_PROPERTY_FONT "font"
78 * GTK_STYLE_PROPERTY_MARGIN:
80 * A property holding the rendered element's margin as a #GtkBorder. The
81 * margin is defined as the spacing between the border of the element
82 * and its surrounding elements.
84 #define GTK_STYLE_PROPERTY_MARGIN "margin"
87 * GTK_STYLE_PROPERTY_PADDING:
89 * A property holding the rendered element's padding as a #GtkBorder. The
90 * padding is defined as the spacing between the inner part of the element border
93 #define GTK_STYLE_PROPERTY_PADDING "padding"
96 * GTK_STYLE_PROPERTY_BORDER_WIDTH:
98 * A property holding the rendered element's border width in pixels as a #gint.
100 #define GTK_STYLE_PROPERTY_BORDER_WIDTH "border-width"
103 * GTK_STYLE_PROPERTY_BORDER_RADIUS:
105 * A property holding the rendered element's border radius in pixels as a #gint.
107 #define GTK_STYLE_PROPERTY_BORDER_RADIUS "border-radius"
110 * GTK_STYLE_PROPERTY_BORDER_STYLE:
112 * A property holding the element's border style as a #GtkBorderStyle.
114 #define GTK_STYLE_PROPERTY_BORDER_STYLE "border-style"
117 * GTK_STYLE_PROPERTY_BORDER_COLOR:
119 * A property holding the element's border color as a #GdkRGBA.
121 #define GTK_STYLE_PROPERTY_BORDER_COLOR "border-color"
124 * GTK_STYLE_PROPERTY_BACKGROUND_IMAGE:
126 * A property holding the element's background as a #cairo_pattern_t.
128 #define GTK_STYLE_PROPERTY_BACKGROUND_IMAGE "background-image"
131 /* Predefined set of CSS classes */
134 * GTK_STYLE_CLASS_CELL:
136 * A CSS class to match content rendered in cell views.
138 #define GTK_STYLE_CLASS_CELL "cell"
141 * GTK_STYLE_CLASS_ENTRY:
143 * A CSS class to match text entries.
145 #define GTK_STYLE_CLASS_ENTRY "entry"
148 * GTK_STYLE_CLASS_BUTTON:
150 * A CSS class to match buttons.
152 #define GTK_STYLE_CLASS_BUTTON "button"
155 * GTK_STYLE_CLASS_CALENDAR:
157 * A CSS class to match calendars.
159 #define GTK_STYLE_CLASS_CALENDAR "calendar"
162 * GTK_STYLE_CLASS_SLIDER:
164 * A CSS class to match sliders.
166 #define GTK_STYLE_CLASS_SLIDER "slider"
169 * GTK_STYLE_CLASS_BACKGROUND:
171 * A CSS class to match the window background.
173 #define GTK_STYLE_CLASS_BACKGROUND "background"
176 * GTK_STYLE_CLASS_RUBBERBAND:
178 * A CSS class to match the rubberband selection rectangle.
180 #define GTK_STYLE_CLASS_RUBBERBAND "rubberband"
183 * GTK_STYLE_CLASS_TOOLTIP:
185 * A CSS class to match tooltip windows.
187 #define GTK_STYLE_CLASS_TOOLTIP "tooltip"
190 * GTK_STYLE_CLASS_MENU:
192 * A CSS class to match popup menus.
194 #define GTK_STYLE_CLASS_MENU "menu"
197 * GTK_STYLE_CLASS_MENUBAR:
199 * A CSS class to menubars.
201 #define GTK_STYLE_CLASS_MENUBAR "menubar"
204 * GTK_STYLE_CLASS_MENUITEM:
206 * A CSS class to match menu items.
208 #define GTK_STYLE_CLASS_MENUITEM "menuitem"
211 * GTK_STYLE_CLASS_TOOLBAR:
213 * A CSS class to match toolbars.
215 #define GTK_STYLE_CLASS_TOOLBAR "toolbar"
218 * GTK_STYLE_CLASS_RADIO:
220 * A CSS class to match radio buttons.
222 #define GTK_STYLE_CLASS_RADIO "radio"
225 * GTK_STYLE_CLASS_CHECK:
227 * A CSS class to match check boxes.
229 #define GTK_STYLE_CLASS_CHECK "check"
232 * GTK_STYLE_CLASS_DEFAULT:
234 * A CSS class to match the default widget.
236 #define GTK_STYLE_CLASS_DEFAULT "default"
239 * GTK_STYLE_CLASS_TROUGH:
241 * A CSS class to match troughs, as in scrollbars and progressbars.
243 #define GTK_STYLE_CLASS_TROUGH "trough"
246 * GTK_STYLE_CLASS_SCROLLBAR:
248 * A CSS class to match scrollbars.
250 #define GTK_STYLE_CLASS_SCROLLBAR "scrollbar"
253 * GTK_STYLE_CLASS_HEADER:
255 * A CSS class to match a header element.
257 #define GTK_STYLE_CLASS_HEADER "header"
260 * GTK_STYLE_CLASS_ACCELERATOR:
262 * A CSS class to match an accelerator.
264 #define GTK_STYLE_CLASS_ACCELERATOR "accelerator"
267 * GTK_STYLE_CLASS_GRIP:
269 * A widget class defining a resize grip
271 #define GTK_STYLE_CLASS_GRIP "grip"
274 * GTK_STYLE_CLASS_DOCK:
276 * A widget class defining a dock area
278 #define GTK_STYLE_CLASS_DOCK "dock"
281 * GTK_STYLE_CLASS_PROGRESSBAR:
283 * A widget class defining a resize grip
285 #define GTK_STYLE_CLASS_PROGRESSBAR "progressbar"
288 * GTK_STYLE_CLASS_SPINNER:
290 * A widget class defining a spinner
292 #define GTK_STYLE_CLASS_SPINNER "spinner"
294 /* Predefined set of widget regions */
297 * GTK_STYLE_REGION_ROW:
299 * A widget region name to define a treeview row.
301 #define GTK_STYLE_REGION_ROW "row"
304 * GTK_STYLE_REGION_COLUMN:
306 * A widget region name to define a treeview column.
308 #define GTK_STYLE_REGION_COLUMN "column"
311 * GTK_STYLE_REGION_COLUMN_HEADER:
313 * A widget region name to define a treeview column header.
315 #define GTK_STYLE_REGION_COLUMN_HEADER "column-header"
318 * GTK_STYLE_REGION_TAB:
320 * A widget region name to define a notebook tab.
322 #define GTK_STYLE_REGION_TAB "tab"
325 GType gtk_style_context_get_type (void) G_GNUC_CONST;
327 GtkStyleContext * gtk_style_context_new (void);
329 void gtk_style_context_add_provider_for_screen (GdkScreen *screen,
330 GtkStyleProvider *provider,
332 void gtk_style_context_remove_provider_for_screen (GdkScreen *screen,
333 GtkStyleProvider *provider);
335 void gtk_style_context_add_provider (GtkStyleContext *context,
336 GtkStyleProvider *provider,
339 void gtk_style_context_remove_provider (GtkStyleContext *context,
340 GtkStyleProvider *provider);
342 void gtk_style_context_save (GtkStyleContext *context);
343 void gtk_style_context_restore (GtkStyleContext *context);
345 void gtk_style_context_get_property (GtkStyleContext *context,
346 const gchar *property,
349 void gtk_style_context_get_valist (GtkStyleContext *context,
352 void gtk_style_context_get (GtkStyleContext *context,
354 ...) G_GNUC_NULL_TERMINATED;
356 void gtk_style_context_set_state (GtkStyleContext *context,
357 GtkStateFlags flags);
358 GtkStateFlags gtk_style_context_get_state (GtkStyleContext *context);
360 gboolean gtk_style_context_state_is_running (GtkStyleContext *context,
364 void gtk_style_context_set_path (GtkStyleContext *context,
365 GtkWidgetPath *path);
366 G_CONST_RETURN GtkWidgetPath * gtk_style_context_get_path (GtkStyleContext *context);
368 GList * gtk_style_context_list_classes (GtkStyleContext *context);
370 void gtk_style_context_add_class (GtkStyleContext *context,
371 const gchar *class_name);
372 void gtk_style_context_remove_class (GtkStyleContext *context,
373 const gchar *class_name);
374 gboolean gtk_style_context_has_class (GtkStyleContext *context,
375 const gchar *class_name);
377 GList * gtk_style_context_list_regions (GtkStyleContext *context);
379 void gtk_style_context_add_region (GtkStyleContext *context,
380 const gchar *region_name,
381 GtkRegionFlags flags);
382 void gtk_style_context_remove_region (GtkStyleContext *context,
383 const gchar *region_name);
384 gboolean gtk_style_context_has_region (GtkStyleContext *context,
385 const gchar *region_name,
386 GtkRegionFlags *flags_return);
388 void gtk_style_context_get_style_property (GtkStyleContext *context,
389 const gchar *property_name,
391 void gtk_style_context_get_style_valist (GtkStyleContext *context,
393 void gtk_style_context_get_style (GtkStyleContext *context,
396 GtkIconSet * gtk_style_context_lookup_icon_set (GtkStyleContext *context,
397 const gchar *stock_id);
399 void gtk_style_context_set_screen (GtkStyleContext *context,
401 GdkScreen * gtk_style_context_get_screen (GtkStyleContext *context);
403 void gtk_style_context_set_direction (GtkStyleContext *context,
404 GtkTextDirection direction);
405 GtkTextDirection gtk_style_context_get_direction (GtkStyleContext *context);
407 void gtk_style_context_set_junction_sides (GtkStyleContext *context,
408 GtkJunctionSides sides);
409 GtkJunctionSides gtk_style_context_get_junction_sides (GtkStyleContext *context);
411 gboolean gtk_style_context_lookup_color (GtkStyleContext *context,
412 const gchar *color_name,
415 void gtk_style_context_notify_state_change (GtkStyleContext *context,
419 gboolean state_value);
420 void gtk_style_context_push_animatable_region (GtkStyleContext *context,
422 void gtk_style_context_pop_animatable_region (GtkStyleContext *context);
424 /* Some helper functions to retrieve most common properties */
425 void gtk_style_context_get_color (GtkStyleContext *context,
428 void gtk_style_context_get_background_color (GtkStyleContext *context,
431 void gtk_style_context_get_border_color (GtkStyleContext *context,
435 void gtk_style_context_get_border (GtkStyleContext *context,
438 void gtk_style_context_get_padding (GtkStyleContext *context,
441 void gtk_style_context_get_margin (GtkStyleContext *context,
445 /* Semi-private API */
446 const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
450 void _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context);
451 void _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
455 void gtk_style_context_invalidate (GtkStyleContext *context);
456 void gtk_style_context_reset_widgets (GdkScreen *screen);
458 void gtk_style_context_set_background (GtkStyleContext *context,
462 void gtk_render_check (GtkStyleContext *context,
468 void gtk_render_option (GtkStyleContext *context,
474 void gtk_render_arrow (GtkStyleContext *context,
480 void gtk_render_background (GtkStyleContext *context,
486 void gtk_render_frame (GtkStyleContext *context,
492 void gtk_render_expander (GtkStyleContext *context,
498 void gtk_render_focus (GtkStyleContext *context,
504 void gtk_render_layout (GtkStyleContext *context,
508 PangoLayout *layout);
509 void gtk_render_line (GtkStyleContext *context,
515 void gtk_render_slider (GtkStyleContext *context,
521 GtkOrientation orientation);
522 void gtk_render_frame_gap (GtkStyleContext *context,
528 GtkPositionType gap_side,
531 void gtk_render_extension (GtkStyleContext *context,
537 GtkPositionType gap_side);
538 void gtk_render_handle (GtkStyleContext *context,
544 void gtk_render_activity (GtkStyleContext *context,
551 GdkPixbuf * gtk_render_icon_pixbuf (GtkStyleContext *context,
552 const GtkIconSource *source,
557 #endif /* __GTK_STYLE_CONTEXT_H__ */