2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GTypePlugin.html
27 * outFile = TypePlugin
51 module gobject
.TypePlugin
;
57 import tango
.io
.Stdout
; // use the tango loging?
61 private import gtkc
.gobjecttypes
;
63 private import gtkc
.gobject
;
66 private import glib
.Str
;
67 private import gobject
.Type
;
74 * The GObject type system supports dynamic loading of types. The GTypePlugin
75 * interface is used to handle the lifecycle of dynamically loaded types.
77 * The type is initially introduced (usually upon loading the module
78 * the first time, or by your main application that knows what modules
79 * introduces what types), like this:
80 * new_type_id = g_type_register_dynamic (parent_type_id,
84 * where new_type_plugin is an implementation of the
85 * GTypePlugin interface.
86 * The type's implementation is referenced, e.g. through
87 * g_type_class_ref() or through g_type_create_instance() (this is
88 * being called by g_object_new()) or through one of the above done on
89 * a type derived from new_type_id.
90 * This causes the type system to load the type's implementation by calling
91 * g_type_plugin_use() and g_type_plugin_complete_type_info() on
93 * At some point the type's implementation isn't required anymore, e.g. after
94 * g_type_class_unref() or g_type_free_instance() (called when the reference
95 * count of an instance drops to zero).
96 * This causes the type system to throw away the information retrieved from
97 * g_type_plugin_complete_type_info() and then it calls
98 * g_type_plugin_unuse() on new_type_plugin.
99 * Things may repeat from the second step.
100 * So basically, you need to implement a GTypePlugin type that carries a
101 * use_count, once use_count goes from zero to one, you need to load the
102 * implementation to successfully handle the upcoming
103 * g_type_plugin_complete_type_info() call. Later, maybe after succeeding
104 * use/unuse calls, once use_count drops to zero, you can unload the
105 * implementation again. The type system makes sure to call g_type_plugin_use()
106 * and g_type_plugin_complete_type_info() again when the type is needed again.
107 * GTypeModule is an implementation of GTypePlugin that already implements
108 * most of this except for the actual module loading and unloading. It even
109 * handles multiple registered types per module.
111 public class TypePlugin
114 /** the main Gtk struct */
115 protected GTypePlugin
* gTypePlugin
;
118 public GTypePlugin
* getTypePluginStruct()
124 /** the main Gtk struct as a void* */
125 protected void* getStruct()
127 return cast(void*)gTypePlugin
;
131 * Sets our main struct and passes it to the parent class
133 public this (GTypePlugin
* gTypePlugin
)
137 if ( gTypePlugin
is null )
142 Stdout("struct gTypePlugin is null on constructor").newline
;
146 printf("struct gTypePlugin is null on constructor");
153 assert(gTypePlugin
!is null, "struct gTypePlugin is null on constructor");
155 this.gTypePlugin
= gTypePlugin
;
168 * Calls the use_plugin function from the GTypePluginClass of plugin.
169 * There should be no need to use this function outside of the GObject
170 * type system itself.
176 // void g_type_plugin_use (GTypePlugin *plugin);
177 g_type_plugin_use(gTypePlugin
);
181 * Calls the unuse_plugin function from the GTypePluginClass of plugin.
182 * There should be no need to use this function outside of the GObject
183 * type system itself.
189 // void g_type_plugin_unuse (GTypePlugin *plugin);
190 g_type_plugin_unuse(gTypePlugin
);
194 * Calls the complete_type_info function from the GTypePluginClass of plugin.
195 * There should be no need to use this function outside of the GObject
196 * type system itself.
200 * the GType whose info is completed
202 * the GTypeInfo struct to fill in
204 * the GTypeValueTable to fill in
206 public void completeTypeInfo(GType gType
, GTypeInfo
* info
, GTypeValueTable
* valueTable
)
208 // void g_type_plugin_complete_type_info (GTypePlugin *plugin, GType g_type, GTypeInfo *info, GTypeValueTable *value_table);
209 g_type_plugin_complete_type_info(gTypePlugin
, gType
, info
, valueTable
);
213 * Calls the complete_interface_info function from the GTypePluginClass
214 * of plugin. There should be no need to use this function outside of the
215 * GObject type system itself.
219 * the GType of an instantiable type to which the interface
222 * the GType of the interface whose info is completed
224 * the GInterfaceInfo to fill in
226 * GTypeModule and g_type_register_dynamic().
228 public void completeInterfaceInfo(GType instanceType
, GType interfaceType
, GInterfaceInfo
* info
)
230 // void g_type_plugin_complete_interface_info (GTypePlugin *plugin, GType instance_type, GType interface_type, GInterfaceInfo *info);
231 g_type_plugin_complete_interface_info(gTypePlugin
, instanceType
, interfaceType
, info
);