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  * Description
76  * GIOExtensionPoint provides a mechanism for modules to extend the
77  * functionality of the library or application that loaded it in an
78  * organized fashion.
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  * A module can implement an extension point by specifying the GType
85  * that implements the functionality. Additionally, each implementation
86  * of an extension point has a name, and a priority. Use
87  * g_io_extension_point_implement() to implement an extension point.
88  * $(DDOC_COMMENT example)
89  * $(DDOC_COMMENT example)
90  *  It is up to the code that registered the extension point how
91  *  it uses the implementations that have been associated with it.
92  *  Depending on the use case, it may use all implementations, or
93  *  only the one with the highest priority, or pick a specific
94  *  one by name.
95  *  To avoid opening all modules just to find out what extension
96  *  points they implement, GIO makes use of a caching mechanism,
97  *  see gio-querymodules.
98  *  You are expected to run this command after installing a
99  *  GIO module.
100  */
101 public class IOExtensionPoint
102 {
103 	
104 	/** the main Gtk struct */
105 	protected GIOExtensionPoint* gIOExtensionPoint;
106 	
107 	
108 	public GIOExtensionPoint* getIOExtensionPointStruct()
109 	{
110 		return gIOExtensionPoint;
111 	}
112 	
113 	
114 	/** the main Gtk struct as a void* */
115 	protected void* getStruct()
116 	{
117 		return cast(void*)gIOExtensionPoint;
118 	}
119 	
120 	/**
121 	 * Sets our main struct and passes it to the parent class
122 	 */
123 	public this (GIOExtensionPoint* gIOExtensionPoint)
124 	{
125 		this.gIOExtensionPoint = gIOExtensionPoint;
126 	}
127 	
128 	/**
129 	 */
130 	
131 	/**
132 	 * Finds a GIOExtension for an extension point by name.
133 	 * Params:
134 	 * name = the name of the extension to get
135 	 * Returns: the GIOExtension for extension_point that has the given name, or NULL if there is no extension with that name. [transfer none]
136 	 */
137 	public IOExtension getExtensionByName(string name)
138 	{
139 		// GIOExtension * g_io_extension_point_get_extension_by_name  (GIOExtensionPoint *extension_point,  const char *name);
140 		auto p = g_io_extension_point_get_extension_by_name(gIOExtensionPoint, Str.toStringz(name));
141 		
142 		if(p is null)
143 		{
144 			return null;
145 		}
146 		
147 		return ObjectG.getDObject!(IOExtension)(cast(GIOExtension*) p);
148 	}
149 	
150 	/**
151 	 * Gets a list of all extensions that implement this extension point.
152 	 * The list is sorted by priority, beginning with the highest priority.
153 	 * Returns: a GList of GIOExtensions. The list is owned by GIO and should not be modified. [element-type GIOExtension][transfer none]
154 	 */
155 	public ListG getExtensions()
156 	{
157 		// GList * g_io_extension_point_get_extensions (GIOExtensionPoint *extension_point);
158 		auto p = g_io_extension_point_get_extensions(gIOExtensionPoint);
159 		
160 		if(p is null)
161 		{
162 			return null;
163 		}
164 		
165 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
166 	}
167 	
168 	/**
169 	 * Gets the required type for extension_point.
170 	 * Returns: the GType that all implementations must have, or G_TYPE_INVALID if the extension point has no required type
171 	 */
172 	public GType getRequiredType()
173 	{
174 		// GType g_io_extension_point_get_required_type  (GIOExtensionPoint *extension_point);
175 		return g_io_extension_point_get_required_type(gIOExtensionPoint);
176 	}
177 	
178 	/**
179 	 * Registers type as extension for the extension point with name
180 	 * extension_point_name.
181 	 * If type has already been registered as an extension for this
182 	 * extension point, the existing GIOExtension object is returned.
183 	 * Params:
184 	 * extensionPointName = the name of the extension point
185 	 * type = the GType to register as extension
186 	 * extensionName = the name for the extension
187 	 * priority = the priority for the extension
188 	 * Returns: a GIOExtension object for GType
189 	 */
190 	public static IOExtension implement(string extensionPointName, GType type, string extensionName, int priority)
191 	{
192 		// GIOExtension * g_io_extension_point_implement (const char *extension_point_name,  GType type,  const char *extension_name,  gint priority);
193 		auto p = g_io_extension_point_implement(Str.toStringz(extensionPointName), type, Str.toStringz(extensionName), priority);
194 		
195 		if(p is null)
196 		{
197 			return null;
198 		}
199 		
200 		return ObjectG.getDObject!(IOExtension)(cast(GIOExtension*) p);
201 	}
202 	
203 	/**
204 	 * Looks up an existing extension point.
205 	 * Params:
206 	 * name = the name of the extension point
207 	 * Returns: the GIOExtensionPoint, or NULL if there is no registered extension point with the given name
208 	 */
209 	public static IOExtensionPoint lookup(string name)
210 	{
211 		// GIOExtensionPoint * g_io_extension_point_lookup (const char *name);
212 		auto p = g_io_extension_point_lookup(Str.toStringz(name));
213 		
214 		if(p is null)
215 		{
216 			return null;
217 		}
218 		
219 		return ObjectG.getDObject!(IOExtensionPoint)(cast(GIOExtensionPoint*) p);
220 	}
221 	
222 	/**
223 	 * Registers an extension point.
224 	 * Params:
225 	 * name = The name of the extension point
226 	 * Returns: the new GIOExtensionPoint. This object is owned by GIO and should not be freed
227 	 */
228 	public static IOExtensionPoint register(string name)
229 	{
230 		// GIOExtensionPoint * g_io_extension_point_register (const char *name);
231 		auto p = g_io_extension_point_register(Str.toStringz(name));
232 		
233 		if(p is null)
234 		{
235 			return null;
236 		}
237 		
238 		return ObjectG.getDObject!(IOExtensionPoint)(cast(GIOExtensionPoint*) p);
239 	}
240 	
241 	/**
242 	 * Sets the required type for extension_point to type.
243 	 * All implementations must henceforth have this type.
244 	 * Params:
245 	 * type = the GType to require
246 	 */
247 	public void setRequiredType(GType type)
248 	{
249 		// void g_io_extension_point_set_required_type  (GIOExtensionPoint *extension_point,  GType type);
250 		g_io_extension_point_set_required_type(gIOExtensionPoint, type);
251 	}
252 }