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