c7b5a96fa721101f27217c9c742d7b8677cd1635
[ardour.git] / libs / glibmm2 / glibmm / class.h
1 // -*- c++ -*-
2 #ifndef _GLIBMM_CLASS_H
3 #define _GLIBMM_CLASS_H
4
5 /* $Id$ */
6
7 /* Copyright 2001 Free Software Foundation
8  * Copyright (C) 1998-2002 The gtkmm Development Team
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public
21  * License along with this library; if not, write to the Free
22  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  */
24
25 #include <glib-object.h>
26
27
28 #ifndef DOXYGEN_SHOULD_SKIP_THIS
29
30 namespace Glib
31 {
32
33 class Class
34 {
35 public:
36   /* No constructor/destructor:
37    * Glib::Class objects are used only as static data, which would cause
38    * lots of ugly global constructor invocations.  These are avoidable,
39    * because the C/C++ standard explicitly specifies that all _static_ data
40    * is zero-initialized at program start.
41    */
42   //Class();
43   //~Class();
44
45   //static void class_init_function(BaseClassType *p);
46   //static void object_init_function(BaseObjectType *o);
47   //GType get_type() = 0; //Creates the GType when this is first called.
48
49   // Hook for translating API
50   //static Glib::Object* wrap_new(GObject*);
51
52   inline GType get_type() const;
53   GType clone_custom_type(const char* custom_type_name) const;
54
55 protected:
56   GType           gtype_;
57   GClassInitFunc  class_init_func_;
58
59   void register_derived_type(GType base_type);
60
61 private:
62   static void custom_class_init_function(void* g_class, void* class_data);
63 };
64
65 inline
66 GType Class::get_type() const
67 {
68   return gtype_;
69 }
70
71 } // namespace Glib
72
73 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
74
75 #endif /* _GLIBMM_CLASS_H */
76