1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.StyleContext;
26 
27 private import cairo.Context;
28 private import cairo.Surface;
29 private import gdk.FrameClock;
30 private import gdk.RGBA;
31 private import gdk.Screen;
32 private import gdk.Window;
33 private import gdkpixbuf.Pixbuf;
34 private import glib.ConstructionException;
35 private import glib.ListG;
36 private import glib.Str;
37 private import gobject.ObjectG;
38 private import gobject.Signals;
39 private import gobject.Value;
40 private import gtk.Border;
41 private import gtk.CssSection;
42 private import gtk.IconSet;
43 private import gtk.IconSource;
44 private import gtk.StyleProviderIF;
45 private import gtk.WidgetPath;
46 public  import gtkc.gdktypes;
47 private import gtkc.gtk;
48 public  import gtkc.gtktypes;
49 private import pango.PgFontDescription;
50 private import pango.PgLayout;
51 private import std.algorithm;
52 
53 
54 /**
55  * #GtkStyleContext is an object that stores styling information affecting
56  * a widget defined by #GtkWidgetPath.
57  * 
58  * In order to construct the final style information, #GtkStyleContext
59  * queries information from all attached #GtkStyleProviders. Style providers
60  * can be either attached explicitly to the context through
61  * gtk_style_context_add_provider(), or to the screen through
62  * gtk_style_context_add_provider_for_screen(). The resulting style is a
63  * combination of all providers’ information in priority order.
64  * 
65  * For GTK+ widgets, any #GtkStyleContext returned by
66  * gtk_widget_get_style_context() will already have a #GtkWidgetPath, a
67  * #GdkScreen and RTL/LTR information set. The style context will also be
68  * updated automatically if any of these settings change on the widget.
69  * 
70  * If you are using the theming layer standalone, you will need to set a
71  * widget path and a screen yourself to the created style context through
72  * gtk_style_context_set_path() and gtk_style_context_set_screen(), as well
73  * as updating the context yourself using gtk_style_context_invalidate()
74  * whenever any of the conditions change, such as a change in the
75  * #GtkSettings:gtk-theme-name setting or a hierarchy change in the rendered
76  * widget. See the “Foreign drawing“ example in gtk3-demo.
77  * 
78  * # Style Classes # {#gtkstylecontext-classes}
79  * 
80  * Widgets can add style classes to their context, which can be used to associate
81  * different styles by class. The documentation for individual widgets lists
82  * which style classes it uses itself, and which style classes may be added by
83  * applications to affect their appearance.
84  * 
85  * GTK+ defines macros for a number of style classes.
86  * 
87  * # Style Regions
88  * 
89  * Widgets can also add regions with flags to their context. This feature is
90  * deprecated and will be removed in a future GTK+ update. Please use style
91  * classes instead.
92  * 
93  * GTK+ defines macros for a number of style regions.
94  * 
95  * # Custom styling in UI libraries and applications
96  * 
97  * If you are developing a library with custom #GtkWidgets that
98  * render differently than standard components, you may need to add a
99  * #GtkStyleProvider yourself with the %GTK_STYLE_PROVIDER_PRIORITY_FALLBACK
100  * priority, either a #GtkCssProvider or a custom object implementing the
101  * #GtkStyleProvider interface. This way themes may still attempt
102  * to style your UI elements in a different way if needed so.
103  * 
104  * If you are using custom styling on an applications, you probably want then
105  * to make your style information prevail to the theme’s, so you must use
106  * a #GtkStyleProvider with the %GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
107  * priority, keep in mind that the user settings in
108  * `XDG_CONFIG_HOME/gtk-3.0/gtk.css` will
109  * still take precedence over your changes, as it uses the
110  * %GTK_STYLE_PROVIDER_PRIORITY_USER priority.
111  */
112 public class StyleContext : ObjectG
113 {
114 	/** the main Gtk struct */
115 	protected GtkStyleContext* gtkStyleContext;
116 
117 	/** Get the main Gtk struct */
118 	public GtkStyleContext* getStyleContextStruct()
119 	{
120 		return gtkStyleContext;
121 	}
122 
123 	/** the main Gtk struct as a void* */
124 	protected override void* getStruct()
125 	{
126 		return cast(void*)gtkStyleContext;
127 	}
128 
129 	protected override void setStruct(GObject* obj)
130 	{
131 		gtkStyleContext = cast(GtkStyleContext*)obj;
132 		super.setStruct(obj);
133 	}
134 
135 	/**
136 	 * Sets our main struct and passes it to the parent class.
137 	 */
138 	public this (GtkStyleContext* gtkStyleContext, bool ownedRef = false)
139 	{
140 		this.gtkStyleContext = gtkStyleContext;
141 		super(cast(GObject*)gtkStyleContext, ownedRef);
142 	}
143 
144 
145 	/** */
146 	public static GType getType()
147 	{
148 		return gtk_style_context_get_type();
149 	}
150 
151 	/**
152 	 * Creates a standalone #GtkStyleContext, this style context
153 	 * won’t be attached to any widget, so you may want
154 	 * to call gtk_style_context_set_path() yourself.
155 	 *
156 	 * This function is only useful when using the theming layer
157 	 * separated from GTK+, if you are using #GtkStyleContext to
158 	 * theme #GtkWidgets, use gtk_widget_get_style_context()
159 	 * in order to get a style context ready to theme the widget.
160 	 *
161 	 * Return: A newly created #GtkStyleContext.
162 	 *
163 	 * Throws: ConstructionException GTK+ fails to create the object.
164 	 */
165 	public this()
166 	{
167 		auto p = gtk_style_context_new();
168 		
169 		if(p is null)
170 		{
171 			throw new ConstructionException("null returned by new");
172 		}
173 		
174 		this(cast(GtkStyleContext*) p, true);
175 	}
176 
177 	/**
178 	 * Adds a global style provider to @screen, which will be used
179 	 * in style construction for all #GtkStyleContexts under @screen.
180 	 *
181 	 * GTK+ uses this to make styling information from #GtkSettings
182 	 * available.
183 	 *
184 	 * Note: If both priorities are the same, A #GtkStyleProvider
185 	 * added through gtk_style_context_add_provider() takes precedence
186 	 * over another added through this function.
187 	 *
188 	 * Params:
189 	 *     screen = a #GdkScreen
190 	 *     provider = a #GtkStyleProvider
191 	 *     priority = the priority of the style provider. The lower
192 	 *         it is, the earlier it will be used in the style
193 	 *         construction. Typically this will be in the range
194 	 *         between %GTK_STYLE_PROVIDER_PRIORITY_FALLBACK and
195 	 *         %GTK_STYLE_PROVIDER_PRIORITY_USER
196 	 *
197 	 * Since: 3.0
198 	 */
199 	public static void addProviderForScreen(Screen screen, StyleProviderIF provider, uint priority)
200 	{
201 		gtk_style_context_add_provider_for_screen((screen is null) ? null : screen.getScreenStruct(), (provider is null) ? null : provider.getStyleProviderStruct(), priority);
202 	}
203 
204 	/**
205 	 * Removes @provider from the global style providers list in @screen.
206 	 *
207 	 * Params:
208 	 *     screen = a #GdkScreen
209 	 *     provider = a #GtkStyleProvider
210 	 *
211 	 * Since: 3.0
212 	 */
213 	public static void removeProviderForScreen(Screen screen, StyleProviderIF provider)
214 	{
215 		gtk_style_context_remove_provider_for_screen((screen is null) ? null : screen.getScreenStruct(), (provider is null) ? null : provider.getStyleProviderStruct());
216 	}
217 
218 	/**
219 	 * This function recomputes the styles for all widgets under a particular
220 	 * #GdkScreen. This is useful when some global parameter has changed that
221 	 * affects the appearance of all widgets, because when a widget gets a new
222 	 * style, it will both redraw and recompute any cached information about
223 	 * its appearance. As an example, it is used when the color scheme changes
224 	 * in the related #GtkSettings object.
225 	 *
226 	 * Params:
227 	 *     screen = a #GdkScreen
228 	 *
229 	 * Since: 3.0
230 	 */
231 	public static void resetWidgets(Screen screen)
232 	{
233 		gtk_style_context_reset_widgets((screen is null) ? null : screen.getScreenStruct());
234 	}
235 
236 	/**
237 	 * Adds a style class to @context, so posterior calls to
238 	 * gtk_style_context_get() or any of the gtk_render_*()
239 	 * functions will make use of this new class for styling.
240 	 *
241 	 * In the CSS file format, a #GtkEntry defining a “search”
242 	 * class, would be matched by:
243 	 *
244 	 * |[
245 	 * entry.search { ... }
246 	 * ]|
247 	 *
248 	 * While any widget defining a “search” class would be
249 	 * matched by:
250 	 * |[
251 	 * .search { ... }
252 	 * ]|
253 	 *
254 	 * Params:
255 	 *     className = class name to use in styling
256 	 *
257 	 * Since: 3.0
258 	 */
259 	public void addClass(string className)
260 	{
261 		gtk_style_context_add_class(gtkStyleContext, Str.toStringz(className));
262 	}
263 
264 	/**
265 	 * Adds a style provider to @context, to be used in style construction.
266 	 * Note that a style provider added by this function only affects
267 	 * the style of the widget to which @context belongs. If you want
268 	 * to affect the style of all widgets, use
269 	 * gtk_style_context_add_provider_for_screen().
270 	 *
271 	 * Note: If both priorities are the same, a #GtkStyleProvider
272 	 * added through this function takes precedence over another added
273 	 * through gtk_style_context_add_provider_for_screen().
274 	 *
275 	 * Params:
276 	 *     provider = a #GtkStyleProvider
277 	 *     priority = the priority of the style provider. The lower
278 	 *         it is, the earlier it will be used in the style
279 	 *         construction. Typically this will be in the range
280 	 *         between %GTK_STYLE_PROVIDER_PRIORITY_FALLBACK and
281 	 *         %GTK_STYLE_PROVIDER_PRIORITY_USER
282 	 *
283 	 * Since: 3.0
284 	 */
285 	public void addProvider(StyleProviderIF provider, uint priority)
286 	{
287 		gtk_style_context_add_provider(gtkStyleContext, (provider is null) ? null : provider.getStyleProviderStruct(), priority);
288 	}
289 
290 	/**
291 	 * Adds a region to @context, so posterior calls to
292 	 * gtk_style_context_get() or any of the gtk_render_*()
293 	 * functions will make use of this new region for styling.
294 	 *
295 	 * In the CSS file format, a #GtkTreeView defining a “row”
296 	 * region, would be matched by:
297 	 *
298 	 * |[
299 	 * GtkTreeView row { ... }
300 	 * ]|
301 	 *
302 	 * Pseudo-classes are used for matching @flags, so the two
303 	 * following rules:
304 	 * |[
305 	 * GtkTreeView row:nth-child(even) { ... }
306 	 * GtkTreeView row:nth-child(odd) { ... }
307 	 * ]|
308 	 *
309 	 * would apply to even and odd rows, respectively.
310 	 *
311 	 * Region names must only contain lowercase letters
312 	 * and “-”, starting always with a lowercase letter.
313 	 *
314 	 * Params:
315 	 *     regionName = region name to use in styling
316 	 *     flags = flags that apply to the region
317 	 *
318 	 * Since: 3.0
319 	 */
320 	public void addRegion(string regionName, GtkRegionFlags flags)
321 	{
322 		gtk_style_context_add_region(gtkStyleContext, Str.toStringz(regionName), flags);
323 	}
324 
325 	/**
326 	 * Stops all running animations for @region_id and all animatable
327 	 * regions underneath.
328 	 *
329 	 * A %NULL @region_id will stop all ongoing animations in @context,
330 	 * when dealing with a #GtkStyleContext obtained through
331 	 * gtk_widget_get_style_context(), this is normally done for you
332 	 * in all circumstances you would expect all widget to be stopped,
333 	 * so this should be only used in complex widgets with different
334 	 * animatable regions.
335 	 *
336 	 * Deprecated: This function does nothing.
337 	 *
338 	 * Params:
339 	 *     regionId = animatable region to stop, or %NULL.
340 	 *         See gtk_style_context_push_animatable_region()
341 	 *
342 	 * Since: 3.0
343 	 */
344 	public void cancelAnimations(void* regionId)
345 	{
346 		gtk_style_context_cancel_animations(gtkStyleContext, regionId);
347 	}
348 
349 	/**
350 	 * Gets the background color for a given state.
351 	 *
352 	 * This function is far less useful than it seems, and it should not be used in
353 	 * newly written code. CSS has no concept of "background color", as a background
354 	 * can be an image, or a gradient, or any other pattern including solid colors.
355 	 *
356 	 * The only reason why you would call gtk_style_context_get_background_color() is
357 	 * to use the returned value to draw the background with it; the correct way to
358 	 * achieve this result is to use gtk_render_background() instead, along with CSS
359 	 * style classes to modify the color to be rendered.
360 	 *
361 	 * Deprecated: Use gtk_render_background() instead.
362 	 *
363 	 * Params:
364 	 *     state = state to retrieve the color for
365 	 *     color = return value for the background color
366 	 *
367 	 * Since: 3.0
368 	 */
369 	public void getBackgroundColor(GtkStateFlags state, out RGBA color)
370 	{
371 		GdkRGBA* outcolor = gMalloc!GdkRGBA();
372 		
373 		gtk_style_context_get_background_color(gtkStyleContext, state, outcolor);
374 		
375 		color = ObjectG.getDObject!(RGBA)(outcolor, true);
376 	}
377 
378 	/**
379 	 * Gets the border for a given state as a #GtkBorder.
380 	 *
381 	 * See gtk_style_context_get_property() and
382 	 * #GTK_STYLE_PROPERTY_BORDER_WIDTH for details.
383 	 *
384 	 * Params:
385 	 *     state = state to retrieve the border for
386 	 *     border = return value for the border settings
387 	 *
388 	 * Since: 3.0
389 	 */
390 	public void getBorder(GtkStateFlags state, out Border border)
391 	{
392 		GtkBorder* outborder = gMalloc!GtkBorder();
393 		
394 		gtk_style_context_get_border(gtkStyleContext, state, outborder);
395 		
396 		border = ObjectG.getDObject!(Border)(outborder, true);
397 	}
398 
399 	/**
400 	 * Gets the border color for a given state.
401 	 *
402 	 * Deprecated: Use gtk_render_frame() instead.
403 	 *
404 	 * Params:
405 	 *     state = state to retrieve the color for
406 	 *     color = return value for the border color
407 	 *
408 	 * Since: 3.0
409 	 */
410 	public void getBorderColor(GtkStateFlags state, out RGBA color)
411 	{
412 		GdkRGBA* outcolor = gMalloc!GdkRGBA();
413 		
414 		gtk_style_context_get_border_color(gtkStyleContext, state, outcolor);
415 		
416 		color = ObjectG.getDObject!(RGBA)(outcolor, true);
417 	}
418 
419 	/**
420 	 * Gets the foreground color for a given state.
421 	 *
422 	 * See gtk_style_context_get_property() and
423 	 * #GTK_STYLE_PROPERTY_COLOR for details.
424 	 *
425 	 * Params:
426 	 *     state = state to retrieve the color for
427 	 *     color = return value for the foreground color
428 	 *
429 	 * Since: 3.0
430 	 */
431 	public void getColor(GtkStateFlags state, out RGBA color)
432 	{
433 		GdkRGBA* outcolor = gMalloc!GdkRGBA();
434 		
435 		gtk_style_context_get_color(gtkStyleContext, state, outcolor);
436 		
437 		color = ObjectG.getDObject!(RGBA)(outcolor, true);
438 	}
439 
440 	/**
441 	 * Returns the widget direction used for rendering.
442 	 *
443 	 * Deprecated: Use gtk_style_context_get_state() and
444 	 * check for #GTK_STATE_FLAG_DIR_LTR and
445 	 * #GTK_STATE_FLAG_DIR_RTL instead.
446 	 *
447 	 * Return: the widget direction
448 	 *
449 	 * Since: 3.0
450 	 */
451 	public GtkTextDirection getDirection()
452 	{
453 		return gtk_style_context_get_direction(gtkStyleContext);
454 	}
455 
456 	/**
457 	 * Returns the font description for a given state. The returned
458 	 * object is const and will remain valid until the
459 	 * #GtkStyleContext::changed signal happens.
460 	 *
461 	 * Deprecated: Use gtk_style_context_get() for "font" or
462 	 * subproperties instead.
463 	 *
464 	 * Params:
465 	 *     state = state to retrieve the font for
466 	 *
467 	 * Return: the #PangoFontDescription for the given
468 	 *     state.  This object is owned by GTK+ and should not be
469 	 *     freed.
470 	 *
471 	 * Since: 3.0
472 	 */
473 	public PgFontDescription getFont(GtkStateFlags state)
474 	{
475 		auto p = gtk_style_context_get_font(gtkStyleContext, state);
476 		
477 		if(p is null)
478 		{
479 			return null;
480 		}
481 		
482 		return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p);
483 	}
484 
485 	/**
486 	 * Returns the #GdkFrameClock to which @context is attached.
487 	 *
488 	 * Return: a #GdkFrameClock, or %NULL
489 	 *     if @context does not have an attached frame clock.
490 	 *
491 	 * Since: 3.8
492 	 */
493 	public FrameClock getFrameClock()
494 	{
495 		auto p = gtk_style_context_get_frame_clock(gtkStyleContext);
496 		
497 		if(p is null)
498 		{
499 			return null;
500 		}
501 		
502 		return ObjectG.getDObject!(FrameClock)(cast(GdkFrameClock*) p);
503 	}
504 
505 	/**
506 	 * Returns the sides where rendered elements connect visually with others.
507 	 *
508 	 * Return: the junction sides
509 	 *
510 	 * Since: 3.0
511 	 */
512 	public GtkJunctionSides getJunctionSides()
513 	{
514 		return gtk_style_context_get_junction_sides(gtkStyleContext);
515 	}
516 
517 	/**
518 	 * Gets the margin for a given state as a #GtkBorder.
519 	 * See gtk_style_property_get() and #GTK_STYLE_PROPERTY_MARGIN
520 	 * for details.
521 	 *
522 	 * Params:
523 	 *     state = state to retrieve the border for
524 	 *     margin = return value for the margin settings
525 	 *
526 	 * Since: 3.0
527 	 */
528 	public void getMargin(GtkStateFlags state, out Border margin)
529 	{
530 		GtkBorder* outmargin = gMalloc!GtkBorder();
531 		
532 		gtk_style_context_get_margin(gtkStyleContext, state, outmargin);
533 		
534 		margin = ObjectG.getDObject!(Border)(outmargin, true);
535 	}
536 
537 	/**
538 	 * Gets the padding for a given state as a #GtkBorder.
539 	 * See gtk_style_context_get() and #GTK_STYLE_PROPERTY_PADDING
540 	 * for details.
541 	 *
542 	 * Params:
543 	 *     state = state to retrieve the padding for
544 	 *     padding = return value for the padding settings
545 	 *
546 	 * Since: 3.0
547 	 */
548 	public void getPadding(GtkStateFlags state, out Border padding)
549 	{
550 		GtkBorder* outpadding = gMalloc!GtkBorder();
551 		
552 		gtk_style_context_get_padding(gtkStyleContext, state, outpadding);
553 		
554 		padding = ObjectG.getDObject!(Border)(outpadding, true);
555 	}
556 
557 	/**
558 	 * Gets the parent context set via gtk_style_context_set_parent().
559 	 * See that function for details.
560 	 *
561 	 * Return: the parent context or %NULL
562 	 *
563 	 * Since: 3.4
564 	 */
565 	public StyleContext getParent()
566 	{
567 		auto p = gtk_style_context_get_parent(gtkStyleContext);
568 		
569 		if(p is null)
570 		{
571 			return null;
572 		}
573 		
574 		return ObjectG.getDObject!(StyleContext)(cast(GtkStyleContext*) p);
575 	}
576 
577 	/**
578 	 * Returns the widget path used for style matching.
579 	 *
580 	 * Return: A #GtkWidgetPath
581 	 *
582 	 * Since: 3.0
583 	 */
584 	public WidgetPath getPath()
585 	{
586 		auto p = gtk_style_context_get_path(gtkStyleContext);
587 		
588 		if(p is null)
589 		{
590 			return null;
591 		}
592 		
593 		return ObjectG.getDObject!(WidgetPath)(cast(GtkWidgetPath*) p);
594 	}
595 
596 	/**
597 	 * Gets a style property from @context for the given state.
598 	 *
599 	 * Note that not all CSS properties that are supported by GTK+ can be
600 	 * retrieved in this way, since they may not be representable as #GValue.
601 	 * GTK+ defines macros for a number of properties that can be used
602 	 * with this function.
603 	 *
604 	 * Note that passing a state other than the current state of @context
605 	 * is not recommended unless the style context has been saved with
606 	 * gtk_style_context_save().
607 	 *
608 	 * When @value is no longer needed, g_value_unset() must be called
609 	 * to free any allocated memory.
610 	 *
611 	 * Params:
612 	 *     property = style property name
613 	 *     state = state to retrieve the property value for
614 	 *     value = return location for the style property value
615 	 *
616 	 * Since: 3.0
617 	 */
618 	public void getProperty(string property, GtkStateFlags state, out Value value)
619 	{
620 		GValue* outvalue = gMalloc!GValue();
621 		
622 		gtk_style_context_get_property(gtkStyleContext, Str.toStringz(property), state, outvalue);
623 		
624 		value = ObjectG.getDObject!(Value)(outvalue, true);
625 	}
626 
627 	/**
628 	 * Returns the scale used for assets.
629 	 *
630 	 * Return: the scale
631 	 *
632 	 * Since: 3.10
633 	 */
634 	public int getScale()
635 	{
636 		return gtk_style_context_get_scale(gtkStyleContext);
637 	}
638 
639 	/**
640 	 * Returns the #GdkScreen to which @context is attached.
641 	 *
642 	 * Return: a #GdkScreen.
643 	 */
644 	public Screen getScreen()
645 	{
646 		auto p = gtk_style_context_get_screen(gtkStyleContext);
647 		
648 		if(p is null)
649 		{
650 			return null;
651 		}
652 		
653 		return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p);
654 	}
655 
656 	/**
657 	 * Queries the location in the CSS where @property was defined for the
658 	 * current @context. Note that the state to be queried is taken from
659 	 * gtk_style_context_get_state().
660 	 *
661 	 * If the location is not available, %NULL will be returned. The
662 	 * location might not be available for various reasons, such as the
663 	 * property being overridden, @property not naming a supported CSS
664 	 * property or tracking of definitions being disabled for performance
665 	 * reasons.
666 	 *
667 	 * Shorthand CSS properties cannot be queried for a location and will
668 	 * always return %NULL.
669 	 *
670 	 * Params:
671 	 *     property = style property name
672 	 *
673 	 * Return: %NULL or the section where a value
674 	 *     for @property was defined
675 	 */
676 	public CssSection getSection(string property)
677 	{
678 		auto p = gtk_style_context_get_section(gtkStyleContext, Str.toStringz(property));
679 		
680 		if(p is null)
681 		{
682 			return null;
683 		}
684 		
685 		return ObjectG.getDObject!(CssSection)(cast(GtkCssSection*) p);
686 	}
687 
688 	/**
689 	 * Returns the state used for style matching.
690 	 *
691 	 * This method should only be used to retrieve the #GtkStateFlags
692 	 * to pass to #GtkStyleContext methods, like gtk_style_context_get_padding().
693 	 * If you need to retrieve the current state of a #GtkWidget, use
694 	 * gtk_widget_get_state_flags().
695 	 *
696 	 * Return: the state flags
697 	 *
698 	 * Since: 3.0
699 	 */
700 	public GtkStateFlags getState()
701 	{
702 		return gtk_style_context_get_state(gtkStyleContext);
703 	}
704 
705 	/**
706 	 * Gets the value for a widget style property.
707 	 *
708 	 * When @value is no longer needed, g_value_unset() must be called
709 	 * to free any allocated memory.
710 	 *
711 	 * Params:
712 	 *     propertyName = the name of the widget style property
713 	 *     value = Return location for the property value
714 	 */
715 	public void getStyleProperty(string propertyName, Value value)
716 	{
717 		gtk_style_context_get_style_property(gtkStyleContext, Str.toStringz(propertyName), (value is null) ? null : value.getValueStruct());
718 	}
719 
720 	/**
721 	 * Retrieves several widget style properties from @context according to the
722 	 * current style.
723 	 *
724 	 * Params:
725 	 *     args = va_list of property name/return location pairs, followed by %NULL
726 	 *
727 	 * Since: 3.0
728 	 */
729 	public void getStyleValist(void* args)
730 	{
731 		gtk_style_context_get_style_valist(gtkStyleContext, args);
732 	}
733 
734 	/**
735 	 * Retrieves several style property values from @context for a given state.
736 	 *
737 	 * See gtk_style_context_get_property() for details.
738 	 *
739 	 * Params:
740 	 *     state = state to retrieve the property values for
741 	 *     args = va_list of property name/return location pairs, followed by %NULL
742 	 *
743 	 * Since: 3.0
744 	 */
745 	public void getValist(GtkStateFlags state, void* args)
746 	{
747 		gtk_style_context_get_valist(gtkStyleContext, state, args);
748 	}
749 
750 	/**
751 	 * Returns %TRUE if @context currently has defined the
752 	 * given class name.
753 	 *
754 	 * Params:
755 	 *     className = a class name
756 	 *
757 	 * Return: %TRUE if @context has @class_name defined
758 	 *
759 	 * Since: 3.0
760 	 */
761 	public bool hasClass(string className)
762 	{
763 		return gtk_style_context_has_class(gtkStyleContext, Str.toStringz(className)) != 0;
764 	}
765 
766 	/**
767 	 * Returns %TRUE if @context has the region defined.
768 	 * If @flags_return is not %NULL, it is set to the flags
769 	 * affecting the region.
770 	 *
771 	 * Params:
772 	 *     regionName = a region name
773 	 *     flagsReturn = return location for region flags
774 	 *
775 	 * Return: %TRUE if region is defined
776 	 *
777 	 * Since: 3.0
778 	 */
779 	public bool hasRegion(string regionName, out GtkRegionFlags flagsReturn)
780 	{
781 		return gtk_style_context_has_region(gtkStyleContext, Str.toStringz(regionName), &flagsReturn) != 0;
782 	}
783 
784 	/**
785 	 * Invalidates @context style information, so it will be reconstructed
786 	 * again. It is useful if you modify the @context and need the new
787 	 * information immediately.
788 	 *
789 	 * Deprecated: Style contexts are invalidated automatically.
790 	 *
791 	 * Since: 3.0
792 	 */
793 	public void invalidate()
794 	{
795 		gtk_style_context_invalidate(gtkStyleContext);
796 	}
797 
798 	/**
799 	 * Returns the list of classes currently defined in @context.
800 	 *
801 	 * Return: a #GList of
802 	 *     strings with the currently defined classes. The contents
803 	 *     of the list are owned by GTK+, but you must free the list
804 	 *     itself with g_list_free() when you are done with it.
805 	 *
806 	 * Since: 3.0
807 	 */
808 	public ListG listClasses()
809 	{
810 		auto p = gtk_style_context_list_classes(gtkStyleContext);
811 		
812 		if(p is null)
813 		{
814 			return null;
815 		}
816 		
817 		return new ListG(cast(GList*) p);
818 	}
819 
820 	/**
821 	 * Returns the list of regions currently defined in @context.
822 	 *
823 	 * Return: a #GList of
824 	 *     strings with the currently defined regions. The contents
825 	 *     of the list are owned by GTK+, but you must free the list
826 	 *     itself with g_list_free() when you are done with it.
827 	 *
828 	 * Since: 3.0
829 	 */
830 	public ListG listRegions()
831 	{
832 		auto p = gtk_style_context_list_regions(gtkStyleContext);
833 		
834 		if(p is null)
835 		{
836 			return null;
837 		}
838 		
839 		return new ListG(cast(GList*) p);
840 	}
841 
842 	/**
843 	 * Looks up and resolves a color name in the @context color map.
844 	 *
845 	 * Params:
846 	 *     colorName = color name to lookup
847 	 *     color = Return location for the looked up color
848 	 *
849 	 * Return: %TRUE if @color_name was found and resolved, %FALSE otherwise
850 	 */
851 	public bool lookupColor(string colorName, out RGBA color)
852 	{
853 		GdkRGBA* outcolor = gMalloc!GdkRGBA();
854 		
855 		auto p = gtk_style_context_lookup_color(gtkStyleContext, Str.toStringz(colorName), outcolor) != 0;
856 		
857 		color = ObjectG.getDObject!(RGBA)(outcolor, true);
858 		
859 		return p;
860 	}
861 
862 	/**
863 	 * Looks up @stock_id in the icon factories associated to @context and
864 	 * the default icon factory, returning an icon set if found, otherwise
865 	 * %NULL.
866 	 *
867 	 * Deprecated: Use gtk_icon_theme_lookup_icon() instead.
868 	 *
869 	 * Params:
870 	 *     stockId = an icon name
871 	 *
872 	 * Return: The looked up %GtkIconSet, or %NULL
873 	 */
874 	public IconSet lookupIconSet(string stockId)
875 	{
876 		auto p = gtk_style_context_lookup_icon_set(gtkStyleContext, Str.toStringz(stockId));
877 		
878 		if(p is null)
879 		{
880 			return null;
881 		}
882 		
883 		return ObjectG.getDObject!(IconSet)(cast(GtkIconSet*) p);
884 	}
885 
886 	/**
887 	 * Notifies a state change on @context, so if the current style makes use
888 	 * of transition animations, one will be started so all rendered elements
889 	 * under @region_id are animated for state @state being set to value
890 	 * @state_value.
891 	 *
892 	 * The @window parameter is used in order to invalidate the rendered area
893 	 * as the animation runs, so make sure it is the same window that is being
894 	 * rendered on by the gtk_render_*() functions.
895 	 *
896 	 * If @region_id is %NULL, all rendered elements using @context will be
897 	 * affected by this state transition.
898 	 *
899 	 * As a practical example, a #GtkButton notifying a state transition on
900 	 * the prelight state:
901 	 * |[<!-- language="C" -->
902 	 * gtk_style_context_notify_state_change (context,
903 	 * gtk_widget_get_window (widget),
904 	 * NULL,
905 	 * GTK_STATE_PRELIGHT,
906 	 * button->in_button);
907 	 * ]|
908 	 *
909 	 * Can be handled in the CSS file like this:
910 	 * |[
911 	 * GtkButton {
912 	 * background-color: #f00
913 	 * }
914 	 *
915 	 * GtkButton:hover {
916 	 * background-color: #fff;
917 	 * transition: 200ms linear
918 	 * }
919 	 * ]|
920 	 *
921 	 * This combination will animate the button background from red to white
922 	 * if a pointer enters the button, and back to red if the pointer leaves
923 	 * the button.
924 	 *
925 	 * Note that @state is used when finding the transition parameters, which
926 	 * is why the style places the transition under the :hover pseudo-class.
927 	 *
928 	 * Deprecated: This function does nothing.
929 	 *
930 	 * Params:
931 	 *     window = a #GdkWindow
932 	 *     regionId = animatable region to notify on, or %NULL.
933 	 *         See gtk_style_context_push_animatable_region()
934 	 *     state = state to trigger transition for
935 	 *     stateValue = %TRUE if @state is the state we are changing to,
936 	 *         %FALSE if we are changing away from it
937 	 *
938 	 * Since: 3.0
939 	 */
940 	public void notifyStateChange(Window window, void* regionId, GtkStateType state, bool stateValue)
941 	{
942 		gtk_style_context_notify_state_change(gtkStyleContext, (window is null) ? null : window.getWindowStruct(), regionId, state, stateValue);
943 	}
944 
945 	/**
946 	 * Pops an animatable region from @context.
947 	 * See gtk_style_context_push_animatable_region().
948 	 *
949 	 * Deprecated: This function does nothing.
950 	 *
951 	 * Since: 3.0
952 	 */
953 	public void popAnimatableRegion()
954 	{
955 		gtk_style_context_pop_animatable_region(gtkStyleContext);
956 	}
957 
958 	/**
959 	 * Pushes an animatable region, so all further gtk_render_*() calls between
960 	 * this call and the following gtk_style_context_pop_animatable_region()
961 	 * will potentially show transition animations for this region if
962 	 * gtk_style_context_notify_state_change() is called for a given state,
963 	 * and the current theme/style defines transition animations for state
964 	 * changes.
965 	 *
966 	 * The @region_id used must be unique in @context so the themes
967 	 * can uniquely identify rendered elements subject to a state transition.
968 	 *
969 	 * Deprecated: This function does nothing.
970 	 *
971 	 * Params:
972 	 *     regionId = unique identifier for the animatable region
973 	 *
974 	 * Since: 3.0
975 	 */
976 	public void pushAnimatableRegion(void* regionId)
977 	{
978 		gtk_style_context_push_animatable_region(gtkStyleContext, regionId);
979 	}
980 
981 	/**
982 	 * Removes @class_name from @context.
983 	 *
984 	 * Params:
985 	 *     className = class name to remove
986 	 *
987 	 * Since: 3.0
988 	 */
989 	public void removeClass(string className)
990 	{
991 		gtk_style_context_remove_class(gtkStyleContext, Str.toStringz(className));
992 	}
993 
994 	/**
995 	 * Removes @provider from the style providers list in @context.
996 	 *
997 	 * Params:
998 	 *     provider = a #GtkStyleProvider
999 	 *
1000 	 * Since: 3.0
1001 	 */
1002 	public void removeProvider(StyleProviderIF provider)
1003 	{
1004 		gtk_style_context_remove_provider(gtkStyleContext, (provider is null) ? null : provider.getStyleProviderStruct());
1005 	}
1006 
1007 	/**
1008 	 * Removes a region from @context.
1009 	 *
1010 	 * Params:
1011 	 *     regionName = region name to unset
1012 	 *
1013 	 * Since: 3.0
1014 	 */
1015 	public void removeRegion(string regionName)
1016 	{
1017 		gtk_style_context_remove_region(gtkStyleContext, Str.toStringz(regionName));
1018 	}
1019 
1020 	/**
1021 	 * Restores @context state to a previous stage.
1022 	 * See gtk_style_context_save().
1023 	 *
1024 	 * Since: 3.0
1025 	 */
1026 	public void restore()
1027 	{
1028 		gtk_style_context_restore(gtkStyleContext);
1029 	}
1030 
1031 	/**
1032 	 * Saves the @context state, so temporary modifications done through
1033 	 * gtk_style_context_add_class(), gtk_style_context_remove_class(),
1034 	 * gtk_style_context_set_state(), etc. can quickly be reverted
1035 	 * in one go through gtk_style_context_restore().
1036 	 *
1037 	 * The matching call to gtk_style_context_restore() must be done
1038 	 * before GTK returns to the main loop.
1039 	 *
1040 	 * Since: 3.0
1041 	 */
1042 	public void save()
1043 	{
1044 		gtk_style_context_save(gtkStyleContext);
1045 	}
1046 
1047 	/**
1048 	 * This function is analogous to gdk_window_scroll(), and
1049 	 * should be called together with it so the invalidation
1050 	 * areas for any ongoing animation are scrolled together
1051 	 * with it.
1052 	 *
1053 	 * Deprecated: This function does nothing.
1054 	 *
1055 	 * Params:
1056 	 *     window = a #GdkWindow used previously in
1057 	 *         gtk_style_context_notify_state_change()
1058 	 *     dx = Amount to scroll in the X axis
1059 	 *     dy = Amount to scroll in the Y axis
1060 	 *
1061 	 * Since: 3.0
1062 	 */
1063 	public void scrollAnimations(Window window, int dx, int dy)
1064 	{
1065 		gtk_style_context_scroll_animations(gtkStyleContext, (window is null) ? null : window.getWindowStruct(), dx, dy);
1066 	}
1067 
1068 	/**
1069 	 * Sets the background of @window to the background pattern or
1070 	 * color specified in @context for its current state.
1071 	 *
1072 	 * Deprecated: Use gtk_render_background() instead.
1073 	 * Note that clients still using this function are now responsible
1074 	 * for calling this function again whenever @context is invalidated.
1075 	 *
1076 	 * Params:
1077 	 *     window = a #GdkWindow
1078 	 *
1079 	 * Since: 3.0
1080 	 */
1081 	public void setBackground(Window window)
1082 	{
1083 		gtk_style_context_set_background(gtkStyleContext, (window is null) ? null : window.getWindowStruct());
1084 	}
1085 
1086 	/**
1087 	 * Sets the reading direction for rendering purposes.
1088 	 *
1089 	 * If you are using a #GtkStyleContext returned from
1090 	 * gtk_widget_get_style_context(), you do not need to
1091 	 * call this yourself.
1092 	 *
1093 	 * Deprecated: Use gtk_style_context_set_state() with
1094 	 * #GTK_STATE_FLAG_DIR_LTR and #GTK_STATE_FLAG_DIR_RTL
1095 	 * instead.
1096 	 *
1097 	 * Params:
1098 	 *     direction = the new direction.
1099 	 *
1100 	 * Since: 3.0
1101 	 */
1102 	public void setDirection(GtkTextDirection direction)
1103 	{
1104 		gtk_style_context_set_direction(gtkStyleContext, direction);
1105 	}
1106 
1107 	/**
1108 	 * Attaches @context to the given frame clock.
1109 	 *
1110 	 * The frame clock is used for the timing of animations.
1111 	 *
1112 	 * If you are using a #GtkStyleContext returned from
1113 	 * gtk_widget_get_style_context(), you do not need to
1114 	 * call this yourself.
1115 	 *
1116 	 * Params:
1117 	 *     frameClock = a #GdkFrameClock
1118 	 *
1119 	 * Since: 3.8
1120 	 */
1121 	public void setFrameClock(FrameClock frameClock)
1122 	{
1123 		gtk_style_context_set_frame_clock(gtkStyleContext, (frameClock is null) ? null : frameClock.getFrameClockStruct());
1124 	}
1125 
1126 	/**
1127 	 * Sets the sides where rendered elements (mostly through
1128 	 * gtk_render_frame()) will visually connect with other visual elements.
1129 	 *
1130 	 * This is merely a hint that may or may not be honored
1131 	 * by themes.
1132 	 *
1133 	 * Container widgets are expected to set junction hints as appropriate
1134 	 * for their children, so it should not normally be necessary to call
1135 	 * this function manually.
1136 	 *
1137 	 * Params:
1138 	 *     sides = sides where rendered elements are visually connected to
1139 	 *         other elements
1140 	 *
1141 	 * Since: 3.0
1142 	 */
1143 	public void setJunctionSides(GtkJunctionSides sides)
1144 	{
1145 		gtk_style_context_set_junction_sides(gtkStyleContext, sides);
1146 	}
1147 
1148 	/**
1149 	 * Sets the parent style context for @context. The parent style
1150 	 * context is used to implement
1151 	 * [inheritance](http://www.w3.org/TR/css3-cascade/#inheritance)
1152 	 * of properties.
1153 	 *
1154 	 * If you are using a #GtkStyleContext returned from
1155 	 * gtk_widget_get_style_context(), the parent will be set for you.
1156 	 *
1157 	 * Params:
1158 	 *     parent = the new parent or %NULL
1159 	 *
1160 	 * Since: 3.4
1161 	 */
1162 	public void setParent(StyleContext parent)
1163 	{
1164 		gtk_style_context_set_parent(gtkStyleContext, (parent is null) ? null : parent.getStyleContextStruct());
1165 	}
1166 
1167 	/**
1168 	 * Sets the #GtkWidgetPath used for style matching. As a
1169 	 * consequence, the style will be regenerated to match
1170 	 * the new given path.
1171 	 *
1172 	 * If you are using a #GtkStyleContext returned from
1173 	 * gtk_widget_get_style_context(), you do not need to call
1174 	 * this yourself.
1175 	 *
1176 	 * Params:
1177 	 *     path = a #GtkWidgetPath
1178 	 *
1179 	 * Since: 3.0
1180 	 */
1181 	public void setPath(WidgetPath path)
1182 	{
1183 		gtk_style_context_set_path(gtkStyleContext, (path is null) ? null : path.getWidgetPathStruct());
1184 	}
1185 
1186 	/**
1187 	 * Sets the scale to use when getting image assets for the style.
1188 	 *
1189 	 * Params:
1190 	 *     scale = scale
1191 	 *
1192 	 * Since: 3.10
1193 	 */
1194 	public void setScale(int scale)
1195 	{
1196 		gtk_style_context_set_scale(gtkStyleContext, scale);
1197 	}
1198 
1199 	/**
1200 	 * Attaches @context to the given screen.
1201 	 *
1202 	 * The screen is used to add style information from “global” style
1203 	 * providers, such as the screens #GtkSettings instance.
1204 	 *
1205 	 * If you are using a #GtkStyleContext returned from
1206 	 * gtk_widget_get_style_context(), you do not need to
1207 	 * call this yourself.
1208 	 *
1209 	 * Params:
1210 	 *     screen = a #GdkScreen
1211 	 *
1212 	 * Since: 3.0
1213 	 */
1214 	public void setScreen(Screen screen)
1215 	{
1216 		gtk_style_context_set_screen(gtkStyleContext, (screen is null) ? null : screen.getScreenStruct());
1217 	}
1218 
1219 	/**
1220 	 * Sets the state to be used for style matching.
1221 	 *
1222 	 * Params:
1223 	 *     flags = state to represent
1224 	 *
1225 	 * Since: 3.0
1226 	 */
1227 	public void setState(GtkStateFlags flags)
1228 	{
1229 		gtk_style_context_set_state(gtkStyleContext, flags);
1230 	}
1231 
1232 	/**
1233 	 * Returns %TRUE if there is a transition animation running for the
1234 	 * current region (see gtk_style_context_push_animatable_region()).
1235 	 *
1236 	 * If @progress is not %NULL, the animation progress will be returned
1237 	 * there, 0.0 means the state is closest to being unset, while 1.0 means
1238 	 * it’s closest to being set. This means transition animation will
1239 	 * run from 0 to 1 when @state is being set and from 1 to 0 when
1240 	 * it’s being unset.
1241 	 *
1242 	 * Deprecated: This function always returns %FALSE
1243 	 *
1244 	 * Params:
1245 	 *     state = a widget state
1246 	 *     progress = return location for the transition progress
1247 	 *
1248 	 * Return: %TRUE if there is a running transition animation for @state.
1249 	 *
1250 	 * Since: 3.0
1251 	 */
1252 	public bool stateIsRunning(GtkStateType state, out double progress)
1253 	{
1254 		return gtk_style_context_state_is_running(gtkStyleContext, state, &progress) != 0;
1255 	}
1256 
1257 	/**
1258 	 * Converts the style context into a string representation.
1259 	 *
1260 	 * The string representation always includes information about
1261 	 * the name, state, id, visibility and style classes of the CSS
1262 	 * node that is backing @context. Depending on the flags, more
1263 	 * information may be included.
1264 	 *
1265 	 * This function is intended for testing and debugging of the
1266 	 * CSS implementation in GTK+. There are no guarantees about
1267 	 * the format of the returned string, it may change.
1268 	 *
1269 	 * Params:
1270 	 *     flags = Flags that determine what to print
1271 	 *
1272 	 * Return: a newly allocated string representing @context
1273 	 *
1274 	 * Since: 3.20
1275 	 */
1276 	public string toString(GtkStyleContextPrintFlags flags)
1277 	{
1278 		auto retStr = gtk_style_context_to_string(gtkStyleContext, flags);
1279 		
1280 		scope(exit) Str.freeString(retStr);
1281 		return Str.toString(retStr);
1282 	}
1283 
1284 	protected class OnChangedDelegateWrapper
1285 	{
1286 		void delegate(StyleContext) dlg;
1287 		gulong handlerId;
1288 		ConnectFlags flags;
1289 		this(void delegate(StyleContext) dlg, gulong handlerId, ConnectFlags flags)
1290 		{
1291 			this.dlg = dlg;
1292 			this.handlerId = handlerId;
1293 			this.flags = flags;
1294 		}
1295 	}
1296 	protected OnChangedDelegateWrapper[] onChangedListeners;
1297 
1298 	/**
1299 	 * The ::changed signal is emitted when there is a change in the
1300 	 * #GtkStyleContext.
1301 	 *
1302 	 * For a #GtkStyleContext returned by gtk_widget_get_style_context(), the
1303 	 * #GtkWidget::style-updated signal/vfunc might be more convenient to use.
1304 	 *
1305 	 * This signal is useful when using the theming layer standalone.
1306 	 *
1307 	 * Since: 3.0
1308 	 */
1309 	gulong addOnChanged(void delegate(StyleContext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
1310 	{
1311 		onChangedListeners ~= new OnChangedDelegateWrapper(dlg, 0, connectFlags);
1312 		onChangedListeners[onChangedListeners.length - 1].handlerId = Signals.connectData(
1313 			this,
1314 			"changed",
1315 			cast(GCallback)&callBackChanged,
1316 			cast(void*)onChangedListeners[onChangedListeners.length - 1],
1317 			cast(GClosureNotify)&callBackChangedDestroy,
1318 			connectFlags);
1319 		return onChangedListeners[onChangedListeners.length - 1].handlerId;
1320 	}
1321 	
1322 	extern(C) static void callBackChanged(GtkStyleContext* stylecontextStruct,OnChangedDelegateWrapper wrapper)
1323 	{
1324 		wrapper.dlg(wrapper.outer);
1325 	}
1326 	
1327 	extern(C) static void callBackChangedDestroy(OnChangedDelegateWrapper wrapper, GClosure* closure)
1328 	{
1329 		wrapper.outer.internalRemoveOnChanged(wrapper);
1330 	}
1331 
1332 	protected void internalRemoveOnChanged(OnChangedDelegateWrapper source)
1333 	{
1334 		foreach(index, wrapper; onChangedListeners)
1335 		{
1336 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
1337 			{
1338 				onChangedListeners[index] = null;
1339 				onChangedListeners = std.algorithm.remove(onChangedListeners, index);
1340 				break;
1341 			}
1342 		}
1343 	}
1344 	
1345 
1346 	/**
1347 	 * Renders an activity indicator (such as in #GtkSpinner).
1348 	 * The state %GTK_STATE_FLAG_CHECKED determines whether there is
1349 	 * activity going on.
1350 	 *
1351 	 * Params:
1352 	 *     context = a #GtkStyleContext
1353 	 *     cr = a #cairo_t
1354 	 *     x = X origin of the rectangle
1355 	 *     y = Y origin of the rectangle
1356 	 *     width = rectangle width
1357 	 *     height = rectangle height
1358 	 *
1359 	 * Since: 3.0
1360 	 */
1361 	public static void renderActivity(StyleContext context, Context cr, double x, double y, double width, double height)
1362 	{
1363 		gtk_render_activity((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), x, y, width, height);
1364 	}
1365 
1366 	/**
1367 	 * Renders an arrow pointing to @angle.
1368 	 *
1369 	 * Typical arrow rendering at 0, 1⁄2 π;, π; and 3⁄2 π:
1370 	 *
1371 	 * ![](arrows.png)
1372 	 *
1373 	 * Params:
1374 	 *     context = a #GtkStyleContext
1375 	 *     cr = a #cairo_t
1376 	 *     angle = arrow angle from 0 to 2 * %G_PI, being 0 the arrow pointing to the north
1377 	 *     x = X origin of the render area
1378 	 *     y = Y origin of the render area
1379 	 *     size = square side for render area
1380 	 *
1381 	 * Since: 3.0
1382 	 */
1383 	public static void renderArrow(StyleContext context, Context cr, double angle, double x, double y, double size)
1384 	{
1385 		gtk_render_arrow((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), angle, x, y, size);
1386 	}
1387 
1388 	/**
1389 	 * Renders the background of an element.
1390 	 *
1391 	 * Typical background rendering, showing the effect of
1392 	 * `background-image`, `border-width` and `border-radius`:
1393 	 *
1394 	 * ![](background.png)
1395 	 *
1396 	 * Params:
1397 	 *     context = a #GtkStyleContext
1398 	 *     cr = a #cairo_t
1399 	 *     x = X origin of the rectangle
1400 	 *     y = Y origin of the rectangle
1401 	 *     width = rectangle width
1402 	 *     height = rectangle height
1403 	 *
1404 	 * Since: 3.0.
1405 	 */
1406 	public static void renderBackground(StyleContext context, Context cr, double x, double y, double width, double height)
1407 	{
1408 		gtk_render_background((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), x, y, width, height);
1409 	}
1410 
1411 	/**
1412 	 * Returns the area that will be affected (i.e. drawn to) when
1413 	 * calling gtk_render_background() for the given @context and
1414 	 * rectangle.
1415 	 *
1416 	 * Params:
1417 	 *     context = a #GtkStyleContext
1418 	 *     x = X origin of the rectangle
1419 	 *     y = Y origin of the rectangle
1420 	 *     width = rectangle width
1421 	 *     height = rectangle height
1422 	 *     outClip = return location for the clip
1423 	 *
1424 	 * Since: 3.20
1425 	 */
1426 	public static void renderBackgroundGetClip(StyleContext context, double x, double y, double width, double height, out GdkRectangle outClip)
1427 	{
1428 		gtk_render_background_get_clip((context is null) ? null : context.getStyleContextStruct(), x, y, width, height, &outClip);
1429 	}
1430 
1431 	/**
1432 	 * Renders a checkmark (as in a #GtkCheckButton).
1433 	 *
1434 	 * The %GTK_STATE_FLAG_CHECKED state determines whether the check is
1435 	 * on or off, and %GTK_STATE_FLAG_INCONSISTENT determines whether it
1436 	 * should be marked as undefined.
1437 	 *
1438 	 * Typical checkmark rendering:
1439 	 *
1440 	 * ![](checks.png)
1441 	 *
1442 	 * Params:
1443 	 *     context = a #GtkStyleContext
1444 	 *     cr = a #cairo_t
1445 	 *     x = X origin of the rectangle
1446 	 *     y = Y origin of the rectangle
1447 	 *     width = rectangle width
1448 	 *     height = rectangle height
1449 	 *
1450 	 * Since: 3.0
1451 	 */
1452 	public static void renderCheck(StyleContext context, Context cr, double x, double y, double width, double height)
1453 	{
1454 		gtk_render_check((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), x, y, width, height);
1455 	}
1456 
1457 	/**
1458 	 * Renders an expander (as used in #GtkTreeView and #GtkExpander) in the area
1459 	 * defined by @x, @y, @width, @height. The state %GTK_STATE_FLAG_CHECKED
1460 	 * determines whether the expander is collapsed or expanded.
1461 	 *
1462 	 * Typical expander rendering:
1463 	 *
1464 	 * ![](expanders.png)
1465 	 *
1466 	 * Params:
1467 	 *     context = a #GtkStyleContext
1468 	 *     cr = a #cairo_t
1469 	 *     x = X origin of the rectangle
1470 	 *     y = Y origin of the rectangle
1471 	 *     width = rectangle width
1472 	 *     height = rectangle height
1473 	 *
1474 	 * Since: 3.0
1475 	 */
1476 	public static void renderExpander(StyleContext context, Context cr, double x, double y, double width, double height)
1477 	{
1478 		gtk_render_expander((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), x, y, width, height);
1479 	}
1480 
1481 	/**
1482 	 * Renders a extension (as in a #GtkNotebook tab) in the rectangle
1483 	 * defined by @x, @y, @width, @height. The side where the extension
1484 	 * connects to is defined by @gap_side.
1485 	 *
1486 	 * Typical extension rendering:
1487 	 *
1488 	 * ![](extensions.png)
1489 	 *
1490 	 * Params:
1491 	 *     context = a #GtkStyleContext
1492 	 *     cr = a #cairo_t
1493 	 *     x = X origin of the rectangle
1494 	 *     y = Y origin of the rectangle
1495 	 *     width = rectangle width
1496 	 *     height = rectangle height
1497 	 *     gapSide = side where the gap is
1498 	 *
1499 	 * Since: 3.0
1500 	 */
1501 	public static void renderExtension(StyleContext context, Context cr, double x, double y, double width, double height, GtkPositionType gapSide)
1502 	{
1503 		gtk_render_extension((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), x, y, width, height, gapSide);
1504 	}
1505 
1506 	/**
1507 	 * Renders a focus indicator on the rectangle determined by @x, @y, @width, @height.
1508 	 *
1509 	 * Typical focus rendering:
1510 	 *
1511 	 * ![](focus.png)
1512 	 *
1513 	 * Params:
1514 	 *     context = a #GtkStyleContext
1515 	 *     cr = a #cairo_t
1516 	 *     x = X origin of the rectangle
1517 	 *     y = Y origin of the rectangle
1518 	 *     width = rectangle width
1519 	 *     height = rectangle height
1520 	 *
1521 	 * Since: 3.0
1522 	 */
1523 	public static void renderFocus(StyleContext context, Context cr, double x, double y, double width, double height)
1524 	{
1525 		gtk_render_focus((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), x, y, width, height);
1526 	}
1527 
1528 	/**
1529 	 * Renders a frame around the rectangle defined by @x, @y, @width, @height.
1530 	 *
1531 	 * Examples of frame rendering, showing the effect of `border-image`,
1532 	 * `border-color`, `border-width`, `border-radius` and junctions:
1533 	 *
1534 	 * ![](frames.png)
1535 	 *
1536 	 * Params:
1537 	 *     context = a #GtkStyleContext
1538 	 *     cr = a #cairo_t
1539 	 *     x = X origin of the rectangle
1540 	 *     y = Y origin of the rectangle
1541 	 *     width = rectangle width
1542 	 *     height = rectangle height
1543 	 *
1544 	 * Since: 3.0
1545 	 */
1546 	public static void renderFrame(StyleContext context, Context cr, double x, double y, double width, double height)
1547 	{
1548 		gtk_render_frame((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), x, y, width, height);
1549 	}
1550 
1551 	/**
1552 	 * Renders a frame around the rectangle defined by (@x, @y, @width, @height),
1553 	 * leaving a gap on one side. @xy0_gap and @xy1_gap will mean X coordinates
1554 	 * for %GTK_POS_TOP and %GTK_POS_BOTTOM gap sides, and Y coordinates for
1555 	 * %GTK_POS_LEFT and %GTK_POS_RIGHT.
1556 	 *
1557 	 * Typical rendering of a frame with a gap:
1558 	 *
1559 	 * ![](frame-gap.png)
1560 	 *
1561 	 * Params:
1562 	 *     context = a #GtkStyleContext
1563 	 *     cr = a #cairo_t
1564 	 *     x = X origin of the rectangle
1565 	 *     y = Y origin of the rectangle
1566 	 *     width = rectangle width
1567 	 *     height = rectangle height
1568 	 *     gapSide = side where the gap is
1569 	 *     xy0Gap = initial coordinate (X or Y depending on @gap_side) for the gap
1570 	 *     xy1Gap = end coordinate (X or Y depending on @gap_side) for the gap
1571 	 *
1572 	 * Since: 3.0
1573 	 */
1574 	public static void renderFrameGap(StyleContext context, Context cr, double x, double y, double width, double height, GtkPositionType gapSide, double xy0Gap, double xy1Gap)
1575 	{
1576 		gtk_render_frame_gap((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), x, y, width, height, gapSide, xy0Gap, xy1Gap);
1577 	}
1578 
1579 	/**
1580 	 * Renders a handle (as in #GtkHandleBox, #GtkPaned and
1581 	 * #GtkWindow’s resize grip), in the rectangle
1582 	 * determined by @x, @y, @width, @height.
1583 	 *
1584 	 * Handles rendered for the paned and grip classes:
1585 	 *
1586 	 * ![](handles.png)
1587 	 *
1588 	 * Params:
1589 	 *     context = a #GtkStyleContext
1590 	 *     cr = a #cairo_t
1591 	 *     x = X origin of the rectangle
1592 	 *     y = Y origin of the rectangle
1593 	 *     width = rectangle width
1594 	 *     height = rectangle height
1595 	 *
1596 	 * Since: 3.0
1597 	 */
1598 	public static void renderHandle(StyleContext context, Context cr, double x, double y, double width, double height)
1599 	{
1600 		gtk_render_handle((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), x, y, width, height);
1601 	}
1602 
1603 	/**
1604 	 * Renders the icon in @pixbuf at the specified @x and @y coordinates.
1605 	 *
1606 	 * This function will render the icon in @pixbuf at exactly its size,
1607 	 * regardless of scaling factors, which may not be appropriate when
1608 	 * drawing on displays with high pixel densities.
1609 	 *
1610 	 * You probably want to use gtk_render_icon_surface() instead, if you
1611 	 * already have a Cairo surface.
1612 	 *
1613 	 * Params:
1614 	 *     context = a #GtkStyleContext
1615 	 *     cr = a #cairo_t
1616 	 *     pixbuf = a #GdkPixbuf containing the icon to draw
1617 	 *     x = X position for the @pixbuf
1618 	 *     y = Y position for the @pixbuf
1619 	 *
1620 	 * Since: 3.2
1621 	 */
1622 	public static void renderIcon(StyleContext context, Context cr, Pixbuf pixbuf, double x, double y)
1623 	{
1624 		gtk_render_icon((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), (pixbuf is null) ? null : pixbuf.getPixbufStruct(), x, y);
1625 	}
1626 
1627 	/**
1628 	 * Renders the icon specified by @source at the given @size, returning the result
1629 	 * in a pixbuf.
1630 	 *
1631 	 * Deprecated: Use gtk_icon_theme_load_icon() instead.
1632 	 *
1633 	 * Params:
1634 	 *     context = a #GtkStyleContext
1635 	 *     source = the #GtkIconSource specifying the icon to render
1636 	 *     size = the size (#GtkIconSize) to render the icon at.
1637 	 *         A size of `(GtkIconSize) -1` means render at the size of the source
1638 	 *         and don’t scale.
1639 	 *
1640 	 * Return: a newly-created #GdkPixbuf containing the rendered icon
1641 	 *
1642 	 * Since: 3.0
1643 	 */
1644 	public static Pixbuf renderIconPixbuf(StyleContext context, IconSource source, GtkIconSize size)
1645 	{
1646 		auto p = gtk_render_icon_pixbuf((context is null) ? null : context.getStyleContextStruct(), (source is null) ? null : source.getIconSourceStruct(), size);
1647 		
1648 		if(p is null)
1649 		{
1650 			return null;
1651 		}
1652 		
1653 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true);
1654 	}
1655 
1656 	/**
1657 	 * Renders the icon in @surface at the specified @x and @y coordinates.
1658 	 *
1659 	 * Params:
1660 	 *     context = a #GtkStyleContext
1661 	 *     cr = a #cairo_t
1662 	 *     surface = a #cairo_surface_t containing the icon to draw
1663 	 *     x = X position for the @icon
1664 	 *     y = Y position for the @incon
1665 	 *
1666 	 * Since: 3.10
1667 	 */
1668 	public static void renderIconSurface(StyleContext context, Context cr, Surface surface, double x, double y)
1669 	{
1670 		gtk_render_icon_surface((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), (surface is null) ? null : surface.getSurfaceStruct(), x, y);
1671 	}
1672 
1673 	/**
1674 	 * Draws a text caret on @cr at the specified index of @layout.
1675 	 *
1676 	 * Params:
1677 	 *     context = a #GtkStyleContext
1678 	 *     cr = a #cairo_t
1679 	 *     x = X origin
1680 	 *     y = Y origin
1681 	 *     layout = the #PangoLayout of the text
1682 	 *     index = the index in the #PangoLayout
1683 	 *     direction = the #PangoDirection of the text
1684 	 *
1685 	 * Since: 3.4
1686 	 */
1687 	public static void renderInsertionCursor(StyleContext context, Context cr, double x, double y, PgLayout layout, int index, PangoDirection direction)
1688 	{
1689 		gtk_render_insertion_cursor((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), x, y, (layout is null) ? null : layout.getPgLayoutStruct(), index, direction);
1690 	}
1691 
1692 	/**
1693 	 * Renders @layout on the coordinates @x, @y
1694 	 *
1695 	 * Params:
1696 	 *     context = a #GtkStyleContext
1697 	 *     cr = a #cairo_t
1698 	 *     x = X origin
1699 	 *     y = Y origin
1700 	 *     layout = the #PangoLayout to render
1701 	 *
1702 	 * Since: 3.0
1703 	 */
1704 	public static void renderLayout(StyleContext context, Context cr, double x, double y, PgLayout layout)
1705 	{
1706 		gtk_render_layout((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), x, y, (layout is null) ? null : layout.getPgLayoutStruct());
1707 	}
1708 
1709 	/**
1710 	 * Renders a line from (x0, y0) to (x1, y1).
1711 	 *
1712 	 * Params:
1713 	 *     context = a #GtkStyleContext
1714 	 *     cr = a #cairo_t
1715 	 *     x0 = X coordinate for the origin of the line
1716 	 *     y0 = Y coordinate for the origin of the line
1717 	 *     x1 = X coordinate for the end of the line
1718 	 *     y1 = Y coordinate for the end of the line
1719 	 *
1720 	 * Since: 3.0
1721 	 */
1722 	public static void renderLine(StyleContext context, Context cr, double x0, double y0, double x1, double y1)
1723 	{
1724 		gtk_render_line((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), x0, y0, x1, y1);
1725 	}
1726 
1727 	/**
1728 	 * Renders an option mark (as in a #GtkRadioButton), the %GTK_STATE_FLAG_CHECKED
1729 	 * state will determine whether the option is on or off, and
1730 	 * %GTK_STATE_FLAG_INCONSISTENT whether it should be marked as undefined.
1731 	 *
1732 	 * Typical option mark rendering:
1733 	 *
1734 	 * ![](options.png)
1735 	 *
1736 	 * Params:
1737 	 *     context = a #GtkStyleContext
1738 	 *     cr = a #cairo_t
1739 	 *     x = X origin of the rectangle
1740 	 *     y = Y origin of the rectangle
1741 	 *     width = rectangle width
1742 	 *     height = rectangle height
1743 	 *
1744 	 * Since: 3.0
1745 	 */
1746 	public static void renderOption(StyleContext context, Context cr, double x, double y, double width, double height)
1747 	{
1748 		gtk_render_option((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), x, y, width, height);
1749 	}
1750 
1751 	/**
1752 	 * Renders a slider (as in #GtkScale) in the rectangle defined by @x, @y,
1753 	 * @width, @height. @orientation defines whether the slider is vertical
1754 	 * or horizontal.
1755 	 *
1756 	 * Typical slider rendering:
1757 	 *
1758 	 * ![](sliders.png)
1759 	 *
1760 	 * Params:
1761 	 *     context = a #GtkStyleContext
1762 	 *     cr = a #cairo_t
1763 	 *     x = X origin of the rectangle
1764 	 *     y = Y origin of the rectangle
1765 	 *     width = rectangle width
1766 	 *     height = rectangle height
1767 	 *     orientation = orientation of the slider
1768 	 *
1769 	 * Since: 3.0
1770 	 */
1771 	public static void renderSlider(StyleContext context, Context cr, double x, double y, double width, double height, GtkOrientation orientation)
1772 	{
1773 		gtk_render_slider((context is null) ? null : context.getStyleContextStruct(), (cr is null) ? null : cr.getContextStruct(), x, y, width, height, orientation);
1774 	}
1775 }