2 # This file is part of duit.
4 # duit 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 # duit 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 duit; 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 glib.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",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 std.gc.addRoot(data);
190 g_object_set_data_full(gObject, Str.toStringz(key), data, cast(GDestroyNotify)&destroyNotify);
195 static void destroyNotify(gpointer* data)
197 //writefln("objectg.destroy entry");
198 //writefln("objectg.destroy");
199 //writefln("removing gc.root to %s",data);
200 std.gc.removeRoot(data);
201 //writefln("objectg.destroy exit");
205 //debug = objectstore;
209 // private import std.stdio;
213 // * Maps Gtk structures to Duit Objects
215 // private static ObjectStore objectStore;
218 // * Creates the statis ObjectStore object
222 // objectStore = new ObjectStore();
226 // * Sets our main struct and passes store it on the gobject.
227 // * Adds a gabage collector root to the gtk+ struct so it doesn't get collect
228 // * adds the object to the objectStore
230 // public this (GObject* gObject)
232 // this.gObject = gObject;
233 // if ( gObject !is null )
235 // //writefln("ObjectG.this\n");
236 // objectStore.putObject(this, gObject);
237 // setDestroyNotify("GObject",gObject);
244 // * Maintains the map from Gtk structures to Duit objects
246 // private static class ObjectStore
248 // static ObjectG[void*] objectStore;
251 // * Puts a new gtk struct to Duit objects
253 // void putObject(ObjectG objectG, GObject* gtkStruct)
255 // objectStore[gtkStruct] = objectG;
256 // debug(objectstore)
258 // writefln("ObjectStore.putObject gtkStruct = %s (total=%s)", gtkStruct, objectStore.length);
263 // * Gets a Duit object from a gtk struct.
264 // * Returns: the Duit object or null if not found
266 // ObjectG getObject(GObject* gtkStruct)
268 // ObjectG objectG = null;
269 // synchronized ( this )
271 // if ( gtkStruct in objectStore )
273 // objectG = objectStore[gtkStruct];
276 // debug(objectstore)
278 // //writefln("ObjectStore.removeObject objectStore.length = %s", objectStore.length);
279 // //writefln("ObjectStore.getObject gtkStruct = %s", gtkStruct);
280 // if ( objectG is null )
282 // writefln("ObjectStore.getObject not found");
286 // writefln("ObjectStore.getObject %s (total = %s)", objectG, objectStore.length);
293 // * Removes an entry from the gtk struct to Duit object map
295 // void removeObject(GObject* gtkStruct)
297 // debug(objectstore)
299 // writefln("ObjectStore.removeObject gtkStruct = %s", gtkStruct);
300 // ObjectG objectG = getObject(gtkStruct);
301 // if ( objectG is null )
303 // writefln("ObjectStore.removeObject not found");
307 // writefln("ObjectStore.removeObject %s",
311 // objectStore.remove(gtkStruct);
312 // //objectStore.rehash;
313 // debug(objectstore)
315 // writefln("ObjectStore.removeObject objectStore.length = %s", objectStore.length);
321 // * Gets a Duit object from a Gtk Structure if the Duit object was already created for the structure
323 // public static ObjectG getStoredObject(GObject* gtkStruct)
325 // return objectStore.getObject(gtkStruct);
329 // * Sets a pointer on this object's has table
330 // * @param key the data identifier
331 // * @param data a pointer
333 // private void setDestroyNotify(char[] key, gpointer data)
335 // //writefln("setData objectG=%X data=%X type %s",gObject,data,key);
336 // //std.gc.addRoot(data);
338 // g_object_set_data_full(gObject, Str.toStringz(key), data, cast(GDestroyNotify)&destroyNotify);
343 // static void destroyNotify(gpointer data)
345 // //printf("objectg.destroy entry\n");
346 // //printf("objectg.destroy\n");
347 // //writefln("removing gc.root to %s",data);
348 // //std.gc.removeRoot(data);
350 // objectStore.removeObject(cast(GObject*)data);
351 // //objectStore.removeObject(cast(GObject*)*data);
353 // //printf("objectg.destroy exit\n");
356 public void setProperty(char[] propertyName, int value)
358 setProperty(propertyName, new Value(value));
361 public void setProperty(char[] propertyName, char[] value)
363 setProperty(propertyName, new Value(value));
371 file: gobject-Enumeration-and-Flag-Types.html
378 #import: gobject.EnumValue
379 #structWrap: GEnumValue* EnumValue
380 #import: gobject.TypeInfo
381 #structWrap: GTypeInfo* TypeInfo
390 import: gobject.Flags
391 structWrap: GFlagsValue* Flags
392 #import: gobject.TypeInfo
393 #structWrap: GTypeInfo* TypeInfo
396 file: gobject-Boxed-Types.html
402 file: gobject-Generic-values.html
408 import: gobject.Value
409 structWrap: GValue* Value
410 import: gobject.ParamSpec
411 structWrap: GParamSpec* ParamSpec
412 import: gobject.ObjectG
413 structWrap: GObject* ObjectG
417 nocode: g_value_reset
428 GValue* v = new GValue;
429 //v.g_type = DUIType.PIXBUF;
430 v.g_type = Pixbuf.getType();
431 v.data1.v_pointer = cast(void*)(pixbuf.getPixbufStruct());
450 * Initializes value with the default value of type.
452 * A zero-filled (uninitialized) GValue structure.
454 * Type the GValue should hold values of.
456 * the GValue structure that has been passed in
458 public Value init(GType gType)
460 // GValue* g_value_init (GValue *value, GType g_type);
461 g_value_init(gValue, gType);
466 * Clears the current value in value and resets it to the default value
467 * (as if the value had just been initialized).
469 * An initialized GValue structure.
471 * the GValue structure that has been passed in
475 // GValue* g_value_reset (GValue *value);
476 g_value_reset(gValue);
486 file: gobject-Standard-Parameter-and-Value-Types.html
488 #import: gobject.Value
492 #file: gobject-Varargs-Value-Collection.html
497 file: gobject-GParamSpec.html
500 prefix: g_param_spec_
502 import: gobject.ParamSpec
503 structWrap: GParamSpec* ParamSpec
504 import: gobject.Value
505 structWrap: GValue* Value
506 #import: gobject.ParamSpecTypeInfo
507 #structWrap: GParamSpecTypeInfo* ParamSpecTypeInfo
508 #import: gobject.ParamSpecPool
509 #structWrap: GParamSpecPool* ParamSpecPool
510 #import: gobject.ParamSpec*
511 #structWrap: GParamSpec** ParamSpec*
513 structWrap: GList* ListG
516 file: gobject-Signals.html
520 import: gobject.Closure
521 structWrap: GClosure* Closure
523 #structWrap: GType* Type
524 #import: gobject.SignalQuery
525 #structWrap: GSignalQuery* SignalQuery
526 import: gobject.Value
527 structWrap: GValue* Value
529 structWrap: GQuark* Quark
530 #import: gobject.SignalInvocationHint
531 #structWrap: GSignalInvocationHint* SignalInvocationHint
534 file: gobject-Closures.html
540 import: gobject.ObjectG
541 structWrap: GObject* ObjectG
542 import: gobject.Closure
543 structWrap: GClosure* Closure
544 import: gobject.Value
545 structWrap: GValue* Value
547 structWrap: GSource* Source
555 noprefix: g_source_set_closure
556 import: gobject.Closure
557 structWrap: GClosure* Closure
558 import: gobject.ObjectG
559 structWrap: GObject* ObjectG
560 import: gobject.Value
561 structWrap: GValue* Value
564 file: gobject-Value-arrays.html
567 prefix: g_value_array_
568 import: gobject.Value
569 structWrap: GValue* Value
570 import: gobject.ValueArray
571 structWrap: GValueArray* ValueArray