Why does _WRAP_SIGNAL look for signal in base class?



Dear all,
	I'm trying to expose the "collision" signal of a ClutterBox2DChild.
I've wrapped the class as per the documentation (included below) which
uses the _WRAP_SIGNAL() macro.  The generated code (immediately below)
gets the parent class of the current object's class and then looks for
the "collision" signal handler in the base class.  However, in general
g_signal_new is used to create a new signal which is normally stored in 
static gint my_type_signals[LAST_SIGNAL];
rather than being stored in some structure in the base class.

My question is, why then does the generated code from _WRAP_SIGNAL try
and access base->the_signal_name?

void
Clutter::Box2D::Box2DChild::on_collision(Glib::RefPtr<Clutter::Box2D::Box2DCollision> & c)
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the
parent class of the object class (The original underlying C class).
  );

  if(base && base->collision)

(*base->collision)(gobj(),_CONVERT(Glib::RefPtr<Clutter::Box2D::Box2DCollision>&,ClutterBox2DCollision*,c,57));
}

snipped box2d-child.hg:
class Box2DChild :
  public Clutter::ChildMeta
{
  _CLASS_GOBJECT(Box2DChild, ClutterBox2DChild, CLUTTER_BOX2D_CHILD,
Clutter::ChildMeta, ClutterChildMeta)

protected:
  _CTOR_DEFAULT

public:
  _WRAP_CREATE()
  _WRAP_SIGNAL(void
collision(Glib::RefPtr<Clutter::Box2D::Box2DCollision> & c),
"collision")
};

snipped convert_clutter_box2d.m4:
_CONVERSION(`const
Glib::RefPtr<Box2DCollision>&',`ClutterBox2DCollision*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`ClutterBox2DCollision*',`Glib::RefPtr<Box2DCollision>',`Glib::wrap($3)')
_CONVERSION(`ClutterBox2DCollision*',`Glib::RefPtr<const
Box2DCollision>',`Glib::wrap($3)')
_CONVERSION(`const
Glib::RefPtr<Clutter::Box2D::Box2DCollision>&',`ClutterBox2DCollision*',__CONVERT_REFPTR_TO_P)

-- 
Aidan Delaney

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]