Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 699
Name is carl Avatar asked Feb 02 '26 19:02

Name is carl


1 Answers

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.

like image 77
ebassi Avatar answered Feb 05 '26 13:02

ebassi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!