1 /* $Id: object.hg,v 1.5 2006/04/07 14:11:37 gustin Exp $ */
3 /* Copyright (C) 1998-2002 The gtkmm Development Team
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <glibmm/object.h>
21 #include <gtkmm/base.h>
22 #include <gtkmmconfig.h>
24 _PINCLUDE(glibmm/private/object_p.h)
31 /** Mark a Gtk::Object as owned by its parent container widget, so you don't need to delete it manually.
34 * Gtk::Button* button = Gtk::manage( new Gtk::Button("Hello") );
35 * vbox.pack_start(*button); //vbox will delete button when vbox is deleted.
38 * @param obj A Gtk::Object, such as a gtkmm widget.
39 * @result The Gtk::Object passed as the @a obj parameter.
48 /** Gtk::Object is the base class for all widgets, and for a few non-widget objects such as
49 * Gtk::Adjustment. Gtk::Object predates Glib::Object; non-widgets that derive from Gtk::Object
50 * rather than Glib::Object do so for backward compatibility reasons.
52 * The most interesting difference between Gtk::Object and Glib::Object is the ability to use Gtk::manage() to delegate memory management to the container widget. Gtk::Objects can also be
53 * explicitly deleted at any time, instead of using only reference-counting, and container widgets
54 * can respond when their child objects are being deleted (for instance by removing the widget).
56 class GTKMM_API Object : public Glib::Object
58 _CLASS_GTKOBJECT(Object,GtkObject,GTK_OBJECT,Glib::Object,GObject)
59 _IGNORE(gtk_object_ref, gtk_object_unref, gtk_object_weakref, gtk_object_weakunref, gtk_object_set_data,
60 gtk_object_set_data_full, gtk_object_remove_data, gtk_object_get_data, gtk_object_remove_no_notify,
61 gtk_object_set_user_data, gtk_object_get_user_data, gtk_object_set_data_by_id, gtk_object_set_data_by_id_full,
62 gtk_object_get_data_by_id, gtk_object_remove_data_by_id, gtk_object_remove_no_notify_by_id, gtk_object_get,
63 gtk_object_set, gtk_object_add_arg_type, gtk_object_destroy, gtk_object_sink)
68 //void shutdown(); //We probably don't need this.
69 //void finalize(); //We probably don't need this.
71 //void set_user_data(gpointer data);
72 //gpointer get_user_data();
74 #ifndef DOXYGEN_SHOULD_SKIP_THIS
75 /** Used by Gtk::manage(). You should not need to use this directly.
77 virtual void set_manage();
78 #endif //DOXYGEN_SHOULD_SKIP_THIS
80 _WRAP_PROPERTY("user-data", void*)
82 #ifndef DOXYGEN_SHOULD_SKIP_THIS
85 bool is_managed_() const;
86 #endif //DOXYGEN_SHOULD_SKIP_THIS
90 #ifndef DOXYGEN_SHOULD_SKIP_THIS
94 #endif //DOXYGEN_SHOULD_SKIP_THIS
96 // If you need it, give me an example. murrayc. -- Me too. daniel.
97 //_WRAP_SIGNAL(void destroy(), "destroy")
98 _IGNORE_SIGNAL(destroy)
100 #ifndef DOXYGEN_SHOULD_SKIP_THIS
101 void _init_unmanage(bool is_toplevel = false);
102 virtual void destroy_notify_(); //override.
103 void disconnect_cpp_wrapper();
104 void _destroy_c_instance();
105 static void callback_destroy_(GObject* gobject, void* data); //only connected for a short time.
107 // set if flags used by derived classes.
108 bool referenced_; // = not managed.
109 bool gobject_disposed_;
110 #endif //DOXYGEN_SHOULD_SKIP_THIS