On Sun, 2008-07-13 at 18:04 +0300, Michael Boccara wrote:
> Murray Cumming wrote: 
> > On Wed, 2008-07-09 at 17:37 +0300, Michael Boccara wrote:
> >   
> > > I am new to the GLib and GObjects world, so my question may sound dumb.
> > > Is it possible to implement new subclasses of Clutter::Actor without 
> > > having to subclass the ClutterActor GObject ?
> > > In other words, can we create our own actors using cluttermm only ?
> > >     
> > 
> > It should be. You might be the first person to try it though.
> > 
> >   
> I would be surprised if so.

cluttermm is really very new.

I hope to find the time to make a C++ version of my clutter tutorial,
including all the examples, which includes custom actors. But I am
currently busy with other (paying) work.

> As soon as you want a clutter actor with a more complex geometry than
> just a rectangle, the only way is to subclass ClutterActor and
> override the 'paint' method. In clutter, it would mean defining and
> binding the clutter_custom_actor_paint() function, with all the
> GObject subclassing nightmare it involves.
> Or am I missing something ?
> 
> Actually just recently I got pretty optimistic about the possibility
> of  relying only on the C++ inheritance in the cluttermm level only,
> since I noticed an interesting change in the clutter_actor_paint()
> definition:
> 
> void
> clutter_actor_paint (ClutterActor *self)
> {
>     // was like this in clutter-0.6.0
>     // if (G_LIKELY (klass->paint))
>     //   klass->paint (self);
>     
>     // and now in clutter-0.8.0 it is:
>     g_signal_emit (self, actor_signals[PAINT], 0);
> }
> 
> Up until clutter-0.6.0, the paint virtual method was hard-assigned to
> clutter_custom_actor_paint, which was making it impossible to get to
> use Clutter::CustomActor::paint() from the clutter_main() loop.

That would have been a vfunc (a function pointer) in the C struct. We
generally wrap those as *_vfunc(). in *mm APIs, so it would not be a
problem to override that.

> But  now that clutter-0.8.0 is emitting a Glib signal I guess it makes
> it possible for cluttermm to bind the PAINT signal to the
> Clutter::CusomActor::paint() virtual method.

If the signal has a default handler (like a vfunc) then it can be
overridden in the *mm API. For instance, on_paint(). If it has no
default signal handler (unusual), you can just connect to the signal.


-- 
Murray Cumming
[EMAIL PROTECTED]
www.murrayc.com
www.openismus.com


-- 
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to