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