diff options
author | 2025-02-04 21:22:01 +0100 | |
---|---|---|
committer | 2025-02-04 21:22:01 +0100 | |
commit | f8c71a20a99568b2ddd0e07ac021d37ce2933856 (patch) | |
tree | bdf43cb3b92295e58ab892a4a431dd476644da7f /widget | |
parent | e8020f3eaf3baec2b41847f6250d8554136e8d89 (diff) | |
download | iced-f8c71a20a99568b2ddd0e07ac021d37ce2933856.tar.gz iced-f8c71a20a99568b2ddd0e07ac021d37ce2933856.tar.bz2 iced-f8c71a20a99568b2ddd0e07ac021d37ce2933856.zip |
Rename `on_link_clicked` to `on_link_click`
Diffstat (limited to 'widget')
-rw-r--r-- | widget/src/helpers.rs | 6 | ||||
-rw-r--r-- | widget/src/markdown.rs | 24 | ||||
-rw-r--r-- | widget/src/text/rich.rs | 12 |
3 files changed, 21 insertions, 21 deletions
diff --git a/widget/src/helpers.rs b/widget/src/helpers.rs index 4dd938ed..42d0f499 100644 --- a/widget/src/helpers.rs +++ b/widget/src/helpers.rs @@ -180,7 +180,7 @@ macro_rules! text { /// span(" "), /// span("And I am bold!").font(Font { weight: font::Weight::Bold, ..Font::default() }), /// ] -/// .on_link_clicked(never) +/// .on_link_click(never) /// .size(20) /// .into() /// } @@ -1153,7 +1153,7 @@ where /// span(" "), /// span("And I am bold!").font(Font { weight: font::Weight::Bold, ..Font::default() }), /// ]) -/// .on_link_clicked(never) +/// .on_link_click(never) /// .size(20) /// .into() /// } @@ -1197,7 +1197,7 @@ where /// " ", /// span("And I am bold!").font(Font { weight: font::Weight::Bold, ..Font::default() }), /// ] -/// .on_link_clicked(never) +/// .on_link_click(never) /// .size(20) /// .into() /// } diff --git a/widget/src/markdown.rs b/widget/src/markdown.rs index 3af301e9..ba4860d4 100644 --- a/widget/src/markdown.rs +++ b/widget/src/markdown.rs @@ -1048,7 +1048,7 @@ pub fn heading<'a, Message, Theme, Renderer>( level: &'a HeadingLevel, text: &'a Text, index: usize, - on_link_clicked: impl Fn(Url) -> Message + 'a, + on_link_click: impl Fn(Url) -> Message + 'a, ) -> Element<'a, Message, Theme, Renderer> where Message: 'a, @@ -1068,7 +1068,7 @@ where container( rich_text(text.spans(settings.style)) - .on_link_clicked(on_link_clicked) + .on_link_click(on_link_click) .size(match level { pulldown_cmark::HeadingLevel::H1 => h1_size, pulldown_cmark::HeadingLevel::H2 => h2_size, @@ -1090,7 +1090,7 @@ where pub fn paragraph<'a, Message, Theme, Renderer>( settings: Settings, text: &'a Text, - on_link_clicked: impl Fn(Url) -> Message + 'a, + on_link_click: impl Fn(Url) -> Message + 'a, ) -> Element<'a, Message, Theme, Renderer> where Message: 'a, @@ -1099,7 +1099,7 @@ where { rich_text(text.spans(settings.style)) .size(settings.text_size) - .on_link_clicked(on_link_clicked) + .on_link_click(on_link_click) .into() } @@ -1173,7 +1173,7 @@ pub fn code_block<'a, Message, Theme, Renderer>( settings: Settings, _code: &'a str, lines: &'a [Text], - on_link_clicked: impl Fn(Url) -> Message + Clone + 'a, + on_link_click: impl Fn(Url) -> Message + Clone + 'a, ) -> Element<'a, Message, Theme, Renderer> where Message: 'a, @@ -1184,7 +1184,7 @@ where scrollable( container(column(lines.iter().map(|line| { rich_text(line.spans(settings.style)) - .on_link_clicked(on_link_clicked.clone()) + .on_link_click(on_link_click.clone()) .font(Font::MONOSPACE) .size(settings.code_size) .into() @@ -1212,7 +1212,7 @@ where Renderer: core::text::Renderer<Font = Font> + 'a, { /// Produces a message when a link is clicked with the given [`Url`]. - fn on_link_clicked(url: Url) -> Message; + fn on_link_click(url: Url) -> Message; /// Displays an image. /// @@ -1229,7 +1229,7 @@ where container( rich_text(alt.spans(settings.style)) - .on_link_clicked(Self::on_link_clicked), + .on_link_click(Self::on_link_click), ) .padding(settings.spacing.0) .class(Theme::code_block()) @@ -1246,7 +1246,7 @@ where text: &'a Text, index: usize, ) -> Element<'a, Message, Theme, Renderer> { - heading(settings, level, text, index, Self::on_link_clicked) + heading(settings, level, text, index, Self::on_link_click) } /// Displays a paragraph. @@ -1257,7 +1257,7 @@ where settings: Settings, text: &'a Text, ) -> Element<'a, Message, Theme, Renderer> { - paragraph(settings, text, Self::on_link_clicked) + paragraph(settings, text, Self::on_link_click) } /// Displays a code block. @@ -1269,7 +1269,7 @@ where code: &'a str, lines: &'a [Text], ) -> Element<'a, Message, Theme, Renderer> { - code_block(settings, code, lines, Self::on_link_clicked) + code_block(settings, code, lines, Self::on_link_click) } /// Displays an unordered list. @@ -1304,7 +1304,7 @@ where Theme: Catalog + 'a, Renderer: core::text::Renderer<Font = Font> + 'a, { - fn on_link_clicked(url: Url) -> Url { + fn on_link_click(url: Url) -> Url { url } } diff --git a/widget/src/text/rich.rs b/widget/src/text/rich.rs index 02348b54..4d4a2861 100644 --- a/widget/src/text/rich.rs +++ b/widget/src/text/rich.rs @@ -36,7 +36,7 @@ pub struct Rich< wrapping: Wrapping, class: Theme::Class<'a>, hovered_link: Option<usize>, - on_link_clicked: Option<Box<dyn Fn(Link) -> Message + 'a>>, + on_link_click: Option<Box<dyn Fn(Link) -> Message + 'a>>, } impl<'a, Link, Message, Theme, Renderer> @@ -61,7 +61,7 @@ where wrapping: Wrapping::default(), class: Theme::default(), hovered_link: None, - on_link_clicked: None, + on_link_click: None, } } @@ -137,11 +137,11 @@ where /// Sets the message that will be produced when a link of the [`Rich`] text /// is clicked. - pub fn on_link_clicked( + pub fn on_link_click( mut self, on_link_clicked: impl Fn(Link) -> Message + 'a, ) -> Self { - self.on_link_clicked = Some(Box::new(on_link_clicked)); + self.on_link_click = Some(Box::new(on_link_clicked)); self } @@ -271,7 +271,7 @@ where let style = theme.style(&self.class); for (index, span) in self.spans.as_ref().as_ref().iter().enumerate() { - let is_hovered_link = self.on_link_clicked.is_some() + let is_hovered_link = self.on_link_click.is_some() && Some(index) == self.hovered_link; if span.highlight.is_some() @@ -386,7 +386,7 @@ where shell: &mut Shell<'_, Message>, _viewport: &Rectangle, ) { - let Some(on_link_clicked) = &self.on_link_clicked else { + let Some(on_link_clicked) = &self.on_link_click else { return; }; |