Closed hugrs closed 3 years ago
Thanks for your contribution. This looks fine. Concerning your two questions:
as_stack
method to the stack
class. Look for instance at gWindow.ml
for how to do that.Thank you for your quick reply. I added as_stack as a method in the stack class and it perfectly solved the type mismatch for stack_switcher. I completed the example as well so that both widgets have a working example.
Regarding the gtk3 version, I had a quick look in repology to see which versions of gtk are supported by mainstream distributions. Debian stable provides 3.24, and very few of them provide a version inferior to that. I think it's safe to assume that adding functionality from 3.22 and earlier without any extra checks should be fine. Let me know what you think.
Actually, the README.md
file states explicitly that lablgtk3 requires gtk+-3.18 or better.
So GtkStack
is already covered.
We might raise the requirement in the future, rather than introducing conditional compilation.
Let me known when this is ready for inclusion.
Ok then let's follow the requirements in the readme.
There is just the icon-size
property of stack_switcher that was added later in 3.20, so i've documented that.
Now the PR is ready for review.
Hi,
I'm an OCaml beginner and I wanted to use the GtkStack widget from GTK 3.10+ in a small project.
I added bindings for GtkStack and GtkStackSwitcher, along with an example for the Stack widget. The bindings are very naive, I only added enough to make the examples compile with
dune build @all
.Also I would like to ask for advice regarding some points:
The StackSwitcher has a "stack" property where you can get/set the GtkStack widget associated to it. As you can see in the stackswitcher.ml example, I am trying to use the
set_stack
method. However, it expects aGtk.stack Gtk.obj
and my variable is aGPack.stack
. I don't know if I'm just missing an OCaml concept or that the type declarations in the binding are wrong, but I cannot figure out how to convert from one to the other.My other concern is that GtkStack and StackSwitcher have only been introduced in 3.10, and I'm not sure how to handle backwards-compatibility with older versions. I have noticed the
HASGTK*
macros in C, should I do the same and define aHASGTK310
macro ?