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