Skip to content

Widget: Add measure+get_preferred_size() → structs

Daniel Boles requested to merge dboles/return-multiple into master

Widget: Add measure+get_preferred_size() → structs

Add overloads returning structs with named members – as opposed to the ‘raw’ C output parameters, and to returning only tuples which in their anonymity are error-prone & not as user-friendly as named members are.

This makes it far easier/nicer to write the very-frequent code that currently must declare redundant/uninit'd variables, pass out args, etc…

int minimum, natural, minimum_baseline, natural_baseline;
widget.measure(Orientation::HORIZONTAL, -1, minimum, natural,
               minimum_baseline, natural_baseline);
do_something(natural);

can become:

do_something(widget.measure(Orientation::HORIZONTAL).sizes.natural)

#38 (comment 1903091)

Edited by Daniel Boles

Merge request reports