ui::OptionalFloat¶
Header: winui/core/OptionalFloat.hpp.
A float that may be unset: the type of every optional size, length and value in an option field or setter. Any number fills it (.min_item_width = 120, set_width(240)), std::nullopt or {} leaves it unset, and it converts to and from std::optional<float>. Reading it works as on an optional: test it, then dereference it or call value_or().
Example:
const ui::TileLayout tiles{ .min_item_width = 120, .min_item_height = 90 };
auto panel = std::make_unique<ui::TilePanelControl>();
panel->set_item_width(std::nullopt); // back to the first item's width
OptionalFloat¶
Unset.
OptionalFloat¶
Unset.
OptionalFloat¶
Set to value, converted to float.
OptionalFloat¶
The same value as value, set or unset.
operator std::optional< float >¶
The value as a std::optional.
has_value¶
Whether a value is set.
operator bool¶
Whether a value is set.
operator*¶
The value; it must be set.
value_or¶
The value, or fallback when unset.
reset¶
Unsets the value.