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 = GTypeModule.html
27 * outFile = TypeModule
48 * - GEnumValue* -> Enums
49 * - GFlagsValue* -> Flags
54 module gobject
.TypeModule
;
60 import tango
.io
.Stdout
; // use the tango loging?
64 private import gtkc
.gobjecttypes
;
66 private import gtkc
.gobject
;
69 private import glib
.Str
;
70 private import gobject
.Enums
;
71 private import gobject
.Flags
;
78 * GTypeModule provides a simple implementation of the GTypePlugin
79 * interface. The model of GTypeModule is a dynamically loaded module
80 * which implements some number of types and interface
81 * implementations. When the module is loaded, it registers its types
82 * and interfaces using g_type_module_register_type() and
83 * g_type_module_add_interface(). As long as any instances of these
84 * types and interface implementations are in use, the module is kept
85 * loaded. When the types and interfaces are gone, the module may be
86 * unloaded. If the types and interfaces become used again, the module
87 * will be reloaded. Note that the last unref can not happen in module
88 * code, since that would lead to the caller's code being unloaded before
89 * g_object_unref() returns to it.
90 * Keeping track of whether the module should be loaded or not is done by
91 * using a use count - it starts at zero, and whenever it is greater than
92 * zero, the module is loaded. The use count is maintained internally by
93 * the type system, but also can be explicitly controlled by
94 * g_type_module_use() and g_type_module_unuse(). Typically, when loading
95 * a module for the first type, g_type_module_use() will be used to load
96 * it so that it can initialize its types. At some later point, when the
97 * module no longer needs to be loaded except for the type
98 * implementations it contains, g_type_module_unuse() is called.
99 * GTypeModule does not actually provide any implementation of module
100 * loading and unloading. To create a particular module type you must
101 * derive from GTypeModule and implement the load and unload functions
102 * in GTypeModuleClass.
104 private import gobject
.ObjectG
;
105 public class TypeModule
: ObjectG
108 /** the main Gtk struct */
109 protected GTypeModule
* gTypeModule
;
112 public GTypeModule
* getTypeModuleStruct()
118 /** the main Gtk struct as a void* */
119 protected void* getStruct()
121 return cast(void*)gTypeModule
;
125 * Sets our main struct and passes it to the parent class
127 public this (GTypeModule
* gTypeModule
)
131 if ( gTypeModule
is null )
136 Stdout("struct gTypeModule is null on constructor").newline
;
140 printf("struct gTypeModule is null on constructor");
147 assert(gTypeModule
!is null, "struct gTypeModule is null on constructor");
149 super(cast(GObject
*)gTypeModule
);
150 this.gTypeModule
= gTypeModule
;
159 * Increases the use count of a GTypeModule by one. If the
160 * use count was zero before, the plugin will be loaded.
164 * FALSE if the plugin needed to be loaded and
165 * loading the plugin failed.
169 // gboolean g_type_module_use (GTypeModule *module);
170 return g_type_module_use(gTypeModule
);
174 * Decreases the use count of a GTypeModule by one. If the
175 * result is zero, the module will be unloaded. (However, the
176 * GTypeModule will not be freed, and types associated with the
177 * GTypeModule are not unregistered. Once a GTypeModule is
178 * initialized, it must exist forever.)
184 // void g_type_module_unuse (GTypeModule *module);
185 g_type_module_unuse(gTypeModule
);
189 * Sets the name for a GTypeModule
193 * a human-readable name to use in error messages.
195 public void setName(char[] name
)
197 // void g_type_module_set_name (GTypeModule *module, const gchar *name);
198 g_type_module_set_name(gTypeModule
, Str
.toStringz(name
));
202 * Looks up or registers a type that is implemented with a particular
203 * type plugin. If a type with name type_name was previously registered,
204 * the GType identifier for the type is returned, otherwise the type
205 * is newly registered, and the resulting GType identifier returned.
206 * When reregistering a type (typically because a module is unloaded
207 * then reloaded, and reinitialized), module and parent_type must
208 * be the same as they were previously.
209 * As long as any instances of the type exist, the type plugin will
214 * the type for the parent class
218 * type information structure
220 * flags field providing details about the type
222 * the new or existing type ID
224 public GType
registerType(GType parentType
, char[] typeName
, GTypeInfo
* typeInfo
, GTypeFlags flags
)
226 // GType g_type_module_register_type (GTypeModule *module, GType parent_type, const gchar *type_name, const GTypeInfo *type_info, GTypeFlags flags);
227 return g_type_module_register_type(gTypeModule
, parentType
, Str
.toStringz(typeName
), typeInfo
, flags
);
231 * Registers an additional interface for a type, whose interface
232 * lives in the given type plugin. If the interface was already registered
233 * for the type in this plugin, nothing will be done.
234 * As long as any instances of the type exist, the type plugin will
239 * type to which to add the interface.
241 * interface type to add
243 * type information structure
245 public void addInterface(GType instanceType
, GType interfaceType
, GInterfaceInfo
* interfaceInfo
)
247 // void g_type_module_add_interface (GTypeModule *module, GType instance_type, GType interface_type, const GInterfaceInfo *interface_info);
248 g_type_module_add_interface(gTypeModule
, instanceType
, interfaceType
, interfaceInfo
);
252 * Looks up or registers an enumeration that is implemented with a particular
253 * type plugin. If a type with name type_name was previously registered,
254 * the GType identifier for the type is returned, otherwise the type
255 * is newly registered, and the resulting GType identifier returned.
256 * As long as any instances of the type exist, the type plugin will
264 * the new or existing type ID
267 public GType
registerEnum(char[] name
, Enums _StaticValues
)
269 // GType g_type_module_register_enum (GTypeModule *module, const gchar *name, const GEnumValue *const _static_values);
270 return g_type_module_register_enum(gTypeModule
, Str
.toStringz(name
), (_StaticValues
is null) ?
null : _StaticValues
.getEnumsStruct());
274 * Looks up or registers a flags type that is implemented with a particular
275 * type plugin. If a type with name type_name was previously registered,
276 * the GType identifier for the type is returned, otherwise the type
277 * is newly registered, and the resulting GType identifier returned.
278 * As long as any instances of the type exist, the type plugin will
286 * the new or existing type ID
289 public GType
registerFlags(char[] name
, Flags _StaticValues
)
291 // GType g_type_module_register_flags (GTypeModule *module, const gchar *name, const GFlagsValue *const _static_values);
292 return g_type_module_register_flags(gTypeModule
, Str
.toStringz(name
), (_StaticValues
is null) ?
null : _StaticValues
.getFlagsStruct());