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  = GTypeModule.html
27  * outPack = gobject
28  * outFile = TypeModule
29  * strct   = GTypeModule
30  * realStrct=
31  * ctorStrct=
32  * clss    = TypeModule
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_type_module_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- gobject.Enums
48  * 	- gobject.Flags
49  * structWrap:
50  * 	- GEnumValue* -> Enums
51  * 	- GFlagsValue* -> Flags
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module gobject.TypeModule;
58 
59 public  import gtkc.gobjecttypes;
60 
61 private import gtkc.gobject;
62 private import glib.ConstructionException;
63 private import gobject.ObjectG;
64 
65 
66 private import glib.Str;
67 private import gobject.Enums;
68 private import gobject.Flags;
69 
70 
71 
72 private import gobject.ObjectG;
73 
74 /**
75  * Description
76  * GTypeModule provides a simple implementation of the GTypePlugin
77  * interface. The model of GTypeModule is a dynamically loaded module
78  * which implements some number of types and interface
79  * implementations. When the module is loaded, it registers its types
80  * and interfaces using g_type_module_register_type() and
81  * g_type_module_add_interface(). As long as any instances of these
82  * types and interface implementations are in use, the module is kept
83  * loaded. When the types and interfaces are gone, the module may be
84  * unloaded. If the types and interfaces become used again, the module
85  * will be reloaded. Note that the last unref can not happen in module
86  * code, since that would lead to the caller's code being unloaded before
87  * g_object_unref() returns to it.
88  * Keeping track of whether the module should be loaded or not is done by
89  * using a use count - it starts at zero, and whenever it is greater than
90  * zero, the module is loaded. The use count is maintained internally by
91  * the type system, but also can be explicitly controlled by
92  * g_type_module_use() and g_type_module_unuse(). Typically, when loading
93  * a module for the first type, g_type_module_use() will be used to load
94  * it so that it can initialize its types. At some later point, when the
95  * module no longer needs to be loaded except for the type
96  * implementations it contains, g_type_module_unuse() is called.
97  * GTypeModule does not actually provide any implementation of module
98  * loading and unloading. To create a particular module type you must
99  * derive from GTypeModule and implement the load and unload functions
100  * in GTypeModuleClass.
101  */
102 public class TypeModule : ObjectG
103 {
104 	
105 	/** the main Gtk struct */
106 	protected GTypeModule* gTypeModule;
107 	
108 	
109 	public GTypeModule* getTypeModuleStruct()
110 	{
111 		return gTypeModule;
112 	}
113 	
114 	
115 	/** the main Gtk struct as a void* */
116 	protected override void* getStruct()
117 	{
118 		return cast(void*)gTypeModule;
119 	}
120 	
121 	/**
122 	 * Sets our main struct and passes it to the parent class
123 	 */
124 	public this (GTypeModule* gTypeModule)
125 	{
126 		super(cast(GObject*)gTypeModule);
127 		this.gTypeModule = gTypeModule;
128 	}
129 	
130 	protected override void setStruct(GObject* obj)
131 	{
132 		super.setStruct(obj);
133 		gTypeModule = cast(GTypeModule*)obj;
134 	}
135 	
136 	/**
137 	 */
138 	
139 	/**
140 	 * Increases the use count of a GTypeModule by one. If the
141 	 * use count was zero before, the plugin will be loaded.
142 	 * If loading the plugin fails, the use count is reset to
143 	 * its prior value.
144 	 * Returns: FALSE if the plugin needed to be loaded and loading the plugin failed.
145 	 */
146 	public int use()
147 	{
148 		// gboolean g_type_module_use (GTypeModule *module);
149 		return g_type_module_use(gTypeModule);
150 	}
151 	
152 	/**
153 	 * Decreases the use count of a GTypeModule by one. If the
154 	 * result is zero, the module will be unloaded. (However, the
155 	 * GTypeModule will not be freed, and types associated with the
156 	 * GTypeModule are not unregistered. Once a GTypeModule is
157 	 * initialized, it must exist forever.)
158 	 */
159 	public void unuse()
160 	{
161 		// void g_type_module_unuse (GTypeModule *module);
162 		g_type_module_unuse(gTypeModule);
163 	}
164 	
165 	/**
166 	 * Sets the name for a GTypeModule
167 	 * Params:
168 	 * name = a human-readable name to use in error messages.
169 	 */
170 	public void setName(string name)
171 	{
172 		// void g_type_module_set_name (GTypeModule *module,  const gchar *name);
173 		g_type_module_set_name(gTypeModule, Str.toStringz(name));
174 	}
175 	
176 	/**
177 	 * Looks up or registers a type that is implemented with a particular
178 	 * type plugin. If a type with name type_name was previously registered,
179 	 * the GType identifier for the type is returned, otherwise the type
180 	 * is newly registered, and the resulting GType identifier returned.
181 	 * When reregistering a type (typically because a module is unloaded
182 	 * then reloaded, and reinitialized), module and parent_type must
183 	 * be the same as they were previously.
184 	 * As long as any instances of the type exist, the type plugin will
185 	 * not be unloaded.
186 	 * Params:
187 	 * parentType = the type for the parent class
188 	 * typeName = name for the type
189 	 * typeInfo = type information structure
190 	 * flags = flags field providing details about the type
191 	 * Returns: the new or existing type ID
192 	 */
193 	public GType registerType(GType parentType, string typeName, GTypeInfo* typeInfo, GTypeFlags flags)
194 	{
195 		// GType g_type_module_register_type (GTypeModule *module,  GType parent_type,  const gchar *type_name,  const GTypeInfo *type_info,  GTypeFlags flags);
196 		return g_type_module_register_type(gTypeModule, parentType, Str.toStringz(typeName), typeInfo, flags);
197 	}
198 	
199 	/**
200 	 * Registers an additional interface for a type, whose interface lives
201 	 * in the given type plugin. If the interface was already registered
202 	 * for the type in this plugin, nothing will be done.
203 	 * As long as any instances of the type exist, the type plugin will
204 	 * not be unloaded.
205 	 * Params:
206 	 * instanceType = type to which to add the interface.
207 	 * interfaceType = interface type to add
208 	 * interfaceInfo = type information structure
209 	 */
210 	public void addInterface(GType instanceType, GType interfaceType, GInterfaceInfo* interfaceInfo)
211 	{
212 		// void g_type_module_add_interface (GTypeModule *module,  GType instance_type,  GType interface_type,  const GInterfaceInfo *interface_info);
213 		g_type_module_add_interface(gTypeModule, instanceType, interfaceType, interfaceInfo);
214 	}
215 	
216 	/**
217 	 * Looks up or registers an enumeration that is implemented with a particular
218 	 * type plugin. If a type with name type_name was previously registered,
219 	 * the GType identifier for the type is returned, otherwise the type
220 	 * is newly registered, and the resulting GType identifier returned.
221 	 * As long as any instances of the type exist, the type plugin will
222 	 * not be unloaded.
223 	 * Since 2.6
224 	 * Params:
225 	 * name = name for the type
226 	 * Returns: the new or existing type ID
227 	 */
228 	public GType registerEnum(string name, Enums _StaticValues)
229 	{
230 		// GType g_type_module_register_enum (GTypeModule *module,  const gchar *name,  const GEnumValue *const_static_values);
231 		return g_type_module_register_enum(gTypeModule, Str.toStringz(name), (_StaticValues is null) ? null : _StaticValues.getEnumsStruct());
232 	}
233 	
234 	/**
235 	 * Looks up or registers a flags type that is implemented with a particular
236 	 * type plugin. If a type with name type_name was previously registered,
237 	 * the GType identifier for the type is returned, otherwise the type
238 	 * is newly registered, and the resulting GType identifier returned.
239 	 * As long as any instances of the type exist, the type plugin will
240 	 * not be unloaded.
241 	 * Since 2.6
242 	 * Params:
243 	 * name = name for the type
244 	 * Returns: the new or existing type ID
245 	 */
246 	public GType registerFlags(string name, Flags _StaticValues)
247 	{
248 		// GType g_type_module_register_flags (GTypeModule *module,  const gchar *name,  const GFlagsValue *const_static_values);
249 		return g_type_module_register_flags(gTypeModule, Str.toStringz(name), (_StaticValues is null) ? null : _StaticValues.getFlagsStruct());
250 	}
251 }