Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lablgtk compatibility #10

Open
martindemello opened this issue Jan 6, 2023 · 0 comments
Open

lablgtk compatibility #10

martindemello opened this issue Jan 6, 2023 · 0 comments

Comments

@martindemello
Copy link
Contributor

lablgtk has a very nice object layer on top of gtk; its main drawback is that it is handwritten. It would be nice if we could identify patterns in the lablgtk api that could be autogenerated, so that code could be ported to ocaml-gtk easily.

Some examples:

  • widget#get_foo becomes widget#foo throughout (e.g. Widget_.get_height -> widget#height)
  • widget#signal_connect_foo becomes widget#connect#foo (e.g. button#connect#clicked)
  • Method arguments are labelled; this is probably hard to do automatically in every case, but there are some common cases like every signal connector having a ~callback argument that could be added to the code generator.
  • Widget constructors have a ~packing argument that autogenerates the packing to add them to their parents (e.g. let btn = GButton.button ~label:"Get Targets" ~packing:window#add ()) which is extremely nice to use and eliminates a lot of boilerplate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant