Remove ancient/unused flowcanvas and libglademm from repository.
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / object.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_OBJECT_H
4 #define _GTKMM_OBJECT_H
5
6
7 #include <glibmm.h>
8
9 /* $Id$ */
10
11 /* Copyright (C) 1998-2002 The gtkmm Development Team
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Library General Public
15  * License as published by the Free Software Foundation; either
16  * version 2 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21  * Library General Public License for more details.
22  *
23  * You should have received a copy of the GNU Library General Public
24  * License along with this library; if not, write to the Free
25  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26  */
27
28 #include <glibmm/object.h>
29 #include <gtkmm/base.h>
30 #include <gtkmmconfig.h>
31
32
33 #ifndef DOXYGEN_SHOULD_SKIP_THIS
34 typedef struct _GtkObject GtkObject;
35 typedef struct _GtkObjectClass GtkObjectClass;
36 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
37
38
39 namespace Gtk
40 { class Object_Class; } // namespace Gtk
41 namespace Gtk
42 {
43
44 class Object;
45
46 /** Mark a Gtk::Object as owned by its parent container widget, so you don't need to delete it manually.
47  * For instance,
48  * @code
49  * Gtk::Button* button = Gtk::manage( new Gtk::Button("Hello") );
50  * vbox.pack_start(*button); //vbox will delete button when vbox is deleted.
51  * @endcode
52  *
53  * @param obj A Gtk::Object, such as a gtkmm widget.
54  * @result The Gtk::Object passed as the @a obj parameter.
55  */
56 template<class T>
57 T* manage(T* obj)
58 {
59   obj->set_manage();
60   return obj;
61 }
62
63 /** Gtk::Object is the base class for all widgets, and for a few non-widget objects such as 
64  * Gtk::Adjustment. Gtk::Object predates Glib::Object; non-widgets that derive from Gtk::Object 
65  * rather than Glib::Object do so for backward compatibility reasons.
66  *
67  * 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 
68  * explicitly deleted at any time, instead of using only reference-counting, and container widgets 
69  * can respond when their child objects are being deleted (for instance by removing the widget).
70  */
71
72 class GTKMM_API Object : public Glib::Object
73 {
74   public:
75 #ifndef DOXYGEN_SHOULD_SKIP_THIS
76   typedef Object CppObjectType;
77   typedef Object_Class CppClassType;
78   typedef GtkObject BaseObjectType;
79   typedef GtkObjectClass BaseClassType;
80 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
81
82   virtual ~Object();
83
84 #ifndef DOXYGEN_SHOULD_SKIP_THIS
85
86 private:
87   friend class Object_Class;
88   static CppClassType object_class_;
89
90   // noncopyable
91   Object(const Object&);
92   Object& operator=(const Object&);
93
94 protected:
95   explicit Object(const Glib::ConstructParams& construct_params);
96   explicit Object(GtkObject* castitem);
97
98 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
99
100 public:
101 #ifndef DOXYGEN_SHOULD_SKIP_THIS
102   static GType get_type()      G_GNUC_CONST;
103   static GType get_base_type() G_GNUC_CONST;
104 #endif
105
106   ///Provides access to the underlying C GtkObject.
107   GtkObject*       gobj()       { return reinterpret_cast<GtkObject*>(gobject_); }
108
109   ///Provides access to the underlying C GtkObject.
110   const GtkObject* gobj() const { return reinterpret_cast<GtkObject*>(gobject_); }
111
112
113 public:
114   //C++ methods used to invoke GTK+ virtual functions:
115 #ifdef GLIBMM_VFUNCS_ENABLED
116 #endif //GLIBMM_VFUNCS_ENABLED
117
118 protected:
119   //GTK+ Virtual Functions (override these to change behaviour):
120 #ifdef GLIBMM_VFUNCS_ENABLED
121 #endif //GLIBMM_VFUNCS_ENABLED
122
123   //Default Signal Handlers::
124 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
125 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
126
127
128 private:
129
130   
131 public:
132   //void shutdown(); //We probably don't need this.
133   //void finalize(); //We probably don't need this.
134
135   //void set_user_data(gpointer data);
136   //gpointer get_user_data();
137
138   #ifndef DOXYGEN_SHOULD_SKIP_THIS
139   /** Used by Gtk::manage(). You should not need to use this directly.
140    */
141   virtual void set_manage();
142   #endif //DOXYGEN_SHOULD_SKIP_THIS
143
144   #ifdef GLIBMM_PROPERTIES_ENABLED
145 /** Anonymous User Data Pointer.
146    *
147    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
148    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
149    * the value of the property changes.
150    */
151   Glib::PropertyProxy<void*> property_user_data() ;
152 #endif //#GLIBMM_PROPERTIES_ENABLED
153
154 #ifdef GLIBMM_PROPERTIES_ENABLED
155 /** Anonymous User Data Pointer.
156    *
157    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
158    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
159    * the value of the property changes.
160    */
161   Glib::PropertyProxy_ReadOnly<void*> property_user_data() const;
162 #endif //#GLIBMM_PROPERTIES_ENABLED
163
164
165   #ifndef DOXYGEN_SHOULD_SKIP_THIS
166   /** Private API.
167    */
168   bool is_managed_() const;
169   #endif //DOXYGEN_SHOULD_SKIP_THIS
170
171 protected:
172
173   #ifndef DOXYGEN_SHOULD_SKIP_THIS
174   /** Private API.
175    */
176   void destroy_();
177   #endif //DOXYGEN_SHOULD_SKIP_THIS
178
179   // If you need it, give me an example. murrayc. -- Me too. daniel.
180   //_WRAP_SIGNAL(void destroy(), "destroy")
181   
182
183   #ifndef DOXYGEN_SHOULD_SKIP_THIS
184   void _init_unmanage(bool is_toplevel = false);
185   virtual void destroy_notify_(); //override.
186   void disconnect_cpp_wrapper();
187   void _destroy_c_instance();
188   static void callback_destroy_(GObject* gobject, void* data); //only connected for a short time.
189
190   // set if flags used by derived classes.
191   bool referenced_; // = not managed.
192   bool gobject_disposed_;
193   #endif //DOXYGEN_SHOULD_SKIP_THIS
194
195
196 };
197
198 } // namespace Gtk
199
200
201 namespace Glib
202 {
203   /** A Glib::wrap() method for this object.
204    * 
205    * @param object The C instance.
206    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
207    * @result A C++ instance that wraps this C instance.
208    *
209    * @relates Gtk::Object
210    */
211   Gtk::Object* wrap(GtkObject* object, bool take_copy = false);
212 } //namespace Glib
213
214
215 #endif /* _GTKMM_OBJECT_H */
216