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  = GTypePlugin.html
27  * outPack = gobject
28  * outFile = TypePlugin
29  * strct   = GTypePlugin
30  * realStrct=
31  * ctorStrct=
32  * clss    = TypePlugin
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_type_plugin_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * structWrap:
47  * module aliases:
48  * local aliases:
49  * overrides:
50  */
51 
52 module gobject.TypePlugin;
53 
54 public  import gtkc.gobjecttypes;
55 
56 private import gtkc.gobject;
57 private import glib.ConstructionException;
58 private import gobject.ObjectG;
59 
60 
61 
62 
63 
64 
65 /**
66  * The GObject type system supports dynamic loading of types. The
67  * GTypePlugin interface is used to handle the lifecycle of
68  * dynamically loaded types. It goes as follows:
69  *
70  *  The type is initially introduced (usually upon loading the module
71  *  the first time, or by your main application that knows what modules
72  *  introduces what types), like this:
73  *
74  * $(DDOC_COMMENT example)
75  *
76  *  where new_type_plugin is an implementation of the
77  *  GTypePlugin interface.
78  *
79  *  The type's implementation is referenced, e.g. through
80  *  g_type_class_ref() or through g_type_create_instance() (this is
81  *  being called by g_object_new()) or through one of the above done on
82  *  a type derived from new_type_id.
83  *
84  *  This causes the type system to load the type's implementation by calling
85  *  g_type_plugin_use() and g_type_plugin_complete_type_info() on
86  *  new_type_plugin.
87  *
88  *  At some point the type's implementation isn't required anymore, e.g. after
89  *  g_type_class_unref() or g_type_free_instance() (called when the reference
90  *  count of an instance drops to zero).
91  *
92  *  This causes the type system to throw away the information retrieved from
93  *  g_type_plugin_complete_type_info() and then it calls
94  *  g_type_plugin_unuse() on new_type_plugin.
95  *
96  *  Things may repeat from the second step.
97  *
98  * So basically, you need to implement a GTypePlugin type that
99  * carries a use_count, once use_count goes from zero to one, you need
100  * to load the implementation to successfully handle the upcoming
101  * g_type_plugin_complete_type_info() call. Later, maybe after
102  * succeeding use/unuse calls, once use_count drops to zero, you can
103  * unload the implementation again. The type system makes sure to call
104  * g_type_plugin_use() and g_type_plugin_complete_type_info() again
105  * when the type is needed again.
106  *
107  * GTypeModule is an implementation of GTypePlugin that already
108  * implements most of this except for the actual module loading and
109  * unloading. It even handles multiple registered types per module.
110  */
111 public class TypePlugin
112 {
113 	
114 	/** the main Gtk struct */
115 	protected GTypePlugin* gTypePlugin;
116 	
117 	
118 	public GTypePlugin* getTypePluginStruct()
119 	{
120 		return gTypePlugin;
121 	}
122 	
123 	
124 	/** the main Gtk struct as a void* */
125 	protected void* getStruct()
126 	{
127 		return cast(void*)gTypePlugin;
128 	}
129 	
130 	/**
131 	 * Sets our main struct and passes it to the parent class
132 	 */
133 	public this (GTypePlugin* gTypePlugin)
134 	{
135 		this.gTypePlugin = gTypePlugin;
136 	}
137 	
138 	/**
139 	 */
140 	
141 	/**
142 	 * Calls the use_plugin function from the GTypePluginClass of
143 	 * plugin. There should be no need to use this function outside of
144 	 * the GObject type system itself.
145 	 */
146 	public void use()
147 	{
148 		// void g_type_plugin_use (GTypePlugin *plugin);
149 		g_type_plugin_use(gTypePlugin);
150 	}
151 	
152 	/**
153 	 * Calls the unuse_plugin function from the GTypePluginClass of
154 	 * plugin. There should be no need to use this function outside of
155 	 * the GObject type system itself.
156 	 */
157 	public void unuse()
158 	{
159 		// void g_type_plugin_unuse (GTypePlugin *plugin);
160 		g_type_plugin_unuse(gTypePlugin);
161 	}
162 	
163 	/**
164 	 * Calls the complete_type_info function from the GTypePluginClass of plugin.
165 	 * There should be no need to use this function outside of the GObject
166 	 * type system itself.
167 	 * Params:
168 	 * gType = the GType whose info is completed
169 	 * info = the GTypeInfo struct to fill in
170 	 * valueTable = the GTypeValueTable to fill in
171 	 */
172 	public void completeTypeInfo(GType gType, GTypeInfo* info, GTypeValueTable* valueTable)
173 	{
174 		// void g_type_plugin_complete_type_info (GTypePlugin *plugin,  GType g_type,  GTypeInfo *info,  GTypeValueTable *value_table);
175 		g_type_plugin_complete_type_info(gTypePlugin, gType, info, valueTable);
176 	}
177 	
178 	/**
179 	 * Calls the complete_interface_info function from the
180 	 * GTypePluginClass of plugin. There should be no need to use this
181 	 * function outside of the GObject type system itself.
182 	 * Params:
183 	 * instanceType = the GType of an instantiable type to which the interface
184 	 * is added
185 	 * interfaceType = the GType of the interface whose info is completed
186 	 * info = the GInterfaceInfo to fill in
187 	 */
188 	public void completeInterfaceInfo(GType instanceType, GType interfaceType, GInterfaceInfo* info)
189 	{
190 		// void g_type_plugin_complete_interface_info  (GTypePlugin *plugin,  GType instance_type,  GType interface_type,  GInterfaceInfo *info);
191 		g_type_plugin_complete_interface_info(gTypePlugin, instanceType, interfaceType, info);
192 	}
193 }