ui::Inline¶
Header: winui/ui/text/Inlines.hpp.
One run of inline text with its own formatting. Every formatting field left at its default inherits the containing block's.
An inline with on_click or navigate_uri is a link. It is underlined and drawn in the theme's link colors. A press and release on it calls on_click, then opens navigate_uri. Inlines go to TextControl::set_inlines() or ui::Text::inlines, or into a Paragraph for RichText.
Example:
window.set_content(ui::Text{
.inlines = {
{.text = "Text can be "},
{.text = "bold", .weight = ui::FontWeight::Bold},
{.text = ", "},
{.text = "underlined", .underline = true},
ui::line_break(),
{.text = "or a link", .on_click = [] { std::println("clicked"); }, .navigate_uri = "https://example.com/"},
},
});
text¶
The run's text (UTF-8). \n is a line break.
font_family¶
The font family; unset inherits.
font_size¶
The font size in DIPs; unset inherits.
weight¶
The font weight; unset inherits.
italic¶
Italic. Only switches italic on; an italic block stays italic.
underline¶
Underlined.
strikethrough¶
Struck through.
color¶
The text color; unset inherits.
on_click¶
Makes the inline a link that calls this when clicked. It is a std::function because inlines are brace-initialized in vectors, which copy them (see spec/Common.hpp's handler note).
navigate_uri¶
Makes the inline a link that opens navigate_uri in its default app when clicked, after on_click.
is_link¶
Whether this inline is a link, which means it has on_click or a navigate_uri.