alternative to assert
[gtkD.git] / wrap / APILookupGObject.txt
blob15a6c781f22d20a214c374b7d39a767fcb01de4f
2 # This file is part of duit.
3
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.
8
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.
13
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
21 ###
22 #####
23 # Definitions for wrapping GObject
24 #####
25 ###
29 addTypedefs: start
31 public import glib.glibtypes;
33 addTypedefs: end
35 addAliases: start
36 addAliases: end
38 addEnums: start
39 addEnums: end
41 addStructs: start
42 addStructs: end
44 addTypes: start
45 addTypes: end
47 addFuncts: start
48 addFuncts: end
50 addUnions: start
51 addUnions: end
53 addConstants: start
54 addConstants: end
58 # must start with wrap
60 addStructs: start
61 struct GValue
63         align(4)
64         {
65                 GType           g_type;
66                 union Data
67                 {
68                         gint    v_int;
69                         guint   v_uint;
70                         glong   v_long;
71                         gulong  v_ulong;
72                         gint64      v_int64;
73                         guint64     v_uint64;
74                         gfloat  v_float;
75                         gdouble v_double;
76                         gpointer        v_pointer;
77                 };
78         }
79         Data data1;
80         Data data2;
82 addStructs: end
84 wrap: gobject
86 ###########################################################
87 ### GObject ###############################################
88 ###########################################################
90 file: gobject-Type-Information.html
91 class: Type
92 prefix: g_type_
93 import: glib.Str
94 import: glib.Quark
95 import: gobject.Type
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
111 outFile: Type
113 file: GTypePlugin.html
114 struct: GTypePlugin
115 class: TypePlugin
116 prefix: g_type_plugin_
117 import: glib.Str
118 import: gobject.Type
119 #import: gobject.TypeInfo
120 #structWrap: GTypeInfo* TypeInfo
121 #import: gobject.TypeValueTable
122 #structWrap: GTypeValueTable* TypeValueTable
123 #import: gobject.InterfaceInfo
124 #structWrap: GInterfaceInfo* InterfaceInfo
125 outFile: TypePlugin
127 file: GTypeModule.html
128 struct: GTypeModule
129 class: TypeModule
130 import: glib.Str
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
140 outFile: TypeModule
142 file: gobject-The-Base-Object-Type.html
143 struct: GObject
144 class: ObjectG
145 prefix: g_object_
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
158 import: std.gc
159 import: glib.Str
162 nocode: g_object_set_data_full
164 code: start
167         /**
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
170         */
171         public this (GObject* gObject)
172         {
173                 this.gObject = gObject;
174                 if ( gObject !is  null )
175                 {
176                         //writefln("ObjectG.this\n");
177                         setDataFull("GObject",this);
178                 }
179         }
180         
181         /**
182         * Sets a pointer on this object's has table
183         * @param key the data identifier
184         * @param data a pointer
185         */
186         public: void setDataFull(char[] key, gpointer data)
187         {
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);
191         }
192         
193         extern(C)
194         {
195                 static void destroyNotify(gpointer* data)
196                 {
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");
202                 }
203         }
205 //debug = objectstore;
207 //debug(objectstore)
209 //      private import std.stdio;
212 //      /**
213 //       * Maps Gtk structures to Duit Objects
214 //       */
215 //      private static ObjectStore objectStore;
216 //      
217 //      /**
218 //       * Creates the statis ObjectStore object
219 //       */
220 //      static this()
221 //      {
222 //              objectStore = new ObjectStore();
223 //      }
224 //      
225 //      /**
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
229 //       */
230 //      public this (GObject* gObject)
231 //      {
232 //              this.gObject = gObject;
233 //              if ( gObject !is  null )
234 //              {
235 //                      //writefln("ObjectG.this\n");
236 //                      objectStore.putObject(this, gObject);
237 //                      setDestroyNotify("GObject",gObject);
238 //              }
239 //      }
240 //      
242 //      
243 //      /**
244 //       * Maintains the map from Gtk structures to Duit objects
245 //       */
246 //      private static class ObjectStore
247 //      {
248 //              static ObjectG[void*] objectStore;
249 //              
250 //              /**
251 //               * Puts a new gtk struct to Duit objects
252 //               */
253 //              void putObject(ObjectG objectG, GObject* gtkStruct)
254 //              {
255 //                      objectStore[gtkStruct] = objectG;
256 //                      debug(objectstore)
257 //                      {
258 //                              writefln("ObjectStore.putObject gtkStruct = %s (total=%s)", gtkStruct, objectStore.length);
259 //                      }
260 //              }
261 //              
262 //              /**
263 //               * Gets a Duit object from a gtk struct.
264 //               * Returns: the Duit object or null if not found
265 //               */
266 //              ObjectG getObject(GObject* gtkStruct)
267 //              {
268 //                      ObjectG objectG = null;
269 //                      synchronized ( this )
270 //                      {
271 //                              if ( gtkStruct in objectStore )
272 //                              {
273 //                                      objectG = objectStore[gtkStruct];
274 //                              }
275 //                      }
276 //                      debug(objectstore)
277 //                      {
278 //                              //writefln("ObjectStore.removeObject objectStore.length = %s", objectStore.length);
279 //                              //writefln("ObjectStore.getObject gtkStruct = %s", gtkStruct);
280 //                              if ( objectG is null )
281 //                              {
282 //                                      writefln("ObjectStore.getObject not found");
283 //                              }
284 //                              else
285 //                              {
286 //                                      writefln("ObjectStore.getObject %s (total = %s)", objectG, objectStore.length);
287 //                              }
288 //                      }
289 //                      return objectG;
290 //              }
291 //              
292 //              /**
293 //               * Removes an entry from the gtk struct to Duit object map
294 //               */
295 //              void removeObject(GObject* gtkStruct)
296 //              {
297 //                      debug(objectstore)
298 //                      {
299 //                              writefln("ObjectStore.removeObject gtkStruct = %s", gtkStruct);
300 //                              ObjectG objectG = getObject(gtkStruct);
301 //                              if ( objectG is null )
302 //                              {
303 //                                      writefln("ObjectStore.removeObject not found");
304 //                              }
305 //                              else
306 //                              {
307 //                                      writefln("ObjectStore.removeObject %s",
308 //                                      objectG);
309 //                              }
310 //                      }
311 //                      objectStore.remove(gtkStruct);
312 //                      //objectStore.rehash;
313 //                      debug(objectstore)
314 //                      {
315 //                              writefln("ObjectStore.removeObject objectStore.length = %s", objectStore.length);
316 //                      }
317 //              }
318 //      }
320 //      /**
321 //       * Gets a Duit object from a Gtk Structure if the Duit object was already created for the structure
322 //       */
323 //      public static ObjectG getStoredObject(GObject* gtkStruct)
324 //      {
325 //              return objectStore.getObject(gtkStruct);
326 //      }
327 //      
328 //      /**
329 //       * Sets a pointer on this object's has table
330 //       * @param key the data identifier
331 //       * @param data a pointer
332 //       */
333 //      private void setDestroyNotify(char[] key, gpointer data)
334 //      {
335 //              //writefln("setData objectG=%X data=%X type %s",gObject,data,key);
336 //              //std.gc.addRoot(data);
337 //              
338 //              g_object_set_data_full(gObject, Str.toStringz(key), data, cast(GDestroyNotify)&destroyNotify);
339 //      }
340 //      
341 //      private extern(C)
342 //      {
343 //              static void destroyNotify(gpointer data)
344 //              {
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);
352 //                      
353 //                      //printf("objectg.destroy exit\n");
354 //              }
355 //      }
356         public void setProperty(char[] propertyName, int value)
357         {
358                 setProperty(propertyName, new Value(value));
359         }
360         
361         public void setProperty(char[] propertyName, char[] value)
362         {
363                 setProperty(propertyName, new Value(value));
364         }
365         
367 code: end
369 outFile: ObjectG
371 file: gobject-Enumeration-and-Flag-Types.html
373 struct: GEnumValue
374 class: Enums
375 prefix: g_enum_
376 noprefix: g_flags_
377 import: glib.Str
378 #import: gobject.EnumValue
379 #structWrap: GEnumValue* EnumValue
380 #import: gobject.TypeInfo
381 #structWrap: GTypeInfo* TypeInfo
382 outFile: Enums
384 struct: GFlagsValue
385 strictPrefix: Y
386 class: Flags
387 prefix: g_flags_
388 noprefix: g_enum_
389 import: glib.Str
390 import: gobject.Flags
391 structWrap: GFlagsValue* Flags
392 #import: gobject.TypeInfo
393 #structWrap: GTypeInfo* TypeInfo
394 outFile: Flags
396 file: gobject-Boxed-Types.html
397 class: Boxed
398 prefix: g_
399 import: glib.Str
400 outFile: Boxed
402 file: gobject-Generic-values.html
403 struct: GValue
404 class: Value
405 nostruct: GValue
406 prefix: g_value_
407 import: glib.Str
408 import: gobject.Value
409 structWrap: GValue* Value
410 import: gobject.ParamSpec
411 structWrap: GParamSpec* ParamSpec
412 import: gobject.ObjectG
413 structWrap: GObject* ObjectG
414 import: gdk.Pixbuf
416 nocode: g_value_init
417 nocode: g_value_reset
419 code: start
421         public this()
422         {
423                 this(new GValue);
424         }
425         
426         this(Pixbuf pixbuf)
427         {
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());
432                 this(v);
433         }
434         
435         this(char[] value)
436         {
437                 this();
438                 init(GType.STRING);
439                 setString(value);
440         }
442         this(int value)
443         {
444                 this();
445                 init(GType.INT);
446                 setInt(value);
447         }
448         
449         /**
450          * Initializes value with the default value of type.
451          * value:
452          * A zero-filled (uninitialized) GValue structure.
453          * g_type:
454          * Type the GValue should hold values of.
455          * Returns:
456          * the GValue structure that has been passed in
457          */
458         public Value init(GType gType)
459         {
460                 // GValue* g_value_init (GValue *value,  GType g_type);
461                 g_value_init(gValue, gType);
462                 return this;
463         }
464         
465         /**
466          * Clears the current value in value and resets it to the default value
467          * (as if the value had just been initialized).
468          * value:
469          * An initialized GValue structure.
470          * Returns:
471          * the GValue structure that has been passed in
472          */
473         public Value reset()
474         {
475                 // GValue* g_value_reset (GValue *value);
476                 g_value_reset(gValue);
477                 return this;
478         }
479         
482 code: end
484 openFile: Value
486 file: gobject-Standard-Parameter-and-Value-Types.html
487 #class: Value
488 #import: gobject.Value
489 #prefix: g_
490 closeFile: Value
492 #file: gobject-Varargs-Value-Collection.html
493 #class: 
494 #prefix: 
495 #outFile: 
497 file: gobject-GParamSpec.html
498 struct: GParamSpec
499 class: ParamSpec
500 prefix: g_param_spec_
501 import: glib.Str
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*
512 import: glib.ListG
513 structWrap: GList* ListG
514 outFile: ParamSpec
516 file: gobject-Signals.html
517 class: Signals
518 prefix: g_signal_
519 import: glib.Str
520 import: gobject.Closure
521 structWrap: GClosure* Closure
522 import: gobject.Type
523 #structWrap: GType* Type
524 #import: gobject.SignalQuery
525 #structWrap: GSignalQuery* SignalQuery
526 import: gobject.Value
527 structWrap: GValue* Value
528 import: glib.Quark
529 structWrap: GQuark* Quark
530 #import: gobject.SignalInvocationHint
531 #structWrap: GSignalInvocationHint* SignalInvocationHint
532 outFile: Signals
534 file: gobject-Closures.html
536 struct: GClosure
537 class: Closure
538 prefix: g_closure_
539 noprefix: g_cclosure
540 import: gobject.ObjectG
541 structWrap: GObject* ObjectG
542 import: gobject.Closure
543 structWrap: GClosure* Closure
544 import: gobject.Value
545 structWrap: GValue* Value
546 import: glib.Source
547 structWrap: GSource* Source
548 outFile: Closure
550 struct: GCClosure
551 class: CClosure
552 prefix: g_cclosure
553 strictPrefix: Yes
554 noprefix: g_closure_
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
562 outFile: CClosure
564 file: gobject-Value-arrays.html
565 struct: GValueArray
566 class: ValueArray
567 prefix: g_value_array_
568 import: gobject.Value
569 structWrap: GValue* Value
570 import: gobject.ValueArray
571 structWrap: GValueArray* ValueArray
572 outFile: ValueArray