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 gobject.TypePluginIF;
26 
27 private import gobject.c.functions;
28 public  import gobject.c.types;
29 public  import gtkc.gobjecttypes;
30 
31 
32 /**
33  * The GObject type system supports dynamic loading of types.
34  * The #GTypePlugin interface is used to handle the lifecycle
35  * of dynamically loaded types. It goes as follows:
36  * 
37  * 1. The type is initially introduced (usually upon loading the module
38  * the first time, or by your main application that knows what modules
39  * introduces what types), like this:
40  * |[<!-- language="C" -->
41  * new_type_id = g_type_register_dynamic (parent_type_id,
42  * "TypeName",
43  * new_type_plugin,
44  * type_flags);
45  * ]|
46  * where @new_type_plugin is an implementation of the
47  * #GTypePlugin interface.
48  * 
49  * 2. The type's implementation is referenced, e.g. through
50  * g_type_class_ref() or through g_type_create_instance() (this is
51  * being called by g_object_new()) or through one of the above done on
52  * a type derived from @new_type_id.
53  * 
54  * 3. This causes the type system to load the type's implementation by
55  * calling g_type_plugin_use() and g_type_plugin_complete_type_info()
56  * on @new_type_plugin.
57  * 
58  * 4. At some point the type's implementation isn't required anymore,
59  * e.g. after g_type_class_unref() or g_type_free_instance() (called
60  * when the reference count of an instance drops to zero).
61  * 
62  * 5. This causes the type system to throw away the information retrieved
63  * from g_type_plugin_complete_type_info() and then it calls
64  * g_type_plugin_unuse() on @new_type_plugin.
65  * 
66  * 6. Things may repeat from the second step.
67  * 
68  * So basically, you need to implement a #GTypePlugin type that
69  * carries a use_count, once use_count goes from zero to one, you need
70  * to load the implementation to successfully handle the upcoming
71  * g_type_plugin_complete_type_info() call. Later, maybe after
72  * succeeding use/unuse calls, once use_count drops to zero, you can
73  * unload the implementation again. The type system makes sure to call
74  * g_type_plugin_use() and g_type_plugin_complete_type_info() again
75  * when the type is needed again.
76  * 
77  * #GTypeModule is an implementation of #GTypePlugin that already
78  * implements most of this except for the actual module loading and
79  * unloading. It even handles multiple registered types per module.
80  */
81 public interface TypePluginIF{
82 	/** Get the main Gtk struct */
83 	public GTypePlugin* getTypePluginStruct(bool transferOwnership = false);
84 
85 	/** the main Gtk struct as a void* */
86 	protected void* getStruct();
87 
88 
89 	/** */
90 	public static GType getType()
91 	{
92 		return g_type_plugin_get_type();
93 	}
94 
95 	/**
96 	 * Calls the @complete_interface_info function from the
97 	 * #GTypePluginClass of @plugin. There should be no need to use this
98 	 * function outside of the GObject type system itself.
99 	 *
100 	 * Params:
101 	 *     instanceType = the #GType of an instantiable type to which the interface
102 	 *         is added
103 	 *     interfaceType = the #GType of the interface whose info is completed
104 	 *     info = the #GInterfaceInfo to fill in
105 	 */
106 	public void completeInterfaceInfo(GType instanceType, GType interfaceType, GInterfaceInfo* info);
107 
108 	/**
109 	 * Calls the @complete_type_info function from the #GTypePluginClass of @plugin.
110 	 * There should be no need to use this function outside of the GObject
111 	 * type system itself.
112 	 *
113 	 * Params:
114 	 *     gType = the #GType whose info is completed
115 	 *     info = the #GTypeInfo struct to fill in
116 	 *     valueTable = the #GTypeValueTable to fill in
117 	 */
118 	public void completeTypeInfo(GType gType, GTypeInfo* info, GTypeValueTable* valueTable);
119 
120 	/**
121 	 * Calls the @unuse_plugin function from the #GTypePluginClass of
122 	 * @plugin.  There should be no need to use this function outside of
123 	 * the GObject type system itself.
124 	 */
125 	public void unuse();
126 
127 	/**
128 	 * Calls the @use_plugin function from the #GTypePluginClass of
129 	 * @plugin.  There should be no need to use this function outside of
130 	 * the GObject type system itself.
131 	 */
132 	public void use();
133 }