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
23 # Definitions for wrapping GObject
31 public import gtkc.glibtypes;
58 # must start with wrap
86 ###########################################################
87 ### GObject ###############################################
88 ###########################################################
90 file: gobject-Type-Information.html
96 #structWrap: GType* Type
97 #import: gobject.TypeQuery
98 #structWrap: GTypeQuery* TypeQuery
99 #import: gobject.TypeInfo
100 #structWrap: GTypeInfo* TypeInfo
101 import: gobject.TypePlugin
102 structWrap: GTypePlugin* TypePlugin
103 #import: gobject.TypeFundamentalInfo
104 #structWrap: GTypeFundamentalInfo* TypeFundamentalInfo
105 #import: gobject.InterfaceInfo
106 #structWrap: GInterfaceInfo* InterfaceInfo
107 #import: gobject.TypeInstance
108 #structWrap: GTypeInstance* TypeInstance
109 #import: gobject.TypeValueTable
110 #structWrap: GTypeValueTable* TypeValueTable
113 file: GTypePlugin.html
116 prefix: g_type_plugin_
119 #import: gobject.TypeInfo
120 #structWrap: GTypeInfo* TypeInfo
121 #import: gobject.TypeValueTable
122 #structWrap: GTypeValueTable* TypeValueTable
123 #import: gobject.InterfaceInfo
124 #structWrap: GInterfaceInfo* InterfaceInfo
127 file: GTypeModule.html
131 prefix: g_type_module_
132 #import: gobject.TypeInfo
133 #structWrap: GTypeInfo* TypeInfo
134 #import: gobject.InterfaceInfo
135 #structWrap: GInterfaceInfo* InterfaceInfo
136 import: gobject.Enums
137 structWrap: GEnumValue* Enums
138 import: gobject.Flags
139 structWrap: GFlagsValue* Flags
142 file: gobject-The-Base-Object-Type.html
146 #import: gobject.ObjectClass
147 #structWrap: GObjectClass* ObjectClass
148 import: gobject.ParamSpec
149 structWrap: GParamSpec* ParamSpec
150 #import: gobject.ParamSpec*
151 #structWrap: GParamSpec** ParamSpec*
152 #import: gobject.Parameter
153 #structWrap: GParameter* Parameter
154 import: gobject.Value
155 structWrap: GValue* Value
156 import: gobject.Closure
157 structWrap: GClosure* Closure
162 nocode: g_object_set_data_full
168 * Sets our main struct and passes store it on the gobject.
169 * Add a gabage collector root to the gtk+ struct so it doesn't get collect
171 public this (GObject* gObject)
173 this.gObject = gObject;
174 if ( gObject !is null )
176 //writefln("ObjectG.this\n");
177 setDataFull("GObject",cast(void*)this);
182 * Sets a pointer on this object's has table
183 * @param key the data identifier
184 * @param data a pointer
186 public: void setDataFull(char[] key, gpointer data)
188 //writefln("setData objectG=%X data=%X type %s",gObject,data,key);
189 version(Tango) gc.addRoot(data);
190 else std.gc.addRoot(data);
191 g_object_set_data_full(gObject, Str.toStringz(key), data, cast(GDestroyNotify)&destroyNotify);
196 static void destroyNotify(gpointer* data)
198 //writefln("objectg.destroy entry");
199 //writefln("objectg.destroy");
200 //writefln("removing gc.root to %s",data);
201 version(Tango) gc.removeRoot(data);
202 else std.gc.removeRoot(data);
203 //writefln("objectg.destroy exit");
207 //debug = objectstore;
211 // private import std.stdio;
215 // * Maps Gtk structures to GtkD Objects
217 // private static ObjectStore objectStore;
220 // * Creates the statis ObjectStore object
224 // objectStore = new ObjectStore();
228 // * Sets our main struct and passes store it on the gobject.
229 // * Adds a gabage collector root to the gtk+ struct so it doesn't get collect
230 // * adds the object to the objectStore
232 // public this (GObject* gObject)
234 // this.gObject = gObject;
235 // if ( gObject !is null )
237 // //writefln("ObjectG.this\n");
238 // objectStore.putObject(this, gObject);
239 // setDestroyNotify("GObject",gObject);
246 // * Maintains the map from Gtk structures to GtkD objects
248 // private static class ObjectStore
250 // static ObjectG[void*] objectStore;
253 // * Puts a new gtk struct to GtkD objects
255 // void putObject(ObjectG objectG, GObject* gtkStruct)
257 // objectStore[gtkStruct] = objectG;
258 // debug(objectstore)
260 // writefln("ObjectStore.putObject gtkStruct = %s (total=%s)", gtkStruct, objectStore.length);
265 // * Gets a GtkD object from a gtk struct.
266 // * Returns: the GtkD object or null if not found
268 // ObjectG getObject(GObject* gtkStruct)
270 // ObjectG objectG = null;
271 // synchronized ( this )
273 // if ( gtkStruct in objectStore )
275 // objectG = objectStore[gtkStruct];
278 // debug(objectstore)
280 // //writefln("ObjectStore.removeObject objectStore.length = %s", objectStore.length);
281 // //writefln("ObjectStore.getObject gtkStruct = %s", gtkStruct);
282 // if ( objectG is null )
284 // writefln("ObjectStore.getObject not found");
288 // writefln("ObjectStore.getObject %s (total = %s)", objectG, objectStore.length);
295 // * Removes an entry from the gtk struct to GtkD object map
297 // void removeObject(GObject* gtkStruct)
299 // debug(objectstore)
301 // writefln("ObjectStore.removeObject gtkStruct = %s", gtkStruct);
302 // ObjectG objectG = getObject(gtkStruct);
303 // if ( objectG is null )
305 // writefln("ObjectStore.removeObject not found");
309 // writefln("ObjectStore.removeObject %s",
313 // objectStore.remove(gtkStruct);
314 // //objectStore.rehash;
315 // debug(objectstore)
317 // writefln("ObjectStore.removeObject objectStore.length = %s", objectStore.length);
323 // * Gets a GtkD object from a Gtk Structure if the GtkD object was already created for the structure
325 // public static ObjectG getStoredObject(GObject* gtkStruct)
327 // return objectStore.getObject(gtkStruct);
331 // * Sets a pointer on this object's has table
332 // * @param key the data identifier
333 // * @param data a pointer
335 // private void setDestroyNotify(char[] key, gpointer data)
337 // //writefln("setData objectG=%X data=%X type %s",gObject,data,key);
338 // //std.gc.addRoot(data);
340 // g_object_set_data_full(gObject, Str.toStringz(key), data, cast(GDestroyNotify)&destroyNotify);
345 // static void destroyNotify(gpointer data)
347 // //printf("objectg.destroy entry\n");
348 // //printf("objectg.destroy\n");
349 // //writefln("removing gc.root to %s",data);
350 // //std.gc.removeRoot(data);
352 // objectStore.removeObject(cast(GObject*)data);
353 // //objectStore.removeObject(cast(GObject*)*data);
355 // //printf("objectg.destroy exit\n");
358 public void setProperty(char[] propertyName, int value)
360 setProperty(propertyName, new Value(value));
363 public void setProperty(char[] propertyName, char[] value)
365 setProperty(propertyName, new Value(value));
368 public void setProperty(char[] propertyName, long value)
370 //We use g_object_set instead of g_object_set_property, because Value doesn't like longs and ulongs for some reason.
371 g_object_set( gObject, Str.toStringz(propertyName), value, null);
374 public void setProperty(char[] propertyName, ulong value)
376 g_object_set( gObject, Str.toStringz(propertyName), value, null);
383 file: gobject-Enumeration-and-Flag-Types.html
390 #import: gobject.EnumValue
391 #structWrap: GEnumValue* EnumValue
392 #import: gobject.TypeInfo
393 #structWrap: GTypeInfo* TypeInfo
402 import: gobject.Flags
403 structWrap: GFlagsValue* Flags
404 #import: gobject.TypeInfo
405 #structWrap: GTypeInfo* TypeInfo
408 file: gobject-Boxed-Types.html
414 file: gobject-Generic-values.html
420 import: gobject.Value
421 structWrap: GValue* Value
422 import: gobject.ParamSpec
423 structWrap: GParamSpec* ParamSpec
424 import: gobject.ObjectG
425 structWrap: GObject* ObjectG
429 nocode: g_value_reset
440 GValue* v = new GValue;
441 //v.g_type = DUIType.PIXBUF;
442 v.g_type = Pixbuf.getType();
443 v.data1.v_pointer = cast(void*)(pixbuf.getPixbufStruct());
462 * Initializes value with the default value of type.
464 * A zero-filled (uninitialized) GValue structure.
466 * Type the GValue should hold values of.
468 * the GValue structure that has been passed in
470 public Value init(GType gType)
472 // GValue* g_value_init (GValue *value, GType g_type);
473 g_value_init(gValue, gType);
478 * Clears the current value in value and resets it to the default value
479 * (as if the value had just been initialized).
481 * An initialized GValue structure.
483 * the GValue structure that has been passed in
487 // GValue* g_value_reset (GValue *value);
488 g_value_reset(gValue);
498 file: gobject-Standard-Parameter-and-Value-Types.html
500 #import: gobject.Value
504 #file: gobject-Varargs-Value-Collection.html
509 file: gobject-GParamSpec.html
512 prefix: g_param_spec_
514 import: gobject.ParamSpec
515 structWrap: GParamSpec* ParamSpec
516 import: gobject.Value
517 structWrap: GValue* Value
518 #import: gobject.ParamSpecTypeInfo
519 #structWrap: GParamSpecTypeInfo* ParamSpecTypeInfo
520 #import: gobject.ParamSpecPool
521 #structWrap: GParamSpecPool* ParamSpecPool
522 #import: gobject.ParamSpec*
523 #structWrap: GParamSpec** ParamSpec*
525 structWrap: GList* ListG
528 file: gobject-Signals.html
532 import: gobject.Closure
533 structWrap: GClosure* Closure
535 #structWrap: GType* Type
536 #import: gobject.SignalQuery
537 #structWrap: GSignalQuery* SignalQuery
538 import: gobject.Value
539 structWrap: GValue* Value
541 structWrap: GQuark* Quark
542 #import: gobject.SignalInvocationHint
543 #structWrap: GSignalInvocationHint* SignalInvocationHint
548 public static uint connectData(void* instanc, char[] detailedSignal, GCallback cHandler, Object data, GClosureNotify destroyData, GConnectFlags connectFlags)
550 // gulong g_signal_connect_data (gpointer instance, const gchar *detailed_signal, GCallback c_handler, gpointer data, GClosureNotify destroy_data, GConnectFlags connect_flags);
551 return g_signal_connect_data(instanc, Str.toStringz(detailedSignal), cHandler, cast(void*)data, destroyData, connectFlags);
559 file: gobject-Closures.html
565 import: gobject.ObjectG
566 structWrap: GObject* ObjectG
567 import: gobject.Closure
568 structWrap: GClosure* Closure
569 import: gobject.Value
570 structWrap: GValue* Value
572 structWrap: GSource* Source
580 noprefix: g_source_set_closure
581 import: gobject.Closure
582 structWrap: GClosure* Closure
583 import: gobject.ObjectG
584 structWrap: GObject* ObjectG
585 import: gobject.Value
586 structWrap: GValue* Value
589 file: gobject-Value-arrays.html
592 prefix: g_value_array_
593 import: gobject.Value
594 structWrap: GValue* Value
595 import: gobject.ValueArray
596 structWrap: GValueArray* ValueArray