[gtkmm/gtkmm-2-24] Added class_gtkobject.m4, previously in glibmm.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/gtkmm-2-24] Added class_gtkobject.m4, previously in glibmm.
- Date: Fri, 14 Jan 2011 10:47:11 +0000 (UTC)
commit d110003dd8c692c3a35a1cc5d362123d0fc4f19e
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Dec 9 16:24:07 2010 +0100
Added class_gtkobject.m4, previously in glibmm.
* tools/m4/class_gtkobject.m4: Added this, so we can use _CLASS_GTKOBJECT.
* tools/m4/filelist.m4: Mentioned the new file.
ChangeLog | 8 ++
tools/m4/class_gtkobject.m4 | 234 +++++++++++++++++++++++++++++++++++++++++++
tools/m4/convert_gtkmm.m4 | 1 +
tools/m4/filelist.am | 1 +
4 files changed, 244 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b224aac..a97ab9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-12-09 Murray Cumming <murrayc murrayc com>
+
+ Added class_gtkobject.m4, previously in glibmm.
+
+ * tools/m4/class_gtkobject.m4: Added this, so we can use _CLASS_GTKOBJECT.
+ * tools/m4/filelist.m4: Mentioned the new file.
+
2011-01-14 Murray Cumming <murrayc murrayc com>
Regenerated function defs.
@@ -9473,3 +9480,4 @@ This is the HEAD branch. The stable branch is gtkmm-2-6.
2003-01-21 Murray Cumming <murrayc usa net>
* Changed library names: 1.0 -> 1.4 and 2.0 -> 2.4
+
diff --git a/tools/m4/class_gtkobject.m4 b/tools/m4/class_gtkobject.m4
new file mode 100644
index 0000000..8737969
--- /dev/null
+++ b/tools/m4/class_gtkobject.m4
@@ -0,0 +1,234 @@
+dnl $Id$
+
+
+
+define(`_CLASS_GTKOBJECT',`dnl
+_PUSH()
+dnl
+dnl Define the args for later macros
+define(`__CPPNAME__',`$1')
+define(`__CNAME__',`$2')
+define(`__CCAST__',`$3')
+define(`__BASE__',_LOWER(__CPPNAME__))
+define(`__CPPPARENT__',`$4')
+define(`__CPARENT__',`$5')
+define(`__PCAST__',`($5*)')
+
+dnl Some C types, e.g. GdkWindow or GdkPixmap, are a typedef to their base type,
+dnl rather than the real instance type. That is really ugly, yes. We get around
+dnl the problem by supporting optional __REAL_* arguments to this macro.
+define(`__REAL_CNAME__',ifelse(`$6',,__CNAME__,`$6'))
+define(`__REAL_CPARENT__',ifelse(`$7',,__CPARENT__,`$7'))
+
+
+dnl
+dnl ----------------------- Constructors -------------------------
+dnl
+
+
+_POP()
+_SECTION(SECTION_CLASS2)
+')dnl end of _CLASS_GTKOBJECT
+
+dnl Widget and Object, and some others, have custom-written destructor implementations:
+define(`_CUSTOM_DTOR',`dnl
+_PUSH()
+dnl Define this macro to be tested for later.
+define(`__BOOL_CUSTOM_DTOR__',`$1')
+_POP()
+')
+
+dnl Gtk::Object has a custom-written cast implementation:
+define(`_CUSTOM_CTOR_CAST',`dnl
+_PUSH()
+dnl Define this macro to be tested for later.
+define(`__BOOL_CUSTOM_CTOR_CAST__',`$1')
+_POP()
+')
+
+dnl Top-level windows can not be manage()ed, so we should not use manage() in wrap_new().
+define(`_UNMANAGEABLE',`dnl
+_PUSH()
+dnl Define this macro to be tested for later.
+define(`__BOOL_UNMANAGEABLE__',`$1')
+_POP()
+')
+
+dnl Optionally ifdef-out the whole .h and .cc files:
+define(`_IS_DEPRECATED',`dnl
+_PUSH()
+dnl Define this macro to be tested for later.
+define(`__BOOL_DEPRECATED__',`$1')
+_POP()
+')
+
+dnl Gnome::Canvas::CanvasAA::CanvasAA() needs access to the
+dnl normally-private canvas_class_ member variable. See comments there.
+define(`_GMMPROC_PROTECTED_GCLASS',`dnl
+_PUSH()
+dnl Define this macro to be tested for later.
+define(`__BOOL_PROTECTED_GCLASS__',`1')
+_POP()
+')
+
+
+dnl
+dnl _END_CLASS_GTKOBJECT()
+dnl denotes the end of a class
+dnl
+define(`_END_CLASS_GTKOBJECT',`
+
+_SECTION(SECTION_HEADER1)
+_STRUCT_PROTOTYPE()
+
+__NAMESPACE_BEGIN__ class __CPPNAME__`'_Class; __NAMESPACE_END__
+_SECTION(SECTION_HEADER3)
+
+namespace Glib
+{
+ /** A Glib::wrap() method for this object.
+ *
+ * @param object The C instance.
+ * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
+ * @result A C++ instance that wraps this C instance.
+ *
+ * @relates __NAMESPACE__::__CPPNAME__
+ */
+ __NAMESPACE__::__CPPNAME__`'* wrap(__CNAME__`'* object, bool take_copy = false);
+} //namespace Glib
+
+dnl
+dnl
+_SECTION(SECTION_PHEADER)
+
+#include <glibmm/class.h>
+
+__NAMESPACE_BEGIN__
+
+_PH_CLASS_DECLARATION()
+
+__NAMESPACE_END__
+
+_SECTION(SECTION_SRC_GENERATED)
+
+namespace Glib
+{
+
+__NAMESPACE__::__CPPNAME__`'* wrap(__CNAME__`'* object, bool take_copy)
+{
+ return dynamic_cast<__NAMESPACE__::__CPPNAME__ *> (Glib::wrap_auto ((GObject*)(object), take_copy));
+}
+
+} /* namespace Glib */
+
+__NAMESPACE_BEGIN__
+
+
+/* The *_Class implementation: */
+
+_PCC_CLASS_IMPLEMENTATION()
+
+Glib::ObjectBase* __CPPNAME__`'_Class::wrap_new(GObject* o)
+{
+ifdef(`__BOOL_UNMANAGEABLE__',`dnl
+ return new __CPPNAME__`'((__CNAME__*)`'(o)); //top-level windows can not be manage()ed.
+',`dnl
+ return manage(new __CPPNAME__`'((__CNAME__*)`'(o)));
+')
+}
+
+
+/* The implementation: */
+
+ifdef(`__BOOL_CUSTOM_CTOR_CAST__',`dnl necessary for Gtk::Object implementation
+',`dnl
+__CPPNAME__::__CPPNAME__`'(const Glib::ConstructParams& construct_params)
+:
+ __CPPPARENT__`'(construct_params)
+{
+ _IMPORT(SECTION_CC_INITIALIZE_CLASS_EXTRA) dnl Does not seem to work - custom implement it instead.
+}
+
+__CPPNAME__::__CPPNAME__`'(__CNAME__* castitem)
+:
+ __CPPPARENT__`'(__PCAST__`'(castitem))
+{
+ _IMPORT(SECTION_CC_INITIALIZE_CLASS_EXTRA) dnl Does not seem to work - custom implement it instead.
+}
+
+')dnl
+ifdef(`__BOOL_CUSTOM_DTOR__',`dnl
+',`dnl
+__CPPNAME__::~__CPPNAME__`'()
+{
+ destroy_();
+}
+
+')dnl
+_CC_CLASS_IMPLEMENTATION()
+
+__NAMESPACE_END__
+
+dnl
+dnl
+dnl
+dnl
+_POP()
+dnl The actual class, e.g. Gtk::Widget, declaration:
+dnl _IMPORT(SECTION_H_SIGNALPROXIES_CUSTOM)
+
+_IMPORT(SECTION_CLASS1)
+public:
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ typedef __CPPNAME__ CppObjectType;
+ typedef __CPPNAME__`'_Class CppClassType;
+ typedef __CNAME__ BaseObjectType;
+ typedef __REAL_CNAME__`'Class BaseClassType;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+ virtual ~__CPPNAME__`'();
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+m4_ifdef(`__BOOL_PROTECTED_GCLASS__',
+`protected:',`dnl else
+private:')dnl endif
+
+ friend class __CPPNAME__`'_Class;
+ static CppClassType `'__BASE__`'_class_;
+
+ // noncopyable
+ __CPPNAME__`'(const __CPPNAME__&);
+ __CPPNAME__& operator=(const __CPPNAME__&);
+
+protected:
+ explicit __CPPNAME__`'(const Glib::ConstructParams& construct_params);
+ explicit __CPPNAME__`'(__CNAME__* castitem);
+
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+public:
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ static GType get_type() G_GNUC_CONST;
+
+ifdef(`__BOOL_DYNAMIC_GTYPE_REGISTRATION__',`
+ static GType get_type(GTypeModule* module) G_GNUC_CONST;
+',`')
+
+ static GType get_base_type() G_GNUC_CONST;
+#endif
+
+ ///Provides access to the underlying C GtkObject.
+ __CNAME__* gobj() { return reinterpret_cast<__CNAME__*>(gobject_); }
+
+ ///Provides access to the underlying C GtkObject.
+ const __CNAME__* gobj() const { return reinterpret_cast<__CNAME__*>(gobject_); }
+
+_H_VFUNCS_AND_SIGNALS()
+
+private:
+_IMPORT(SECTION_CLASS2)
+
+')
+
+
diff --git a/tools/m4/convert_gtkmm.m4 b/tools/m4/convert_gtkmm.m4
index 239ef0e..a0a97db 100644
--- a/tools/m4/convert_gtkmm.m4
+++ b/tools/m4/convert_gtkmm.m4
@@ -16,6 +16,7 @@
## License along with this library; if not, write to the Free
## Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+include(class_gtkobject.m4)
include(convert_base.m4)
include(convert_gtk.m4)
include(convert_pango.m4)
diff --git a/tools/m4/filelist.am b/tools/m4/filelist.am
index c03bc22..84963d5 100644
--- a/tools/m4/filelist.am
+++ b/tools/m4/filelist.am
@@ -17,6 +17,7 @@
## Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
files_codegen_m4 = \
+ class_gtkobject.m4 \
convert.m4 \
convert_atk.m4 \
convert_gdk.m4 \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]