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  * Conversion parameters:
26  * inFile  = 
27  * outPack = gio
28  * outFile = IOExtensionPoint
29  * strct   = GIOExtensionPoint
30  * realStrct=
31  * ctorStrct=
32  * clss    = IOExtensionPoint
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_io_extension_point_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.ListG
48  * 	- gio.IOExtension
49  * structWrap:
50  * 	- GIOExtension* -> IOExtension
51  * 	- GIOExtensionPoint* -> IOExtensionPoint
52  * 	- GList* -> ListG
53  * module aliases:
54  * local aliases:
55  * overrides:
56  */
57 
58 module gio.IOExtensionPoint;
59 
60 public  import gtkc.giotypes;
61 
62 private import gtkc.gio;
63 private import glib.ConstructionException;
64 private import gobject.ObjectG;
65 
66 
67 private import glib.Str;
68 private import glib.ListG;
69 private import gio.IOExtension;
70 
71 
72 
73 
74 /**
75  * GIOExtensionPoint provides a mechanism for modules to extend the
76  * functionality of the library or application that loaded it in an
77  * organized fashion.
78  *
79  * An extension point is identified by a name, and it may optionally
80  * require that any implementation must by of a certain type (or derived
81  * thereof). Use g_io_extension_point_register() to register an
82  * extension point, and g_io_extension_point_set_required_type() to
83  * set a required type.
84  *
85  * A module can implement an extension point by specifying the GType
86  * that implements the functionality. Additionally, each implementation
87  * of an extension point has a name, and a priority. Use
88  * g_io_extension_point_implement() to implement an extension point.
89  *
90  * $(DDOC_COMMENT example)
91  *
92  * $(DDOC_COMMENT example)
93  *
94  *  It is up to the code that registered the extension point how
95  *  it uses the implementations that have been associated with it.
96  *  Depending on the use case, it may use all implementations, or
97  *  only the one with the highest priority, or pick a specific
98  *  one by name.
99  *
100  *  To avoid opening all modules just to find out what extension
101  *  points they implement, GIO makes use of a caching mechanism,
102  *  see gio-querymodules.
103  *  You are expected to run this command after installing a
104  *  GIO module.
105  *
106  *  The GIO_EXTRA_MODULES environment variable can be
107  *  used to specify additional directories to automatically load modules
108  *  from. This environment variable has the same syntax as the
109  *  PATH. If two modules have the same base name in different
110  *  directories, then the latter one will be ignored. If additional
111  *  directories are specified GIO will load modules from the built-in
112  *  directory last.
113  */
114 public class IOExtensionPoint
115 {
116 	
117 	/** the main Gtk struct */
118 	protected GIOExtensionPoint* gIOExtensionPoint;
119 	
120 	
121 	public GIOExtensionPoint* getIOExtensionPointStruct()
122 	{
123 		return gIOExtensionPoint;
124 	}
125 	
126 	
127 	/** the main Gtk struct as a void* */
128 	protected void* getStruct()
129 	{
130 		return cast(void*)gIOExtensionPoint;
131 	}
132 	
133 	/**
134 	 * Sets our main struct and passes it to the parent class
135 	 */
136 	public this (GIOExtensionPoint* gIOExtensionPoint)
137 	{
138 		this.gIOExtensionPoint = gIOExtensionPoint;
139 	}
140 	
141 	/**
142 	 */
143 	
144 	/**
145 	 * Finds a GIOExtension for an extension point by name.
146 	 * Params:
147 	 * name = the name of the extension to get
148 	 * Returns: the GIOExtension for extension_point that has the given name, or NULL if there is no extension with that name. [transfer none]
149 	 */
150 	public IOExtension getExtensionByName(string name)
151 	{
152 		// GIOExtension * g_io_extension_point_get_extension_by_name  (GIOExtensionPoint *extension_point,  const char *name);
153 		auto p = g_io_extension_point_get_extension_by_name(gIOExtensionPoint, Str.toStringz(name));
154 		
155 		if(p is null)
156 		{
157 			return null;
158 		}
159 		
160 		return ObjectG.getDObject!(IOExtension)(cast(GIOExtension*) p);
161 	}
162 	
163 	/**
164 	 * Gets a list of all extensions that implement this extension point.
165 	 * The list is sorted by priority, beginning with the highest priority.
166 	 * Returns: a GList of GIOExtensions. The list is owned by GIO and should not be modified. [element-type GIOExtension][transfer none]
167 	 */
168 	public ListG getExtensions()
169 	{
170 		// GList * g_io_extension_point_get_extensions (GIOExtensionPoint *extension_point);
171 		auto p = g_io_extension_point_get_extensions(gIOExtensionPoint);
172 		
173 		if(p is null)
174 		{
175 			return null;
176 		}
177 		
178 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
179 	}
180 	
181 	/**
182 	 * Gets the required type for extension_point.
183 	 * Returns: the GType that all implementations must have, or G_TYPE_INVALID if the extension point has no required type
184 	 */
185 	public GType getRequiredType()
186 	{
187 		// GType g_io_extension_point_get_required_type  (GIOExtensionPoint *extension_point);
188 		return g_io_extension_point_get_required_type(gIOExtensionPoint);
189 	}
190 	
191 	/**
192 	 * Registers type as extension for the extension point with name
193 	 * extension_point_name.
194 	 * If type has already been registered as an extension for this
195 	 * extension point, the existing GIOExtension object is returned.
196 	 * Params:
197 	 * extensionPointName = the name of the extension point
198 	 * type = the GType to register as extension
199 	 * extensionName = the name for the extension
200 	 * priority = the priority for the extension
201 	 * Returns: a GIOExtension object for GType. [transfer none]
202 	 */
203 	public static IOExtension implement(string extensionPointName, GType type, string extensionName, int priority)
204 	{
205 		// GIOExtension * g_io_extension_point_implement (const char *extension_point_name,  GType type,  const char *extension_name,  gint priority);
206 		auto p = g_io_extension_point_implement(Str.toStringz(extensionPointName), type, Str.toStringz(extensionName), priority);
207 		
208 		if(p is null)
209 		{
210 			return null;
211 		}
212 		
213 		return ObjectG.getDObject!(IOExtension)(cast(GIOExtension*) p);
214 	}
215 	
216 	/**
217 	 * Looks up an existing extension point.
218 	 * Params:
219 	 * name = the name of the extension point
220 	 * Returns: the GIOExtensionPoint, or NULL if there is no registered extension point with the given name. [transfer none]
221 	 */
222 	public static IOExtensionPoint lookup(string name)
223 	{
224 		// GIOExtensionPoint * g_io_extension_point_lookup (const char *name);
225 		auto p = g_io_extension_point_lookup(Str.toStringz(name));
226 		
227 		if(p is null)
228 		{
229 			return null;
230 		}
231 		
232 		return ObjectG.getDObject!(IOExtensionPoint)(cast(GIOExtensionPoint*) p);
233 	}
234 	
235 	/**
236 	 * Registers an extension point.
237 	 * Params:
238 	 * name = The name of the extension point
239 	 * Returns: the new GIOExtensionPoint. This object is owned by GIO and should not be freed. [transfer none]
240 	 */
241 	public static IOExtensionPoint register(string name)
242 	{
243 		// GIOExtensionPoint * g_io_extension_point_register (const char *name);
244 		auto p = g_io_extension_point_register(Str.toStringz(name));
245 		
246 		if(p is null)
247 		{
248 			return null;
249 		}
250 		
251 		return ObjectG.getDObject!(IOExtensionPoint)(cast(GIOExtensionPoint*) p);
252 	}
253 	
254 	/**
255 	 * Sets the required type for extension_point to type.
256 	 * All implementations must henceforth have this type.
257 	 * Params:
258 	 * type = the GType to require
259 	 */
260 	public void setRequiredType(GType type)
261 	{
262 		// void g_io_extension_point_set_required_type  (GIOExtensionPoint *extension_point,  GType type);
263 		g_io_extension_point_set_required_type(gIOExtensionPoint, type);
264 	}
265 }