Search code examples
gtkscrollbargnomevalaclutter

How can I scroll a Clutter.ScrollActor with a scrollbar?


I have a a GtkClutter.Embed that holds a complete graph of clutter actors. The most important actor is container_actor that holds a variable number of actors (laid out with a FlowLayout) that may overflow the height allocated to the parent Embed.

At some point, the container_actor takes the stage and be the only actor displayed (along with its children).

At this point I would like to be able to scroll through the content of container_actor.

Making my Embed implementing Gtk.Scrollable gives the ability to have a scrollbar. Also I've noticed that Clutter proposes a Clutter.ScrollActor.

Is using those two classes the recommended way to go?

Or do I need to use implement Gtk.Scrollable and move my container_actor manually on vadjustment.value_changed ?

edit: here's a sample in c for ScrollActor


Solution

  • ClutterScrollActor does not know anything about GtkScrollable or GtkAdjustment, so you will have to implement scrolling manually. It's not necessary to implement GtkScrollable — you just need a GtkScrollbar widget, a GtkAdjustment and some code that connects to the GtkAdjustment::value-changed signal to determine the point to which you wish to scroll the contents of the ClutterScrollActor.