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