File: TypeInterface.d

package info (click to toggle)
gtk-d 3.10.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,204 kB
  • sloc: javascript: 565; sh: 71; makefile: 23
file content (176 lines) | stat: -rw-r--r-- 5,238 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/*
 * This file is part of gtkD.
 *
 * gtkD is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version, with
 * some exceptions, please read the COPYING file.
 *
 * gtkD is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with gtkD; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
 */

// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage


module gobject.TypeInterface;

private import gobject.ObjectG;
private import gobject.TypeClass;
private import gobject.TypePluginIF;
private import gobject.c.functions;
public  import gobject.c.types;
public  import gtkc.gobjecttypes;


/**
 * An opaque structure used as the base of all interface types.
 */
public class TypeInterface
{
	/** the main Gtk struct */
	protected GTypeInterface* gTypeInterface;
	protected bool ownedRef;

	/** Get the main Gtk struct */
	public GTypeInterface* getTypeInterfaceStruct(bool transferOwnership = false)
	{
		if (transferOwnership)
			ownedRef = false;
		return gTypeInterface;
	}

	/** the main Gtk struct as a void* */
	protected void* getStruct()
	{
		return cast(void*)gTypeInterface;
	}

	/**
	 * Sets our main struct and passes it to the parent class.
	 */
	public this (GTypeInterface* gTypeInterface, bool ownedRef = false)
	{
		this.gTypeInterface = gTypeInterface;
		this.ownedRef = ownedRef;
	}


	/**
	 * Returns the corresponding #GTypeInterface structure of the parent type
	 * of the instance type to which @g_iface belongs. This is useful when
	 * deriving the implementation of an interface from the parent type and
	 * then possibly overriding some methods.
	 *
	 * Returns: the
	 *     corresponding #GTypeInterface structure of the parent type of the
	 *     instance type to which @g_iface belongs, or %NULL if the parent
	 *     type doesn't conform to the interface
	 */
	public TypeInterface peekParent()
	{
		auto __p = g_type_interface_peek_parent(gTypeInterface);

		if(__p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(TypeInterface)(cast(GTypeInterface*) __p);
	}

	/**
	 * Adds @prerequisite_type to the list of prerequisites of @interface_type.
	 * This means that any type implementing @interface_type must also implement
	 * @prerequisite_type. Prerequisites can be thought of as an alternative to
	 * interface derivation (which GType doesn't support). An interface can have
	 * at most one instantiatable prerequisite type.
	 *
	 * Params:
	 *     interfaceType = #GType value of an interface type
	 *     prerequisiteType = #GType value of an interface or instantiatable type
	 */
	public static void addPrerequisite(GType interfaceType, GType prerequisiteType)
	{
		g_type_interface_add_prerequisite(interfaceType, prerequisiteType);
	}

	/**
	 * Returns the #GTypePlugin structure for the dynamic interface
	 * @interface_type which has been added to @instance_type, or %NULL
	 * if @interface_type has not been added to @instance_type or does
	 * not have a #GTypePlugin structure. See g_type_add_interface_dynamic().
	 *
	 * Params:
	 *     instanceType = #GType of an instantiatable type
	 *     interfaceType = #GType of an interface type
	 *
	 * Returns: the #GTypePlugin for the dynamic
	 *     interface @interface_type of @instance_type
	 */
	public static TypePluginIF getPlugin(GType instanceType, GType interfaceType)
	{
		auto __p = g_type_interface_get_plugin(instanceType, interfaceType);

		if(__p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(TypePluginIF)(cast(GTypePlugin*) __p);
	}

	/**
	 * Returns the #GTypeInterface structure of an interface to which the
	 * passed in class conforms.
	 *
	 * Params:
	 *     instanceClass = a #GTypeClass structure
	 *     ifaceType = an interface ID which this class conforms to
	 *
	 * Returns: the #GTypeInterface
	 *     structure of @iface_type if implemented by @instance_class, %NULL
	 *     otherwise
	 */
	public static TypeInterface peek(TypeClass instanceClass, GType ifaceType)
	{
		auto __p = g_type_interface_peek((instanceClass is null) ? null : instanceClass.getTypeClassStruct(), ifaceType);

		if(__p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(TypeInterface)(cast(GTypeInterface*) __p);
	}

	/**
	 * Returns the prerequisites of an interfaces type.
	 *
	 * Params:
	 *     interfaceType = an interface type
	 *
	 * Returns: a
	 *     newly-allocated zero-terminated array of #GType containing
	 *     the prerequisites of @interface_type
	 *
	 * Since: 2.2
	 */
	public static GType[] prerequisites(GType interfaceType)
	{
		uint nPrerequisites;

		auto __p = g_type_interface_prerequisites(interfaceType, &nPrerequisites);

		return __p[0 .. nPrerequisites];
	}
}