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 gio.IOExtensionPoint;
26 
27 private import gio.IOExtension;
28 private import gio.c.functions;
29 public  import gio.c.types;
30 private import glib.ListG;
31 private import glib.Str;
32 private import gobject.ObjectG;
33 public  import gtkc.giotypes;
34 
35 
36 /**
37  * #GIOExtensionPoint is an opaque data structure and can only be accessed
38  * using the following functions.
39  */
40 public class IOExtensionPoint
41 {
42 	/** the main Gtk struct */
43 	protected GIOExtensionPoint* gIOExtensionPoint;
44 	protected bool ownedRef;
45 
46 	/** Get the main Gtk struct */
47 	public GIOExtensionPoint* getIOExtensionPointStruct(bool transferOwnership = false)
48 	{
49 		if (transferOwnership)
50 			ownedRef = false;
51 		return gIOExtensionPoint;
52 	}
53 
54 	/** the main Gtk struct as a void* */
55 	protected void* getStruct()
56 	{
57 		return cast(void*)gIOExtensionPoint;
58 	}
59 
60 	/**
61 	 * Sets our main struct and passes it to the parent class.
62 	 */
63 	public this (GIOExtensionPoint* gIOExtensionPoint, bool ownedRef = false)
64 	{
65 		this.gIOExtensionPoint = gIOExtensionPoint;
66 		this.ownedRef = ownedRef;
67 	}
68 
69 
70 	/**
71 	 * Finds a #GIOExtension for an extension point by name.
72 	 *
73 	 * Params:
74 	 *     name = the name of the extension to get
75 	 *
76 	 * Returns: the #GIOExtension for @extension_point that has the
77 	 *     given name, or %NULL if there is no extension with that name
78 	 */
79 	public IOExtension getExtensionByName(string name)
80 	{
81 		auto __p = g_io_extension_point_get_extension_by_name(gIOExtensionPoint, Str.toStringz(name));
82 
83 		if(__p is null)
84 		{
85 			return null;
86 		}
87 
88 		return ObjectG.getDObject!(IOExtension)(cast(GIOExtension*) __p);
89 	}
90 
91 	/**
92 	 * Gets a list of all extensions that implement this extension point.
93 	 * The list is sorted by priority, beginning with the highest priority.
94 	 *
95 	 * Returns: a #GList of
96 	 *     #GIOExtensions. The list is owned by GIO and should not be
97 	 *     modified.
98 	 */
99 	public ListG getExtensions()
100 	{
101 		auto __p = g_io_extension_point_get_extensions(gIOExtensionPoint);
102 
103 		if(__p is null)
104 		{
105 			return null;
106 		}
107 
108 		return new ListG(cast(GList*) __p);
109 	}
110 
111 	/**
112 	 * Gets the required type for @extension_point.
113 	 *
114 	 * Returns: the #GType that all implementations must have,
115 	 *     or #G_TYPE_INVALID if the extension point has no required type
116 	 */
117 	public GType getRequiredType()
118 	{
119 		return g_io_extension_point_get_required_type(gIOExtensionPoint);
120 	}
121 
122 	/**
123 	 * Sets the required type for @extension_point to @type.
124 	 * All implementations must henceforth have this type.
125 	 *
126 	 * Params:
127 	 *     type = the #GType to require
128 	 */
129 	public void setRequiredType(GType type)
130 	{
131 		g_io_extension_point_set_required_type(gIOExtensionPoint, type);
132 	}
133 
134 	/**
135 	 * Registers @type as extension for the extension point with name
136 	 * @extension_point_name.
137 	 *
138 	 * If @type has already been registered as an extension for this
139 	 * extension point, the existing #GIOExtension object is returned.
140 	 *
141 	 * Params:
142 	 *     extensionPointName = the name of the extension point
143 	 *     type = the #GType to register as extension
144 	 *     extensionName = the name for the extension
145 	 *     priority = the priority for the extension
146 	 *
147 	 * Returns: a #GIOExtension object for #GType
148 	 */
149 	public static IOExtension implement(string extensionPointName, GType type, string extensionName, int priority)
150 	{
151 		auto __p = g_io_extension_point_implement(Str.toStringz(extensionPointName), type, Str.toStringz(extensionName), priority);
152 
153 		if(__p is null)
154 		{
155 			return null;
156 		}
157 
158 		return ObjectG.getDObject!(IOExtension)(cast(GIOExtension*) __p);
159 	}
160 
161 	/**
162 	 * Looks up an existing extension point.
163 	 *
164 	 * Params:
165 	 *     name = the name of the extension point
166 	 *
167 	 * Returns: the #GIOExtensionPoint, or %NULL if there
168 	 *     is no registered extension point with the given name.
169 	 */
170 	public static IOExtensionPoint lookup(string name)
171 	{
172 		auto __p = g_io_extension_point_lookup(Str.toStringz(name));
173 
174 		if(__p is null)
175 		{
176 			return null;
177 		}
178 
179 		return ObjectG.getDObject!(IOExtensionPoint)(cast(GIOExtensionPoint*) __p);
180 	}
181 
182 	/**
183 	 * Registers an extension point.
184 	 *
185 	 * Params:
186 	 *     name = The name of the extension point
187 	 *
188 	 * Returns: the new #GIOExtensionPoint. This object is
189 	 *     owned by GIO and should not be freed.
190 	 */
191 	public static IOExtensionPoint register(string name)
192 	{
193 		auto __p = g_io_extension_point_register(Str.toStringz(name));
194 
195 		if(__p is null)
196 		{
197 			return null;
198 		}
199 
200 		return ObjectG.getDObject!(IOExtensionPoint)(cast(GIOExtensionPoint*) __p);
201 	}
202 }