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.NativeT;
26 
27 public  import gdk.Surface;
28 public  import gobject.ObjectG;
29 public  import gsk.Renderer;
30 public  import gtk.NativeIF;
31 public  import gtk.c.functions;
32 public  import gtk.c.types;
33 
34 
35 /**
36  * `GtkNative` is the interface implemented by all widgets that have
37  * their own `GdkSurface`.
38  * 
39  * The obvious example of a `GtkNative` is `GtkWindow`.
40  * 
41  * Every widget that is not itself a `GtkNative` is contained in one,
42  * and you can get it with [method@Gtk.Widget.get_native].
43  * 
44  * To get the surface of a `GtkNative`, use [method@Gtk.Native.get_surface].
45  * It is also possible to find the `GtkNative` to which a surface
46  * belongs, with [func@Gtk.Native.get_for_surface].
47  * 
48  * In addition to a [class@Gdk.Surface], a `GtkNative` also provides
49  * a [class@Gsk.Renderer] for rendering on that surface. To get the
50  * renderer, use [method@Gtk.Native.get_renderer].
51  */
52 public template NativeT(TStruct)
53 {
54 	/** Get the main Gtk struct */
55 	public GtkNative* getNativeStruct(bool transferOwnership = false)
56 	{
57 		if (transferOwnership)
58 			ownedRef = false;
59 		return cast(GtkNative*)getStruct();
60 	}
61 
62 
63 	/**
64 	 * Returns the renderer that is used for this `GtkNative`.
65 	 *
66 	 * Returns: the renderer for @self
67 	 */
68 	public Renderer getRenderer()
69 	{
70 		auto __p = gtk_native_get_renderer(getNativeStruct());
71 
72 		if(__p is null)
73 		{
74 			return null;
75 		}
76 
77 		return ObjectG.getDObject!(Renderer)(cast(GskRenderer*) __p);
78 	}
79 
80 	/**
81 	 * Returns the surface of this `GtkNative`.
82 	 *
83 	 * Returns: the surface of @self
84 	 */
85 	public Surface getSurface()
86 	{
87 		auto __p = gtk_native_get_surface(getNativeStruct());
88 
89 		if(__p is null)
90 		{
91 			return null;
92 		}
93 
94 		return ObjectG.getDObject!(Surface)(cast(GdkSurface*) __p);
95 	}
96 
97 	/**
98 	 * Retrieves the surface transform of @self.
99 	 *
100 	 * This is the translation from @self's surface coordinates into
101 	 * @self's widget coordinates.
102 	 *
103 	 * Params:
104 	 *     x = return location for the x coordinate
105 	 *     y = return location for the y coordinate
106 	 */
107 	public void getSurfaceTransform(out double x, out double y)
108 	{
109 		gtk_native_get_surface_transform(getNativeStruct(), &x, &y);
110 	}
111 
112 	/**
113 	 * Realizes a `GtkNative`.
114 	 *
115 	 * This should only be used by subclasses.
116 	 */
117 	public void realizeNative()
118 	{
119 		gtk_native_realize(getNativeStruct());
120 	}
121 
122 	/**
123 	 * Unrealizes a `GtkNative`.
124 	 *
125 	 * This should only be used by subclasses.
126 	 */
127 	public void unrealizeNative()
128 	{
129 		gtk_native_unrealize(getNativeStruct());
130 	}
131 }