can-lehmann / owlkettle

A declarative user interface framework based on GTK 4
https://can-lehmann.github.io/owlkettle/README
MIT License
367 stars 14 forks source link

Add scrollbar widget + Full wrapping of GtkAdjustment #126

Open PhilippMDoerner opened 8 months ago

PhilippMDoerner commented 8 months ago

This PR's value lies 90% in the fact it wraps GtkAdjustment more fully (or rather: provides a first attempt to), which is useful to more fully encompass functionality of other widgets that make use of it, such as (as per GtkAdjustment docs):

GtkSpinButton, GtkViewport, GtkScrollbar and GtkScale.

Scrollbar is just a nice side-addendum (though it all started with wanting to wrap that for feature completeness).

HOWEVER: This is mostly the foundation for the actual PR in the end. 1 key thing does not work yet - Event listeners on GtkAdjustment. That is particularly difficult because unlike with Toast in ToastOverlay in #122 , GtkAdjustment is not a GTKWidget. So the entire existing ecosystem for setting up event listeners is not set out for this.

That manifests here in the example compiling, but the event listeners (despite GTK not complaining!) not firing at all. I have honestly no clue what could be the cause for that and have to rely on feedback to give me further clues, I'm kinda stuck.

I'll move this out of the draft stage with updated docs etc. once we can make those event listeners work.

can-lehmann commented 2 weeks ago

I am not sure if we already discussed this at some point, but I do not see the advantage of wrapping GtkAdjustment. Mainly because it does not work well with the declarative API. Is there any advantage to wrapping it / where would it be used?

PhilippMDoerner commented 2 weeks ago

The lion's share of the value I see in enabling access to scroll events and being able to know what your current scroll position is. That knowledge in particular in webdev I needed roughly half a dozen times so far, basically every time you want to add something to the screen but only when the user scrolled fully to the bottom/to the top.