andlabs / libui

Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.
Other
10.74k stars 616 forks source link

Add uiScrollView GTK implementation #534

Open swissChili opened 3 years ago

swissChili commented 3 years ago

This adds a uiScrollView control which implements a scrolling container for a single child control. I have implemented this for the GTK backend. I don't use windows or OS X so I have not implemented this for those platforms, but looking into it it seems like this will be trivial to do on OS X and not too difficult on windows.

I have tried to keep the interface that uiScrollView exposes consistent with the rest of libui, but let me know if there are any changes that need to be made, I may implement this for the win32 backend if I have time.

One thing I was not sure about are the signatures in controlsigs.h, I just put the md5 sum of "uiScrollView" as its signature since I could not find any documentation as to what this value should be.

I've also added a small example program that just shows a bunch of buttons in a scrollable window. Note that the scroll bar is not visible in the screenshot but it's there and works as expected.