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  * Description
67  * The GObject type system supports dynamic loading of types. The
68  * GTypePlugin interface is used to handle the lifecycle of
69  * dynamically loaded types. It goes as follows:
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  * $(DDOC_COMMENT example)
74  *  where new_type_plugin is an implementation of the
75  *  GTypePlugin interface.
76  *  The type's implementation is referenced, e.g. through
77  *  g_type_class_ref() or through g_type_create_instance() (this is
78  *  being called by g_object_new()) or through one of the above done on
79  *  a type derived from new_type_id.
80  *  This causes the type system to load the type's implementation by calling
81  *  g_type_plugin_use() and g_type_plugin_complete_type_info() on
82  *  new_type_plugin.
83  *  At some point the type's implementation isn't required anymore, e.g. after
84  *  g_type_class_unref() or g_type_free_instance() (called when the reference
85  *  count of an instance drops to zero).
86  *  This causes the type system to throw away the information retrieved from
87  *  g_type_plugin_complete_type_info() and then it calls
88  *  g_type_plugin_unuse() on new_type_plugin.
89  *  Things may repeat from the second step.
90  * So basically, you need to implement a GTypePlugin type that
91  * carries a use_count, once use_count goes from zero to one, you need
92  * to load the implementation to successfully handle the upcoming
93  * g_type_plugin_complete_type_info() call. Later, maybe after
94  * succeeding use/unuse calls, once use_count drops to zero, you can
95  * unload the implementation again. The type system makes sure to call
96  * g_type_plugin_use() and g_type_plugin_complete_type_info() again
97  * when the type is needed again.
98  * GTypeModule is an implementation of GTypePlugin that already
99  * implements most of this except for the actual module loading and
100  * unloading. It even handles multiple registered types per module.
101  */
102 public class TypePlugin
103 {
104 	
105 	/** the main Gtk struct */
106 	protected GTypePlugin* gTypePlugin;
107 	
108 	
109 	public GTypePlugin* getTypePluginStruct()
110 	{
111 		return gTypePlugin;
112 	}
113 	
114 	
115 	/** the main Gtk struct as a void* */
116 	protected void* getStruct()
117 	{
118 		return cast(void*)gTypePlugin;
119 	}
120 	
121 	/**
122 	 * Sets our main struct and passes it to the parent class
123 	 */
124 	public this (GTypePlugin* gTypePlugin)
125 	{
126 		this.gTypePlugin = gTypePlugin;
127 	}
128 	
129 	/**
130 	 */
131 	
132 	/**
133 	 * Calls the use_plugin function from the GTypePluginClass of
134 	 * plugin. There should be no need to use this function outside of
135 	 * the GObject type system itself.
136 	 */
137 	public void use()
138 	{
139 		// void g_type_plugin_use (GTypePlugin *plugin);
140 		g_type_plugin_use(gTypePlugin);
141 	}
142 	
143 	/**
144 	 * Calls the unuse_plugin function from the GTypePluginClass of
145 	 * plugin. There should be no need to use this function outside of
146 	 * the GObject type system itself.
147 	 */
148 	public void unuse()
149 	{
150 		// void g_type_plugin_unuse (GTypePlugin *plugin);
151 		g_type_plugin_unuse(gTypePlugin);
152 	}
153 	
154 	/**
155 	 * Calls the complete_type_info function from the GTypePluginClass of plugin.
156 	 * There should be no need to use this function outside of the GObject
157 	 * type system itself.
158 	 * Params:
159 	 * gType = the GType whose info is completed
160 	 * info = the GTypeInfo struct to fill in
161 	 * valueTable = the GTypeValueTable to fill in
162 	 */
163 	public void completeTypeInfo(GType gType, GTypeInfo* info, GTypeValueTable* valueTable)
164 	{
165 		// void g_type_plugin_complete_type_info (GTypePlugin *plugin,  GType g_type,  GTypeInfo *info,  GTypeValueTable *value_table);
166 		g_type_plugin_complete_type_info(gTypePlugin, gType, info, valueTable);
167 	}
168 	
169 	/**
170 	 * Calls the complete_interface_info function from the
171 	 * GTypePluginClass of plugin. There should be no need to use this
172 	 * function outside of the GObject type system itself.
173 	 * Params:
174 	 * instanceType = the GType of an instantiable type to which the interface
175 	 * is added
176 	 * interfaceType = the GType of the interface whose info is completed
177 	 * info = the GInterfaceInfo to fill in
178 	 */
179 	public void completeInterfaceInfo(GType instanceType, GType interfaceType, GInterfaceInfo* info)
180 	{
181 		// void g_type_plugin_complete_interface_info  (GTypePlugin *plugin,  GType instance_type,  GType interface_type,  GInterfaceInfo *info);
182 		g_type_plugin_complete_interface_info(gTypePlugin, instanceType, interfaceType, info);
183 	}
184 }