How to ensure a child actor in a sub-class is drawn on top of all actors in derived class



Hi,

I'm using Clutter in my project 'xfdashboard' which is similar to Gnome Shell but for other desktop environments. It is working pretty well but now I want something special ;)

The question is: Is there a way to draw one child actor above the other in a compounded actor if this actor may be used as a sub-class? I know you need more explaination ;)

I have a background actor (XfdashboardBackground) which draws the background of an actor. A lot of other visual actors are derived from this class, like buttons, popup-menus etc. They all use this background actor as sub-class.

The background actor also allows to draw an outline if requested. Therefore an effect (XfdashboardOutlineEffect) is added to this actor to ensure it is drawn at last regardless if the actor is a directly instanciated XfdashboardBackground object or any derived one (buttons etc.). This has the drawback that I have to duplicate all outline related properties like line width, color and so on - once in the background actor and once in the effect class. But it is working great ...

... but now I want sub-classes (especially the pop-up menu actors) to override the drawing functions to provide a different path to draw the background and outline. If I follow the coding style I would have to implement two virtual functions - one in the background actor and one in the effect class - and I have to ensure that overiding the virtual function in the background function would also override the one in the effect class.

My idea now is to get rid of the effect in the background actor but I do not find a way to ensure that the outline is draw last. The paint_node() function of pop-up menu would add all paint nodes of the background first and then add the paint nodes of the pop-up menu. So the pop-up menu overrides the background. That is just one way I tried. I also tried to create a cairo-based canvas object which contains the outline and which is added as child to the background actor but this does not work well.

So is there a way to ensure that a base class, which is used as sub-class at other actors, to ensure that one child is drawn at last?

Thanks for any hints.

Regards,
Stephan


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