root/trunk/src/gio/IOExtensionPoint.d

Revision 938, 7.4 kB (checked in by Mike Wey, 3 months ago)

Update Gio to 2.28.

Line 
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
65
66 private import glib.Str;
67 private import glib.ListG;
68 private import gio.IOExtension;
69
70
71
72
73 /**
74  * Description
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  * An extension point is identified by a name, and it may optionally
79  * require that any implementation must by of a certain type (or derived
80  * thereof). Use g_io_extension_point_register() to register an
81  * extension point, and g_io_extension_point_set_required_type() to
82  * set a required type.
83  * A module can implement an extension point by specifying the GType
84  * that implements the functionality. Additionally, each implementation
85  * of an extension point has a name, and a priority. Use
86  * g_io_extension_point_implement() to implement an extension point.
87  * $(DDOC_COMMENT example)
88  * $(DDOC_COMMENT example)
89  *  It is up to the code that registered the extension point how
90  *  it uses the implementations that have been associated with it.
91  *  Depending on the use case, it may use all implementations, or
92  *  only the one with the highest priority, or pick a specific
93  *  one by name.
94  *  To avoid opening all modules just to find out what extension
95  *  points they implement, GIO makes use of a caching mechanism,
96  *  see gio-querymodules.
97  *  You are expected to run this command after installing a
98  *  GIO module.
99  */
100 public class IOExtensionPoint
101 {
102    
103     /** the main Gtk struct */
104     protected GIOExtensionPoint* gIOExtensionPoint;
105    
106    
107     public GIOExtensionPoint* getIOExtensionPointStruct()
108     {
109         return gIOExtensionPoint;
110     }
111    
112    
113     /** the main Gtk struct as a void* */
114     protected void* getStruct()
115     {
116         return cast(void*)gIOExtensionPoint;
117     }
118    
119     /**
120      * Sets our main struct and passes it to the parent class
121      */
122     public this (GIOExtensionPoint* gIOExtensionPoint)
123     {
124         if(gIOExtensionPoint is null)
125         {
126             this = null;
127             return;
128         }
129         this.gIOExtensionPoint = gIOExtensionPoint;
130     }
131    
132     /**
133      */
134    
135     /**
136      * Finds a GIOExtension for an extension point by name.
137      * Params:
138      * name = the name of the extension to get
139      * Returns: the GIOExtension for extension_point that has the given name, or NULL if there is no extension with that name. [transfer none]
140      */
141     public IOExtension getExtensionByName(string name)
142     {
143         // GIOExtension * g_io_extension_point_get_extension_by_name  (GIOExtensionPoint *extension_point,  const char *name);
144         auto p = g_io_extension_point_get_extension_by_name(gIOExtensionPoint, Str.toStringz(name));
145         if(p is null)
146         {
147             return null;
148         }
149         return new IOExtension(cast(GIOExtension*) p);
150     }
151    
152     /**
153      * Gets a list of all extensions that implement this extension point.
154      * The list is sorted by priority, beginning with the highest priority.
155      * Returns: a GList of GIOExtensions. The list is owned by GIO and should not be modified. [element-type GIOExtension][transfer none]
156      */
157     public ListG getExtensions()
158     {
159         // GList * g_io_extension_point_get_extensions (GIOExtensionPoint *extension_point);
160         auto p = g_io_extension_point_get_extensions(gIOExtensionPoint);
161         if(p is null)
162         {
163             return null;
164         }
165         return new 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         if(p is null)
195         {
196             return null;
197         }
198         return new IOExtension(cast(GIOExtension*) p);
199     }
200    
201     /**
202      * Looks up an existing extension point.
203      * Params:
204      * name = the name of the extension point
205      * Returns: the GIOExtensionPoint, or NULL if there is no registered extension point with the given name
206      */
207     public static IOExtensionPoint lookup(string name)
208     {
209         // GIOExtensionPoint * g_io_extension_point_lookup (const char *name);
210         auto p = g_io_extension_point_lookup(Str.toStringz(name));
211         if(p is null)
212         {
213             return null;
214         }
215         return new IOExtensionPoint(cast(GIOExtensionPoint*) p);
216     }
217    
218     /**
219      * Registers an extension point.
220      * Params:
221      * name = The name of the extension point
222      * Returns: the new GIOExtensionPoint. This object is owned by GIO and should not be freed
223      */
224     public static IOExtensionPoint register(string name)
225     {
226         // GIOExtensionPoint * g_io_extension_point_register (const char *name);
227         auto p = g_io_extension_point_register(Str.toStringz(name));
228         if(p is null)
229         {
230             return null;
231         }
232         return new IOExtensionPoint(cast(GIOExtensionPoint*) p);
233     }
234    
235     /**
236      * Sets the required type for extension_point to type.
237      * All implementations must henceforth have this type.
238      * Params:
239      * type = the GType to require
240      */
241     public void setRequiredType(GType type)
242     {
243         // void g_io_extension_point_set_required_type  (GIOExtensionPoint *extension_point,  GType type);
244         g_io_extension_point_set_required_type(gIOExtensionPoint, type);
245     }
246 }
Note: See TracBrowser for help on using the browser.