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