alternative to assert
[gtkD.git] / gtkD / wrap / APILookupGObject.txt
blobdeae63f10a04cd3b02f2017e897e64d077a97b7d
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 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 # 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.
13
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
21 ###
22 #####
23 # Definitions for wrapping GObject
24 #####
25 ###
29 addTypedefs: start
31 public import gtkc.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",cast(void*)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                 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);
192         }
193         
194         extern(C)
195         {
196                 static void destroyNotify(gpointer* data)
197                 {
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");
204                 }
205         }
207 //debug = objectstore;
209 //debug(objectstore)
211 //      private import std.stdio;
214 //      /**
215 //       * Maps Gtk structures to GtkD Objects
216 //       */
217 //      private static ObjectStore objectStore;
218 //      
219 //      /**
220 //       * Creates the statis ObjectStore object
221 //       */
222 //      static this()
223 //      {
224 //              objectStore = new ObjectStore();
225 //      }
226 //      
227 //      /**
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
231 //       */
232 //      public this (GObject* gObject)
233 //      {
234 //              this.gObject = gObject;
235 //              if ( gObject !is  null )
236 //              {
237 //                      //writefln("ObjectG.this\n");
238 //                      objectStore.putObject(this, gObject);
239 //                      setDestroyNotify("GObject",gObject);
240 //              }
241 //      }
242 //      
244 //      
245 //      /**
246 //       * Maintains the map from Gtk structures to GtkD objects
247 //       */
248 //      private static class ObjectStore
249 //      {
250 //              static ObjectG[void*] objectStore;
251 //              
252 //              /**
253 //               * Puts a new gtk struct to GtkD objects
254 //               */
255 //              void putObject(ObjectG objectG, GObject* gtkStruct)
256 //              {
257 //                      objectStore[gtkStruct] = objectG;
258 //                      debug(objectstore)
259 //                      {
260 //                              writefln("ObjectStore.putObject gtkStruct = %s (total=%s)", gtkStruct, objectStore.length);
261 //                      }
262 //              }
263 //              
264 //              /**
265 //               * Gets a GtkD object from a gtk struct.
266 //               * Returns: the GtkD object or null if not found
267 //               */
268 //              ObjectG getObject(GObject* gtkStruct)
269 //              {
270 //                      ObjectG objectG = null;
271 //                      synchronized ( this )
272 //                      {
273 //                              if ( gtkStruct in objectStore )
274 //                              {
275 //                                      objectG = objectStore[gtkStruct];
276 //                              }
277 //                      }
278 //                      debug(objectstore)
279 //                      {
280 //                              //writefln("ObjectStore.removeObject objectStore.length = %s", objectStore.length);
281 //                              //writefln("ObjectStore.getObject gtkStruct = %s", gtkStruct);
282 //                              if ( objectG is null )
283 //                              {
284 //                                      writefln("ObjectStore.getObject not found");
285 //                              }
286 //                              else
287 //                              {
288 //                                      writefln("ObjectStore.getObject %s (total = %s)", objectG, objectStore.length);
289 //                              }
290 //                      }
291 //                      return objectG;
292 //              }
293 //              
294 //              /**
295 //               * Removes an entry from the gtk struct to GtkD object map
296 //               */
297 //              void removeObject(GObject* gtkStruct)
298 //              {
299 //                      debug(objectstore)
300 //                      {
301 //                              writefln("ObjectStore.removeObject gtkStruct = %s", gtkStruct);
302 //                              ObjectG objectG = getObject(gtkStruct);
303 //                              if ( objectG is null )
304 //                              {
305 //                                      writefln("ObjectStore.removeObject not found");
306 //                              }
307 //                              else
308 //                              {
309 //                                      writefln("ObjectStore.removeObject %s",
310 //                                      objectG);
311 //                              }
312 //                      }
313 //                      objectStore.remove(gtkStruct);
314 //                      //objectStore.rehash;
315 //                      debug(objectstore)
316 //                      {
317 //                              writefln("ObjectStore.removeObject objectStore.length = %s", objectStore.length);
318 //                      }
319 //              }
320 //      }
322 //      /**
323 //       * Gets a GtkD object from a Gtk Structure if the GtkD object was already created for the structure
324 //       */
325 //      public static ObjectG getStoredObject(GObject* gtkStruct)
326 //      {
327 //              return objectStore.getObject(gtkStruct);
328 //      }
329 //      
330 //      /**
331 //       * Sets a pointer on this object's has table
332 //       * @param key the data identifier
333 //       * @param data a pointer
334 //       */
335 //      private void setDestroyNotify(char[] key, gpointer data)
336 //      {
337 //              //writefln("setData objectG=%X data=%X type %s",gObject,data,key);
338 //              //std.gc.addRoot(data);
339 //              
340 //              g_object_set_data_full(gObject, Str.toStringz(key), data, cast(GDestroyNotify)&destroyNotify);
341 //      }
342 //      
343 //      private extern(C)
344 //      {
345 //              static void destroyNotify(gpointer data)
346 //              {
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);
354 //                      
355 //                      //printf("objectg.destroy exit\n");
356 //              }
357 //      }
358         public void setProperty(char[] propertyName, int value)
359         {
360                 setProperty(propertyName, new Value(value));
361         }
362         
363         public void setProperty(char[] propertyName, char[] value)
364         {
365                 setProperty(propertyName, new Value(value));
366         }
367         
368         public void setProperty(char[] propertyName, long value)
369         {
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);
372         }
374         public void setProperty(char[] propertyName, ulong value)
375         {
376                 g_object_set( gObject, Str.toStringz(propertyName), value, null);
377         }
378         
379 code: end
381 outFile: ObjectG
383 file: gobject-Enumeration-and-Flag-Types.html
385 struct: GEnumValue
386 class: Enums
387 prefix: g_enum_
388 noprefix: g_flags_
389 import: glib.Str
390 #import: gobject.EnumValue
391 #structWrap: GEnumValue* EnumValue
392 #import: gobject.TypeInfo
393 #structWrap: GTypeInfo* TypeInfo
394 outFile: Enums
396 struct: GFlagsValue
397 strictPrefix: Y
398 class: Flags
399 prefix: g_flags_
400 noprefix: g_enum_
401 import: glib.Str
402 import: gobject.Flags
403 structWrap: GFlagsValue* Flags
404 #import: gobject.TypeInfo
405 #structWrap: GTypeInfo* TypeInfo
406 outFile: Flags
408 file: gobject-Boxed-Types.html
409 class: Boxed
410 prefix: g_
411 import: glib.Str
412 outFile: Boxed
414 file: gobject-Generic-values.html
415 struct: GValue
416 class: Value
417 nostruct: GValue
418 prefix: g_value_
419 import: glib.Str
420 import: gobject.Value
421 structWrap: GValue* Value
422 import: gobject.ParamSpec
423 structWrap: GParamSpec* ParamSpec
424 import: gobject.ObjectG
425 structWrap: GObject* ObjectG
426 import: gdk.Pixbuf
428 nocode: g_value_init
429 nocode: g_value_reset
431 code: start
433         public this()
434         {
435                 this(new GValue);
436         }
437         
438         this(Pixbuf pixbuf)
439         {
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());
444                 this(v);
445         }
446         
447         this(char[] value)
448         {
449                 this();
450                 init(GType.STRING);
451                 setString(value);
452         }
454         this(int value)
455         {
456                 this();
457                 init(GType.INT);
458                 setInt(value);
459         }
460         
461         /**
462          * Initializes value with the default value of type.
463          * value:
464          * A zero-filled (uninitialized) GValue structure.
465          * g_type:
466          * Type the GValue should hold values of.
467          * Returns:
468          * the GValue structure that has been passed in
469          */
470         public Value init(GType gType)
471         {
472                 // GValue* g_value_init (GValue *value,  GType g_type);
473                 g_value_init(gValue, gType);
474                 return this;
475         }
476         
477         /**
478          * Clears the current value in value and resets it to the default value
479          * (as if the value had just been initialized).
480          * value:
481          * An initialized GValue structure.
482          * Returns:
483          * the GValue structure that has been passed in
484          */
485         public Value reset()
486         {
487                 // GValue* g_value_reset (GValue *value);
488                 g_value_reset(gValue);
489                 return this;
490         }
491         
494 code: end
496 openFile: Value
498 file: gobject-Standard-Parameter-and-Value-Types.html
499 #class: Value
500 #import: gobject.Value
501 #prefix: g_
502 closeFile: Value
504 #file: gobject-Varargs-Value-Collection.html
505 #class: 
506 #prefix: 
507 #outFile: 
509 file: gobject-GParamSpec.html
510 struct: GParamSpec
511 class: ParamSpec
512 prefix: g_param_spec_
513 import: glib.Str
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*
524 import: glib.ListG
525 structWrap: GList* ListG
526 outFile: ParamSpec
528 file: gobject-Signals.html
529 class: Signals
530 prefix: g_signal_
531 import: glib.Str
532 import: gobject.Closure
533 structWrap: GClosure* Closure
534 import: gobject.Type
535 #structWrap: GType* Type
536 #import: gobject.SignalQuery
537 #structWrap: GSignalQuery* SignalQuery
538 import: gobject.Value
539 structWrap: GValue* Value
540 import: glib.Quark
541 structWrap: GQuark* Quark
542 #import: gobject.SignalInvocationHint
543 #structWrap: GSignalInvocationHint* SignalInvocationHint
545 code: start
548         public static uint connectData(void* instanc, char[] detailedSignal, GCallback cHandler, Object data, GClosureNotify destroyData, GConnectFlags connectFlags)
549         {
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);
552         }
555 code: end
557 outFile: Signals
559 file: gobject-Closures.html
561 struct: GClosure
562 class: Closure
563 prefix: g_closure_
564 noprefix: g_cclosure
565 import: gobject.ObjectG
566 structWrap: GObject* ObjectG
567 import: gobject.Closure
568 structWrap: GClosure* Closure
569 import: gobject.Value
570 structWrap: GValue* Value
571 import: glib.Source
572 structWrap: GSource* Source
573 outFile: Closure
575 struct: GCClosure
576 class: CClosure
577 prefix: g_cclosure
578 strictPrefix: Yes
579 noprefix: g_closure_
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
587 outFile: CClosure
589 file: gobject-Value-arrays.html
590 struct: GValueArray
591 class: ValueArray
592 prefix: g_value_array_
593 import: gobject.Value
594 structWrap: GValue* Value
595 import: gobject.ValueArray
596 structWrap: GValueArray* ValueArray
597 outFile: ValueArray