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
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkObject.html
52 private import gtk
.gtktypes
;
54 private import lib
.gtk
;
56 private import glib
.Str
;
61 * GtkObject is the base class for all widgets, and for a few
62 * non-widget objects such as GtkAdjustment. GtkObject predates
63 * GObject; non-widgets that derive from GtkObject rather than
64 * GObject do so for backward compatibility reasons.
65 * GtkObjects are created with a "floating" reference count.
66 * This means that the initial reference is not owned by anyone. Calling
67 * g_object_unref() on a newly-created GtkObject is incorrect, the floating
68 * reference has to be removed first. This can be done by anyone at any time,
69 * by calling g_object_ref_sink() to convert the floating reference into a
70 * regular reference. g_object_ref_sink() returns a new reference if an object
71 * is already sunk (has no floating reference).
72 * When you add a widget to its parent container, the parent container
74 * g_object_ref_sink (G_OBJECT (child_widget));
75 * This means that the container now owns a reference to the child widget
76 * and the child widget has no floating reference.
77 * The purpose of the floating reference is to keep the child widget alive
78 * until you add it to a parent container:
79 * button = gtk_button_new ();
80 * /+* button has one floating reference to keep it alive +/
81 * gtk_container_add (GTK_CONTAINER (container), button);
82 * /+* button has one non-floating reference owned by the container +/
83 * GtkWindow is a special case, because GTK+ itself will ref/sink it on creation.
84 * That is, after calling gtk_window_new(), the GtkWindow will have one
85 * reference which is owned by GTK+, and no floating references.
86 * One more factor comes into play: the "destroy" signal, emitted by the
87 * gtk_object_destroy() method. The "destroy" signal asks all code owning a
88 * reference to an object to release said reference. So, for example, if you call
89 * gtk_object_destroy() on a GtkWindow, GTK+ will release the reference count that
90 * it owns; if you call gtk_object_destroy() on a GtkButton, then the button will
91 * be removed from its parent container and the parent container will release its
92 * reference to the button. Because these references are released, calling
93 * gtk_object_destroy() should result in freeing all memory associated with an
94 * object, unless some buggy code fails to release its references in response to
95 * the "destroy" signal. Freeing memory (referred to as
96 * finalization only happens if the reference count reaches
98 * Some simple rules for handling GtkObject:
99 * Never call g_object_unref() unless you have previously called g_object_ref(),
100 * even if you created the GtkObject. (Note: this is not
101 * true for GObject; for GObject, the creator of the object owns a reference.)
102 * Call gtk_object_destroy() to get rid of most objects in most cases.
103 * In particular, widgets are almost always destroyed in this way.
104 * Because of the floating reference count, you don't need to
105 * worry about reference counting for widgets and toplevel windows, unless you
106 * explicitly call g_object_ref() yourself.
108 private import gobject
.ObjectG
;
109 public class ObjectGtk
: ObjectG
112 /** the main Gtk struct */
113 protected GtkObject
* gtkObject
;
116 public GtkObject
* getObjectGtkStruct()
122 /** the main Gtk struct as a void* */
123 protected void* getStruct()
125 return cast(void*)gtkObject
;
129 * Sets our main struct and passes it to the parent class
131 public this (GtkObject
* gtkObject
)
133 super(cast(GObject
*)gtkObject
);
134 this.gtkObject
= gtkObject
;
137 public static char[] getId(StockID id
)
139 return StockDesc
[id
];
145 // imports for the signal processing
146 private import gobject
.Signals
;
147 private import gdk
.gdktypes
;
148 int[char[]] connectedSignals
;
150 void delegate(ObjectGtk
)[] onDestroyListeners
;
151 void addOnDestroy(void delegate(ObjectGtk
) dlg
)
153 if ( !("destroy" in connectedSignals
) )
158 cast(GCallback
)&callBackDestroy
,
161 cast(ConnectFlags
)0);
162 connectedSignals
["destroy"] = 1;
164 onDestroyListeners
~= dlg
;
166 extern(C
) static void callBackDestroy(GtkObject
* objectStruct
, ObjectGtk objectGtk
)
168 bit consumed
= false;
170 foreach ( void delegate(ObjectGtk
) dlg
; objectGtk
.onDestroyListeners
)
188 * gtk_object_new is deprecated and should not be used in newly-written code. Use g_object_new() instead.
189 * Constructs an object given its arguments, enumerated in the call to the
192 * the type identifying this object. Returned by gtk_type_unique()
193 * (although for a properly-written object it should be accessible through
194 * a GTK_TYPE_FOO macro.)
195 * first_property_name:
196 * name of the first property to set when constructing
199 * the first argument's value, followed by any number of
200 * name/argument-value pairs, terminated with NULL.
204 public this (GtkType type
, char[] firstPropertyName
, ... )
206 // GtkObject* gtk_object_new (GtkType type, const gchar *first_property_name, ...);
207 this(cast(GtkObject
*)gtk_object_new(type
, Str
.toStringz(firstPropertyName
)) );
212 * gtk_object_sink has been deprecated since version 2.10 and should not be used in newly-written code. Use g_object_ref_sink() instead
213 * Removes the floating reference from a GtkObject, if it exists;
214 * otherwise does nothing. See the GtkObject overview documentation at
215 * the top of the page.
217 * the object to sink.
221 // void gtk_object_sink (GtkObject *object);
222 gtk_object_sink(gtkObject
);
227 * gtk_object_ref is deprecated and should not be used in newly-written code. Use g_object_ref() instead.
228 * Increases the reference count of the object.
230 * the object to reference.
234 public GtkObject
* ref()
236 // GtkObject* gtk_object_ref (GtkObject *object);
237 return gtk_object_ref(gtkObject
);
242 * gtk_object_unref is deprecated and should not be used in newly-written code. Use g_object_unref() instead.
243 * Decreases the reference count of an object. When its reference count drops
244 * to 0, the object is finalized (i.e. its memory is freed).
246 * the object to dereference.
250 // void gtk_object_unref (GtkObject *object);
251 gtk_object_unref(gtkObject
);
256 * gtk_object_weakref is deprecated and should not be used in newly-written code. Use g_object_weak_ref() instead.
257 * Adds a weak reference callback to an object. Weak references are used for notification when an object is
258 * finalized. They are called "weak references" because they allow you to safely
259 * hold a pointer to an object without calling g_object_ref() (g_object_ref() adds
260 * a strong reference, that is, forces the object to stay alive).
262 * object to weakly reference.
264 * callback to invoke before the object is freed.
266 * extra data to pass to notify.
268 public void weakref(GtkDestroyNotify notify
, void* data
)
270 // void gtk_object_weakref (GtkObject *object, GtkDestroyNotify notify, gpointer data);
271 gtk_object_weakref(gtkObject
, notify
, data
);
276 * gtk_object_weakunref is deprecated and should not be used in newly-written code. Use g_object_weak_unref() instead.
277 * Removes a weak reference callback to an object.
279 * object stop weakly referencing.
281 * callback to search for.
283 * data to search for.
285 public void weakunref(GtkDestroyNotify notify
, void* data
)
287 // void gtk_object_weakunref (GtkObject *object, GtkDestroyNotify notify, gpointer data);
288 gtk_object_weakunref(gtkObject
, notify
, data
);
292 * Emits the "destroy" signal notifying all reference holders that they should
293 * release the GtkObject. See the overview documentation at the top of the
294 * page for more details.
295 * The memory for the object itself won't be deleted until
296 * its reference count actually drops to 0; gtk_object_destroy() merely asks
297 * reference holders to release their references, it does not free the object.
299 * the object to destroy.
301 public void destroy()
303 // void gtk_object_destroy (GtkObject *object);
304 gtk_object_destroy(gtkObject
);
309 * gtk_object_get is deprecated and should not be used in newly-written code. Use g_object_get() instead.
310 * Gets properties of an object.
313 * first_property_name:
314 * name of first property to get the value for.
316 * NULL-terminated list of name-return location pairs.
318 public void get(char[] firstPropertyName
, ... )
320 // void gtk_object_get (GtkObject *object, const gchar *first_property_name, ...);
321 gtk_object_get(gtkObject
, Str
.toStringz(firstPropertyName
));
326 * gtk_object_set is deprecated and should not be used in newly-written code. Use g_object_set() instead.
327 * Sets properties on an object.
328 * void set_box_properties (GtkBox* box)
330 * gtk_object_set (GTK_OBJECT (box), "homogeneous", TRUE,
336 * first_property_name:
337 * name of the first property to set
339 * the value of the first argument, followed optionally
340 * by more name/value pairs, followed by NULL.
342 public void set(char[] firstPropertyName
, ... )
344 // void gtk_object_set (GtkObject *object, const gchar *first_property_name, ...);
345 gtk_object_set(gtkObject
, Str
.toStringz(firstPropertyName
));
350 * gtk_object_set_data is deprecated and should not be used in newly-written code. Use g_object_set_data() instead.
351 * Each object carries around a table of associations from
352 * strings to pointers. This function lets you set an association.
353 * If the object already had an association with that name,
354 * the old association will be destroyed.
356 * object containing the associations.
360 * data to associate with that key.
362 public void setData(char[] key
, void* data
)
364 // void gtk_object_set_data (GtkObject *object, const gchar *key, gpointer data);
365 gtk_object_set_data(gtkObject
, Str
.toStringz(key
), data
);
370 * gtk_object_set_data_full is deprecated and should not be used in newly-written code. Use g_object_set_data_full() instead.
371 * Like gtk_object_set_data() except it adds notification
372 * for when the association is destroyed, either by
373 * gtk_object_remove_data() or when the object is destroyed.
375 * object containing the associations.
379 * data to associate with that key.
381 * function to call when the association is destroyed.
383 public void setDataFull(char[] key
, void* data
, GtkDestroyNotify destroy
)
385 // void gtk_object_set_data_full (GtkObject *object, const gchar *key, gpointer data, GtkDestroyNotify destroy);
386 gtk_object_set_data_full(gtkObject
, Str
.toStringz(key
), data
, destroy
);
391 * gtk_object_remove_data is deprecated and should not be used in newly-written code. Use g_object_set_data() to set the object data to NULL instead.
392 * Removes a specified datum from the object's data associations (the object_data).
393 * Subsequent calls to gtk_object_get_data() will return NULL.
394 * If you specified a destroy handler with gtk_object_set_data_full(),
395 * it will be invoked.
397 * the object maintaining the association.
399 * name of the key for that association.
401 public void removeData(char[] key
)
403 // void gtk_object_remove_data (GtkObject *object, const gchar *key);
404 gtk_object_remove_data(gtkObject
, Str
.toStringz(key
));
409 * gtk_object_get_data is deprecated and should not be used in newly-written code. Use g_object_get_data() instead.
410 * Get a named field from the object's table of associations (the object_data).
412 * the object maintaining the associations.
414 * name of the key for that association.
416 * the data if found, or NULL if no such data exists.
418 public void* getData(char[] key
)
420 // gpointer gtk_object_get_data (GtkObject *object, const gchar *key);
421 return gtk_object_get_data(gtkObject
, Str
.toStringz(key
));
426 * gtk_object_remove_no_notify is deprecated and should not be used in newly-written code. Use g_object_steal_data() instead.
427 * Remove a specified datum from the object's data associations (the object_data),
428 * without invoking the association's destroy handler.
429 * Just like gtk_object_remove_data() except that any destroy handler
431 * Therefore this only affects data set using gtk_object_set_data_full().
433 * the object maintaining the association.
435 * name of the key for that association.
437 public void removeNoNotify(char[] key
)
439 // void gtk_object_remove_no_notify (GtkObject *object, const gchar *key);
440 gtk_object_remove_no_notify(gtkObject
, Str
.toStringz(key
));
445 * gtk_object_set_user_data is deprecated and should not be used in newly-written code. Use g_object_set_data() instead.
446 * For convenience, every object offers a generic user data
447 * pointer. This function sets it.
449 * the object whose user data should be set.
451 * the new value for the user data.
453 public void setUserData(void* data
)
455 // void gtk_object_set_user_data (GtkObject *object, gpointer data);
456 gtk_object_set_user_data(gtkObject
, data
);
461 * gtk_object_get_user_data is deprecated and should not be used in newly-written code. Use g_object_get_data() instead.
462 * Get the object's user data pointer.
463 * This is intended to be a pointer for your convenience in
464 * writing applications.
468 * the user data field for object.
470 public void* getUserData()
472 // gpointer gtk_object_get_user_data (GtkObject *object);
473 return gtk_object_get_user_data(gtkObject
);
478 * gtk_object_add_arg_type is deprecated and should not be used in newly-written code.
479 * Deprecated in favor of the GObject property system including GParamSpec.
480 * Add a new type of argument to an object class.
481 * Usually this is called when registering a new type of object.
483 * fully qualify object name, for example GtkObject::user_data.
485 * type of the argument.
487 * bitwise-OR of the GtkArgFlags enum. (Whether the argument is
488 * settable or gettable, whether it is set when the object is constructed.)
490 * an internal number, passed in from here to the "set_arg" and
491 * "get_arg" handlers of the object.
493 public static void addArgType(char[] argName
, GtkType argType
, uint argFlags
, uint argId
)
495 // void gtk_object_add_arg_type (const gchar *arg_name, GtkType arg_type, guint arg_flags, guint arg_id);
496 gtk_object_add_arg_type(Str
.toStringz(argName
), argType
, argFlags
, argId
);
501 * gtk_object_set_data_by_id is deprecated and should not be used in newly-written code. Use g_object_set_qdata() instead.
502 * Just like gtk_object_set_data() except that it takes
503 * a GQuark instead of a string, so it is slightly faster.
504 * Use gtk_object_data_try_key() and gtk_object_data_force_id()
505 * to get an id from a string.
507 * object containing the associations.
511 * data to associate with that key.
513 public void setDataById(GQuark dataId
, void* data
)
515 // void gtk_object_set_data_by_id (GtkObject *object, GQuark data_id, gpointer data);
516 gtk_object_set_data_by_id(gtkObject
, dataId
, data
);
521 * gtk_object_set_data_by_id_full is deprecated and should not be used in newly-written code. Use g_object_set_qdata_full() instead.
522 * Just like gtk_object_set_data_full() except that it takes
523 * a GQuark instead of a string, so it is slightly faster.
524 * Use gtk_object_data_try_key() and gtk_object_data_force_id()
525 * to get an id from a string.
527 * object containing the associations.
531 * data to associate with that key.
533 * function to call when the association is destroyed.
535 public void setDataByIdFull(GQuark dataId
, void* data
, GtkDestroyNotify destroy
)
537 // void gtk_object_set_data_by_id_full (GtkObject *object, GQuark data_id, gpointer data, GtkDestroyNotify destroy);
538 gtk_object_set_data_by_id_full(gtkObject
, dataId
, data
, destroy
);
543 * gtk_object_get_data_by_id is deprecated and should not be used in newly-written code. Use g_object_get_qdata() instead.
544 * Just like gtk_object_get_data() except that it takes
545 * a GQuark instead of a string, so it is slightly faster.
546 * Use gtk_object_data_try_key() and gtk_object_data_force_id()
547 * to get an id from a string.
549 * object containing the associations.
553 * the data if found, or NULL if no such data exists.
555 public void* getDataById(GQuark dataId
)
557 // gpointer gtk_object_get_data_by_id (GtkObject *object, GQuark data_id);
558 return gtk_object_get_data_by_id(gtkObject
, dataId
);
563 * gtk_object_remove_data_by_id is deprecated and should not be used in newly-written code. Use g_object_set_qdata() with data of NULL instead.
564 * Just like gtk_object_remove_data() except that it takes
565 * a GQuark instead of a string, so it is slightly faster.
566 * Remove a specified datum from the object's data associations.
567 * Subsequent calls to gtk_object_get_data() will return NULL.
568 * Use gtk_object_data_try_key() and gtk_object_data_force_id()
569 * to get an id from a string.
571 * object containing the associations.
575 public void removeDataById(GQuark dataId
)
577 // void gtk_object_remove_data_by_id (GtkObject *object, GQuark data_id);
578 gtk_object_remove_data_by_id(gtkObject
, dataId
);
583 * gtk_object_remove_no_notify_by_id is deprecated and should not be used in newly-written code. Use g_object_steal_qdata() instead.
584 * Just like gtk_object_remove_no_notify() except that it takes
585 * a GQuark instead of a string, so it is slightly faster.
586 * Use gtk_object_data_try_key() and gtk_object_data_force_id()
587 * to get an id from a string.
589 * object containing the associations.
593 public void removeNoNotifyById(GQuark keyId
)
595 // void gtk_object_remove_no_notify_by_id (GtkObject *object, GQuark key_id);
596 gtk_object_remove_no_notify_by_id(gtkObject
, keyId
);