Initial revision
[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 #include <glibmm.h>
7
8 /* $Id$ */
9
10 /* Copyright (C) 1998-2002 The gtkmm Development Team
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Library General Public
14  * License as published by the Free Software Foundation; either
15  * version 2 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Library General Public License for more details.
21  *
22  * You should have received a copy of the GNU Library General Public
23  * License along with this library; if not, write to the Free
24  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  */
26
27 #include <glibmm/object.h>
28 #include <gtkmm/base.h>
29 #include <gtkmmconfig.h>
30
31
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
33 typedef struct _GtkObject GtkObject;
34 typedef struct _GtkObjectClass GtkObjectClass;
35 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
36
37
38 namespace Gtk
39 { class Object_Class; } // namespace Gtk
40 namespace Gtk
41 {
42
43 class Object;
44
45 template<class T>
46 T* manage(T* obj)
47 {
48   obj->set_manage();
49   return obj;
50 }
51
52
53 class Object : public Glib::Object
54 {
55   public:
56 #ifndef DOXYGEN_SHOULD_SKIP_THIS
57   typedef Object CppObjectType;
58   typedef Object_Class CppClassType;
59   typedef GtkObject BaseObjectType;
60   typedef GtkObjectClass BaseClassType;
61 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
62
63   virtual ~Object();
64
65 #ifndef DOXYGEN_SHOULD_SKIP_THIS
66
67 private:
68   friend class Object_Class;
69   static CppClassType object_class_;
70
71   // noncopyable
72   Object(const Object&);
73   Object& operator=(const Object&);
74
75 protected:
76   explicit Object(const Glib::ConstructParams& construct_params);
77   explicit Object(GtkObject* castitem);
78
79 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
80
81 public:
82 #ifndef DOXYGEN_SHOULD_SKIP_THIS
83   static GType get_type()      G_GNUC_CONST;
84   static GType get_base_type() G_GNUC_CONST;
85 #endif
86
87   ///Provides access to the underlying C GtkObject.
88   GtkObject*       gobj()       { return reinterpret_cast<GtkObject*>(gobject_); }
89
90   ///Provides access to the underlying C GtkObject.
91   const GtkObject* gobj() const { return reinterpret_cast<GtkObject*>(gobject_); }
92
93
94 public:
95   //C++ methods used to invoke GTK+ virtual functions:
96
97 protected:
98   //GTK+ Virtual Functions (override these to change behaviour):
99
100   //Default Signal Handlers::
101
102
103 private:
104
105   
106 public:
107   //void shutdown(); //We probably don't need this.
108   //void finalize(); //We probably don't need this.
109
110   //void set_user_data(gpointer data);
111   //gpointer get_user_data();
112
113   virtual void set_manage();
114
115   /** Anonymous User Data Pointer.
116    *
117    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
118    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
119    * the value of the property changes.
120    */
121   Glib::PropertyProxy<void*> property_user_data() ;
122
123 /** Anonymous User Data Pointer.
124    *
125    * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
126    * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
127    * the value of the property changes.
128    */
129   Glib::PropertyProxy_ReadOnly<void*> property_user_data() const;
130
131
132   bool is_managed_() const;
133
134 protected:
135
136   void destroy_();
137
138   // If you need it, give me an example. murrayc. -- Me too. daniel.
139   //_WRAP_SIGNAL(void destroy(), "destroy")
140   
141
142   void _init_unmanage(bool is_toplevel = false);
143   virtual void destroy_notify_(); //override.
144   void disconnect_cpp_wrapper();
145   void _destroy_c_instance();
146   static void callback_destroy_(GObject* gobject, void* data); //only connected for a short time.
147
148   // set if flags used by derived classes.
149   bool referenced_; // = not managed.
150   bool gobject_disposed_;
151
152
153 };
154
155 } // namespace Gtk
156
157
158 namespace Glib
159 {
160   /** @relates Gtk::Object
161    * @param object The C instance
162    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
163    * @result A C++ instance that wraps this C instance.
164    */
165   Gtk::Object* wrap(GtkObject* object, bool take_copy = false);
166 }
167 #endif /* _GTKMM_OBJECT_H */
168