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