Hi!
This is either:
- a bug
- unimplemented
- me being incompetent :D
I would like to create a custom widget and implement its #measure virtual method, according to https://docs.gtk.org/gtk4/class.Widget.html
in Vala, it would look something like (snippet from Highscore
protected override void measure (
Gtk.Orientation orientation,
int for_size,
out int minimum,
out int natural,
out int minimum_baseline,
out int natural_baseline
) {
stack.measure (orientation, for_size, out minimum, null, null, null);
minimum = int.max (minimum, 64);
if ((orientation == HORIZONTAL) == width_for_height)
natural = for_size >= 0 ? for_size : 64;
else
natural = int.min (minimum, 64);
minimum_baseline = natural_baseline = -1;
}
In a similar case for a custom Paintable's snapshot vfunc, what I did was:
@[GObject::Virtual]
def snapshot(snapshot : Gdk::Snapshot, width : Float64, height : Float64) : Nil
end
so I tried the same here
@[GObject::Virtual]
def measure(orientation : Gtk::Orientation, for_size : Int32, minimum : Int32, natural : Int32, minimum_baseline : Int32, natural_baseline : Int32) : Nil
end
But it still resulted in the following error:
Error: undefined local variable or method 'minimum' for MyWidget.class
Thanks in advance!
EDIT:
It appears to be the macro method in src/auto/gtk-4.0/widget.cr#L3818
Hi!
This is either:
I would like to create a custom widget and implement its
#measurevirtual method, according to https://docs.gtk.org/gtk4/class.Widget.htmlin Vala, it would look something like (snippet from Highscore
In a similar case for a custom Paintable's
snapshotvfunc, what I did was:so I tried the same here
But it still resulted in the following error:
Thanks in advance!
EDIT:
It appears to be the macro method in
src/auto/gtk-4.0/widget.cr#L3818