This commit is contained in:
Ashley Wulber 2025-02-28 12:06:24 -05:00
parent 0ce914b57a
commit 76930d8624
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
58 changed files with 173 additions and 183 deletions

View file

@ -7,9 +7,8 @@ use std::borrow::Cow;
use std::sync::{Arc, Mutex};
pub use appearance::{Appearance, StyleSheet};
use iced::advanced::widget;
use crate::widget::{icon, Container, RcElementWrapper, RcWrapper};
use crate::widget::{icon, Container, RcWrapper};
use iced_core::event::{self, Event};
use iced_core::layout::{self, Layout};
use iced_core::text::{self, Text};
@ -418,8 +417,8 @@ where
text_line_height: text::LineHeight,
}
impl<'a, S: AsRef<str>, Message> Widget<Message, crate::Theme, crate::Renderer>
for List<'a, S, Message>
impl<S: AsRef<str>, Message> Widget<Message, crate::Theme, crate::Renderer>
for List<'_, S, Message>
where
[S]: std::borrow::ToOwned,
{

View file

@ -14,13 +14,12 @@ pub use widget::*;
/// Displays a list of options in a popover menu on select.
pub fn dropdown<
'a,
S: AsRef<str> + std::clone::Clone + Send + Sync + 'static,
Message: 'static + Clone,
>(
selections: &'a [S],
selections: &[S],
selected: Option<usize>,
on_selected: impl Fn(usize) -> Message + Send + Sync + 'static,
) -> Dropdown<'a, S, Message> {
) -> Dropdown<'_, S, Message> {
Dropdown::new(selections, selected, on_selected)
}

View file

@ -180,8 +180,8 @@ impl<'a, Message: 'a> Overlay<'a, Message> {
}
}
impl<'a, Message> iced_core::Overlay<Message, crate::Theme, crate::Renderer>
for Overlay<'a, Message>
impl<Message> iced_core::Overlay<Message, crate::Theme, crate::Renderer>
for Overlay<'_, Message>
{
fn layout(&mut self, renderer: &crate::Renderer, bounds: Size) -> layout::Node {
let position = self.position;
@ -279,8 +279,8 @@ struct InnerList<'a, S, Item, Message> {
text_line_height: text::LineHeight,
}
impl<'a, S, Item, Message> Widget<Message, crate::Theme, crate::Renderer>
for InnerList<'a, S, Item, Message>
impl<S, Item, Message> Widget<Message, crate::Theme, crate::Renderer>
for InnerList<'_, S, Item, Message>
where
S: AsRef<str>,
Item: Clone + PartialEq,

View file

@ -159,7 +159,7 @@ impl<'a, S: AsRef<str>, Message: 'a, Item: Clone + PartialEq + 'static>
cursor: mouse::Cursor,
viewport: &Rectangle,
) {
let font = self.font.unwrap_or_else(|| crate::font::default());
let font = self.font.unwrap_or_else(crate::font::default);
draw(
renderer,
@ -278,7 +278,7 @@ pub fn layout(
bounds: Size::new(f32::MAX, f32::MAX),
size: iced::Pixels(text_size),
line_height: text_line_height,
font: font.unwrap_or_else(|| crate::font::default()),
font: font.unwrap_or_else(crate::font::default),
horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Top,
shaping: text::Shaping::Advanced,
@ -422,7 +422,7 @@ pub fn overlay<'a, S: AsRef<str>, Message: 'a, Item: Clone + PartialEq + 'static
bounds: Size::new(f32::MAX, f32::MAX),
size: iced::Pixels(text_size),
line_height,
font: font.unwrap_or_else(|| crate::font::default()),
font: font.unwrap_or_else(crate::font::default),
horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Top,
shaping: text::Shaping::Advanced,

View file

@ -6,7 +6,7 @@ use super::menu::{self, Menu};
use crate::widget::icon::{self, Handle};
use crate::Element;
use derive_setters::Setters;
use iced::{window, Radians};
use iced::window;
use iced_core::event::{self, Event};
use iced_core::text::{self, Paragraph, Text};
use iced_core::widget::tree::{self, Tree};
@ -139,8 +139,8 @@ where
}
}
impl<'a, S: AsRef<str> + Send + Sync + Clone + 'static, Message: 'static + std::clone::Clone>
Widget<Message, crate::Theme, crate::Renderer> for Dropdown<'a, S, Message>
impl<S: AsRef<str> + Send + Sync + Clone + 'static, Message: 'static + std::clone::Clone>
Widget<Message, crate::Theme, crate::Renderer> for Dropdown<'_, S, Message>
where
[S]: std::borrow::ToOwned,
{
@ -270,7 +270,7 @@ where
cursor: mouse::Cursor,
viewport: &Rectangle,
) {
let font = self.font.unwrap_or_else(|| crate::font::default());
let font = self.font.unwrap_or_else(crate::font::default);
draw(
renderer,
theme,
@ -407,7 +407,7 @@ pub fn layout(
bounds: Size::new(f32::MAX, f32::MAX),
size: iced::Pixels(text_size),
line_height: text_line_height,
font: font.unwrap_or_else(|| crate::font::default()),
font: font.unwrap_or_else(crate::font::default),
horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Top,
shaping: text::Shaping::Advanced,