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_RADIO:
120 * A CSS class to match radio buttons.
122 #define GTK_STYLE_CLASS_RADIO "radio"
125 * GTK_STYLE_CLASS_CHECK:
127 * A CSS class to match check boxes.
129 #define GTK_STYLE_CLASS_CHECK "check"
132 * GTK_STYLE_CLASS_DEFAULT:
134 * A CSS class to match the default widget.
136 #define GTK_STYLE_CLASS_DEFAULT "default"
139 * GTK_STYLE_CLASS_TROUGH:
141 * A CSS class to match troughs, as in scrollbars and progressbars.
143 #define GTK_STYLE_CLASS_TROUGH "trough"
146 * GTK_STYLE_CLASS_SCROLLBAR:
148 * A CSS class to match scrollbars.
150 #define GTK_STYLE_CLASS_SCROLLBAR "scrollbar"
153 * GTK_STYLE_CLASS_HEADER:
155 * A CSS class to match a header element.
157 #define GTK_STYLE_CLASS_HEADER "header"
160 /* Predefined set of widget regions */
163 * GTK_STYLE_REGION_ROW:
165 * A widget region name to define a treeview row.
167 #define GTK_STYLE_REGION_ROW "row"
170 * GTK_STYLE_REGION_COLUMN:
172 * A widget region name to define a treeview column.
174 #define GTK_STYLE_REGION_COLUMN "column"
177 * GTK_STYLE_REGION_COLUMN_HEADER:
179 * A widget region name to define a treeview column header.
181 #define GTK_STYLE_REGION_COLUMN_HEADER "column-header"
184 * GTK_STYLE_REGION_TAB:
186 * A widget region name to define a notebook tab.
188 #define GTK_STYLE_REGION_TAB "tab"
191 GType gtk_style_context_get_type (void) G_GNUC_CONST;
193 GtkStyleContext * gtk_style_context_new (void);
195 void gtk_style_context_add_provider_for_screen (GdkScreen *screen,
196 GtkStyleProvider *provider,
198 void gtk_style_context_remove_provider_for_screen (GdkScreen *screen,
199 GtkStyleProvider *provider);
201 void gtk_style_context_add_provider (GtkStyleContext *context,
202 GtkStyleProvider *provider,
205 void gtk_style_context_remove_provider (GtkStyleContext *context,
206 GtkStyleProvider *provider);
208 void gtk_style_context_save (GtkStyleContext *context);
209 void gtk_style_context_restore (GtkStyleContext *context);
211 void gtk_style_context_get_property (GtkStyleContext *context,
212 const gchar *property,
215 void gtk_style_context_get_valist (GtkStyleContext *context,
218 void gtk_style_context_get (GtkStyleContext *context,
220 ...) G_GNUC_NULL_TERMINATED;
222 void gtk_style_context_set_state (GtkStyleContext *context,
223 GtkStateFlags flags);
224 GtkStateFlags gtk_style_context_get_state (GtkStyleContext *context);
226 gboolean gtk_style_context_state_is_running (GtkStyleContext *context,
230 void gtk_style_context_set_path (GtkStyleContext *context,
231 GtkWidgetPath *path);
232 G_CONST_RETURN GtkWidgetPath * gtk_style_context_get_path (GtkStyleContext *context);
234 GList * gtk_style_context_list_classes (GtkStyleContext *context);
236 void gtk_style_context_add_class (GtkStyleContext *context,
237 const gchar *class_name);
238 void gtk_style_context_remove_class (GtkStyleContext *context,
239 const gchar *class_name);
240 gboolean gtk_style_context_has_class (GtkStyleContext *context,
241 const gchar *class_name);
243 GList * gtk_style_context_list_regions (GtkStyleContext *context);
245 void gtk_style_context_add_region (GtkStyleContext *context,
246 const gchar *region_name,
247 GtkRegionFlags flags);
248 void gtk_style_context_remove_region (GtkStyleContext *context,
249 const gchar *region_name);
250 gboolean gtk_style_context_has_region (GtkStyleContext *context,
251 const gchar *region_name,
252 GtkRegionFlags *flags_return);
254 void gtk_style_context_get_style_property (GtkStyleContext *context,
255 const gchar *property_name,
257 void gtk_style_context_get_style_valist (GtkStyleContext *context,
259 void gtk_style_context_get_style (GtkStyleContext *context,
262 GtkIconSet * gtk_style_context_lookup_icon_set (GtkStyleContext *context,
263 const gchar *stock_id);
265 void gtk_style_context_set_screen (GtkStyleContext *context,
267 GdkScreen * gtk_style_context_get_screen (GtkStyleContext *context);
269 void gtk_style_context_set_direction (GtkStyleContext *context,
270 GtkTextDirection direction);
271 GtkTextDirection gtk_style_context_get_direction (GtkStyleContext *context);
273 void gtk_style_context_set_junction_sides (GtkStyleContext *context,
274 GtkJunctionSides sides);
275 GtkJunctionSides gtk_style_context_get_junction_sides (GtkStyleContext *context);
277 gboolean gtk_style_context_lookup_color (GtkStyleContext *context,
278 const gchar *color_name,
281 void gtk_style_context_notify_state_change (GtkStyleContext *context,
285 gboolean state_value);
286 void gtk_style_context_push_animatable_region (GtkStyleContext *context,
288 void gtk_style_context_pop_animatable_region (GtkStyleContext *context);
291 /* Semi-private API */
292 const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
295 void _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context);
296 void _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
300 /* Animation for state changes */
301 void gtk_style_context_state_transition_start (GtkStyleContext *context,
307 void gtk_style_context_state_transition_update (GtkStyleContext *context,
311 void gtk_style_context_state_transition_stop (GtkStyleContext *context,
312 gpointer identifier);
314 void gtk_style_context_invalidate (GtkStyleContext *context);
315 void gtk_style_context_reset_widgets (GdkScreen *screen);
318 void gtk_render_check (GtkStyleContext *context,
324 void gtk_render_option (GtkStyleContext *context,
330 void gtk_render_arrow (GtkStyleContext *context,
336 void gtk_render_background (GtkStyleContext *context,
342 void gtk_render_frame (GtkStyleContext *context,
348 void gtk_render_expander (GtkStyleContext *context,
354 void gtk_render_focus (GtkStyleContext *context,
360 void gtk_render_layout (GtkStyleContext *context,
364 PangoLayout *layout);
365 void gtk_render_line (GtkStyleContext *context,
371 void gtk_render_slider (GtkStyleContext *context,
377 GtkOrientation orientation);
378 void gtk_render_frame_gap (GtkStyleContext *context,
384 GtkPositionType gap_side,
387 void gtk_render_extension (GtkStyleContext *context,
393 GtkPositionType gap_side);
394 void gtk_render_handle (GtkStyleContext *context,
400 void gtk_render_activity (GtkStyleContext *context,
409 #endif /* __GTK_STYLE_CONTEXT_H__ */